From 51a6fcbfb932f9ef905c8f77765faf80b88a8f76 Mon Sep 17 00:00:00 2001 From: liaoboping <344114999@qq.com> Date: Sun, 28 Sep 2025 10:40:20 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=B8=89=E6=96=B9=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 22 +++++++++++----------- src/utils/openThirdLogin.js | 2 +- src/utils/request.js | 21 +++++++++++++++------ src/views/user/Welcome.vue | 23 ++++++++++++++++++++++- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/permission.js b/src/permission.js index b0ba92c..77e8dad 100644 --- a/src/permission.js +++ b/src/permission.js @@ -11,7 +11,7 @@ import openThirdLogin from './utils/openThirdLogin' NProgress.configure({ showSpinner: false }) // NProgress Configuration -const allowList = ['thirdLogin', 'login', 'register', 'registerResult'] // no redirect allowList +const allowList = ['login', 'Welcome'] // no redirect allowList const loginRoutePath = '/user/login' const defaultRoutePath = '/user/welcome' @@ -58,11 +58,11 @@ router.beforeEach((to, from, next) => { }) // 失败时,获取用户信息失败时,调用登出,来清空历史保留信息 store.dispatch('Logout').then(() => { - // if (process.env.NODE_ENV === 'production') { - // openThirdLogin() - // } else { - next({ path: loginRoutePath, query: { redirect: to.fullPath } }) - // } + if (process.env.NODE_ENV === 'production') { + openThirdLogin() + } else { + next({ path: loginRoutePath, query: { redirect: to.fullPath } }) + } }) }) } else { @@ -74,11 +74,11 @@ router.beforeEach((to, from, next) => { // 在免登录名单,直接进入 next() } else { - // if (process.env.NODE_ENV === 'production') { - // openThirdLogin() - // } else { - next({ path: loginRoutePath, query: { redirect: to.fullPath } }) - // } + if (process.env.NODE_ENV === 'production') { + openThirdLogin() + } else { + next({ path: loginRoutePath, query: { redirect: to.fullPath } }) + } NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it } } diff --git a/src/utils/openThirdLogin.js b/src/utils/openThirdLogin.js index fdd5771..ef5efef 100644 --- a/src/utils/openThirdLogin.js +++ b/src/utils/openThirdLogin.js @@ -1,5 +1,5 @@ export default () => { - const redirectUri = window.location.origin + '/user/thirdLogin' + const redirectUri = window.location.origin + '/user/welcome' window.location.href = window._CONFIG.thirdLoginUrl + '?response_type=code&active_type=user&state=' + diff --git a/src/utils/request.js b/src/utils/request.js index ec63cf6..44f3817 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -26,7 +26,10 @@ const errorHandler = (error) => { description: data.message, }) } - if (error.response.status === 401 && !(data.result && data.result.isLogin)) { + if ( + (error.response.status === 500 && error.response.data.message === '未找到授权信息') || + (error.response.status === 401 && !(data.result && data.result.isLogin)) + ) { notification.error({ message: '温馨提示', description: '登录过期,请重新登录', @@ -35,13 +38,19 @@ const errorHandler = (error) => { if (token) { store.dispatch('Logout').then(() => { setTimeout(() => { - // if (process.env.NODE_ENV === 'production') { - // openThirdLogin() - // } else { - window.location.reload() - // } + if (process.env.NODE_ENV === 'production') { + openThirdLogin() + } else { + window.location.reload() + } }, 1500) }) + } else { + if (process.env.NODE_ENV === 'production') { + openThirdLogin() + } else { + window.location.reload() + } } } } diff --git a/src/views/user/Welcome.vue b/src/views/user/Welcome.vue index 61fd5a1..d257375 100644 --- a/src/views/user/Welcome.vue +++ b/src/views/user/Welcome.vue @@ -23,6 +23,7 @@ From cf6127ae208a4c3bfe276bb1f9e58ffcf50b8c31 Mon Sep 17 00:00:00 2001 From: liaoboping <344114999@qq.com> Date: Sun, 28 Sep 2025 14:10:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=9B=BE=E5=BD=A2icon24=C3=9724?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/simulationScene/database/txsjk.vue | 2 +- vue.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/simulationScene/database/txsjk.vue b/src/views/simulationScene/database/txsjk.vue index f712859..5bd75fd 100644 --- a/src/views/simulationScene/database/txsjk.vue +++ b/src/views/simulationScene/database/txsjk.vue @@ -14,7 +14,7 @@ 新增