From 3f4e27177c55d7b3af63a18e9ed0465510b17b00 Mon Sep 17 00:00:00 2001 From: guoyue Date: Thu, 29 Sep 2022 11:02:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E7=99=BD=E5=B1=8F=E9=9C=80=E5=BC=BA=E5=88=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/utils/request.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/front/src/utils/request.js b/front/src/utils/request.js index 0dead457..9ff3db0b 100644 --- a/front/src/utils/request.js +++ b/front/src/utils/request.js @@ -32,12 +32,13 @@ const handleCode = (code, msg, res) => { // debugger switch (code) { case 401: - store.dispatch('user/resetAll').catch(() => {}) + debugger + store.dispatch('user/resetAll').catch(() => { }) break case 403: router.push({ path: '/401' - }).catch(() => {}) + }).catch(() => { }) break case 500: message.error(msg || '接口异常') @@ -111,11 +112,19 @@ instance.interceptors.response.use( setAccessToken(response.headers.token) } if (response.headers.redirect) { + const _old_href = window.location.href.split('#')[0]; + const _new_href = response.headers.redirect.split('#')[0]; window.location.replace(response.headers.redirect) - // 西海岸-不重新加载 - // if(!whoShow.itShowXiHaiAn) { - // location.reload() - // } + // url 相同,强制刷新 + if (_old_href === _new_href) { + location.reload() + } + + // location.reload() + // 西海岸-不重新加载 + // if(!whoShow.itShowXiHaiAn) { + // location.reload() + // } return response } if (response.headers.redirect === '/#/login') {