From b26c60eb8fa6064e0263fa0f28f08f76dbe71d37 Mon Sep 17 00:00:00 2001 From: zlt2000 Date: Sun, 10 May 2020 20:17:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E5=87=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/module/index.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/zlt-web/back-web/src/main/resources/static/module/index.js b/zlt-web/back-web/src/main/resources/static/module/index.js index 5a10849e..183a5f3c 100644 --- a/zlt-web/back-web/src/main/resources/static/module/index.js +++ b/zlt-web/back-web/src/main/resources/static/module/index.js @@ -214,12 +214,26 @@ layui.define(['config', 'admin', 'layer', 'laytpl', 'element', 'form'], function $('#btnLogout').click(function () { layer.confirm('确定退出登录?', function () { let token = config.getToken(); - let accessToken; + let isExistsToken = false; if (token) { - accessToken = token.access_token; + let accessToken = token.access_token; + config.removeToken(); + + if (accessToken) { + isExistsToken = true; + admin.req('api-uaa/oauth/check_token?token='+accessToken, {}, function (data) { + if (data.active) { + let loginPageUrl = window.location.protocol + '//' + window.location.host + '/login.html'; + window.location = config.base_server + 'api-uaa/oauth/remove/token?redirect_uri='+loginPageUrl+'&access_token='+accessToken; + } else { + location.replace('login.html'); + } + }, 'POST'); + } + } + if (!isExistsToken) { + location.replace('login.html'); } - config.removeToken(); - window.location = config.base_server + 'api-uaa/oauth/remove/token?redirect_uri=http://127.0.0.1:8066/login.html&access_token='+accessToken; }); }); // 修改密码