From 4827d750829b67de55de585e06f1bbc72e27ecab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E5=90=AF=E9=BE=99?= Date: Fri, 30 Aug 2024 15:59:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/personal/useTokenAndLock.ts | 3 ++- src/permission.js | 1 + src/store/modules/permission.js | 6 +++++- vite.config.ts | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/layouts/components/personal/useTokenAndLock.ts b/src/layouts/components/personal/useTokenAndLock.ts index 6fbcbfd..70702bb 100644 --- a/src/layouts/components/personal/useTokenAndLock.ts +++ b/src/layouts/components/personal/useTokenAndLock.ts @@ -29,8 +29,9 @@ export default function () { if (trxToken) { params.trxToken = trxToken } + console.log('replaceToken开始, 传参:', params) const res = await replaceToken(params) - console.log('自动刷新 token 看是否失效', res) + console.log('replaceToken返回', res) if (!res.success) { clearTimer() store.dispatch('permission/ResetRoutes') diff --git a/src/permission.js b/src/permission.js index 904a73b..f4e9554 100644 --- a/src/permission.js +++ b/src/permission.js @@ -34,6 +34,7 @@ router.beforeEach(async (to, from, next) => { store.dispatch('GetUserInfo') next({ ...to, replace: true }) } catch (error) { + console.log('调用permission/GenerateRoutes 出现 catch', error) // remove token and go to login page to re-login await store.dispatch('permission/ResetRoutes', false) next('/login') diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index cbfd4a9..80b0f5b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -105,8 +105,10 @@ const actions = { return } } + console.log('开始获取权限 getUserPermissions, 传参 trxToken:', getTrxToken()) getUserPermissions({ trxToken: getTrxToken() }) .then(data => { + console.log('getUserPermissions, data:', data) if (data.success) { if (enablePermissionStorage) { localStorage.setItem(menuKey, JSON.stringify(data.data)) @@ -115,6 +117,7 @@ const actions = { } }) .catch(err => { + console.log('getUserPermissions, err:', err) console.log(err) }) }) @@ -130,6 +133,7 @@ const actions = { }, ResetRoutes({ commit, dispatch }, redirectToLogin = true) { return new Promise(resolve => { + console.trace('ResetRoutes') const reset = () => { resetRouter() commit('SET_ROUTES', null) @@ -144,7 +148,7 @@ const actions = { dispatch('tagsView/delAllViews', null, { root: true }) removeToken() removeTrxToken() - if (redirectToLogin) window.location.href = '/login' + // if (redirectToLogin) window.location.href = '/login' resolve() } // 调用天融信单点退出系统 diff --git a/vite.config.ts b/vite.config.ts index 4f60711..4577ddf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -28,6 +28,7 @@ export default defineConfig({ css, build: { outDir: 'cmc-web', - assetsDir: 'static' + assetsDir: 'static', + sourcemap: true } })