From 4b681144e1d22d66c59e49f9befe7d53eb433c65 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 27 Nov 2024 16:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=B7=B3=E8=BD=AC=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 5d7d72a..208d187 100644 --- a/index.html +++ b/index.html @@ -150,12 +150,24 @@ console.log('当前登录的token:' + token); if (token) { console.log('走的跳转登录'); - var url = window.location.href; //获取当前页面的url - if (url.indexOf("?") != -1) { //判断是否存在参数 - url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数 - window.history.pushState({}, 0, url); - } - sessionStorage.setItem('gz-token', token); + // 校验传过来的token是否合法 + let url = dataUrl + 'health/isHealth' + ajaxRequest(url, "GET", null, false, function () { + }, function (result) { + console.log(result); + if (result.code === 200) { + var url = window.location.href; //获取当前页面的url + if (url.indexOf("?") != -1) { //判断是否存在参数 + url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数 + window.history.pushState({}, 0, url); + } + sessionStorage.setItem('gz-token', token); + } else if (result.code === 401) { + closeWindowOpen(); + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); } else { // console.log('走的自己登录'); // login();