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') {