From 44c26dcc12bae5121f3c60f333e41a744e1adf76 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Tue, 16 Jan 2024 10:40:36 +0800 Subject: [PATCH] fix --- src/main.ts | 3 ++- src/router/index.ts | 3 ++- src/tool/https.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index c435d0c4..7015c7c0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -38,7 +38,8 @@ async function isMurmur() { }) .catch((res) => { }); - if (isSxis&&!token) { + if (isSxis) { + // if (isSxis&&!token) { // if(isLogin != 'login'){ // return // } diff --git a/src/router/index.ts b/src/router/index.ts index c3fef601..1e5b1026 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -94,8 +94,9 @@ router.beforeEach((to, from, next) => { //机房用户 let murmurStr:any = localStorage.getItem('murmurStr') let getIsMurmur:any = getCookie("isMurmur") + let token = getCookie("token"); let isMurmur = JSON.parse(getIsMurmur) - if(isMurmur&& murmurStr){ + if(isMurmur&& murmurStr && token){ const toName = to.name === 'login'; if (toName) { next({ name: 'home' }); diff --git a/src/tool/https.js b/src/tool/https.js index 608acb72..19aa6cfb 100644 --- a/src/tool/https.js +++ b/src/tool/https.js @@ -80,7 +80,7 @@ axios.interceptors.response.use((res) =>{ } }, function(error) { - if(error?.response?.status === 401&&router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login + if(error?.response?.status === 401 && router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login router.replace('/login') return Promise.reject() }