diff --git a/src/router/guard/permissionGuard.ts b/src/router/guard/permissionGuard.ts index 8f1fe0c..ed80df2 100644 --- a/src/router/guard/permissionGuard.ts +++ b/src/router/guard/permissionGuard.ts @@ -33,7 +33,7 @@ export function createPermissionGuard(router: Router) { // Whitelist can be directly entered if (whitePathList.includes(to.path as PageEnum)) { - if (to.path === LOGIN_PATH && token) { + if (to.path === LOGIN_PATH && token && !to.query?.ltpasToken) { const isSessionTimeout = userStore.getSessionTimeout; try { await userStore.afterLoginAction(); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 514d5a3..9e6435f 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -131,11 +131,12 @@ export const useUserStore = defineStore({ ): Promise { try { const data = await singleLoginApi(params, params.mode); + const userInfo = await this.getUserInfoAction(); const { token } = data; // save token this.setToken(token); - router.replace(params.targetURL) + router.replace(params.targetURL || params.redirect || userInfo?.homePath || PageEnum.BASE_HOME) return await this.afterLoginAction(false); } catch (error) { diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index e03717b..21a76fe 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -82,7 +82,9 @@ const transform: AxiosTransform = { timeoutMsg = t('登录超时,请重新登录!'); const userStore = useUserStoreWithOut(); userStore.setToken(undefined); - userStore.logout(true); + if (!window.location.hash.includes('login')) { + userStore.logout(true); + } const go = useGo(); go('/login'); break; diff --git a/src/views/secondDev/Login.vue b/src/views/secondDev/Login.vue index 52732d6..ecef95d 100644 --- a/src/views/secondDev/Login.vue +++ b/src/views/secondDev/Login.vue @@ -1,5 +1,5 @@