fix: 增加日志

develop
时启龙 2024-08-30 15:59:03 +08:00
parent e0480a5ce4
commit 4827d75082
4 changed files with 10 additions and 3 deletions

View File

@ -29,8 +29,9 @@ export default function () {
if (trxToken) { if (trxToken) {
params.trxToken = trxToken params.trxToken = trxToken
} }
console.log('replaceToken开始, 传参:', params)
const res = await replaceToken(params) const res = await replaceToken(params)
console.log('自动刷新 token 看是否失效', res) console.log('replaceToken返回', res)
if (!res.success) { if (!res.success) {
clearTimer() clearTimer()
store.dispatch('permission/ResetRoutes') store.dispatch('permission/ResetRoutes')

View File

@ -34,6 +34,7 @@ router.beforeEach(async (to, from, next) => {
store.dispatch('GetUserInfo') store.dispatch('GetUserInfo')
next({ ...to, replace: true }) next({ ...to, replace: true })
} catch (error) { } catch (error) {
console.log('调用permission/GenerateRoutes 出现 catch', error)
// remove token and go to login page to re-login // remove token and go to login page to re-login
await store.dispatch('permission/ResetRoutes', false) await store.dispatch('permission/ResetRoutes', false)
next('/login') next('/login')

View File

@ -105,8 +105,10 @@ const actions = {
return return
} }
} }
console.log('开始获取权限 getUserPermissions, 传参 trxToken:', getTrxToken())
getUserPermissions({ trxToken: getTrxToken() }) getUserPermissions({ trxToken: getTrxToken() })
.then(data => { .then(data => {
console.log('getUserPermissions, data:', data)
if (data.success) { if (data.success) {
if (enablePermissionStorage) { if (enablePermissionStorage) {
localStorage.setItem(menuKey, JSON.stringify(data.data)) localStorage.setItem(menuKey, JSON.stringify(data.data))
@ -115,6 +117,7 @@ const actions = {
} }
}) })
.catch(err => { .catch(err => {
console.log('getUserPermissions, err:', err)
console.log(err) console.log(err)
}) })
}) })
@ -130,6 +133,7 @@ const actions = {
}, },
ResetRoutes({ commit, dispatch }, redirectToLogin = true) { ResetRoutes({ commit, dispatch }, redirectToLogin = true) {
return new Promise(resolve => { return new Promise(resolve => {
console.trace('ResetRoutes')
const reset = () => { const reset = () => {
resetRouter() resetRouter()
commit('SET_ROUTES', null) commit('SET_ROUTES', null)
@ -144,7 +148,7 @@ const actions = {
dispatch('tagsView/delAllViews', null, { root: true }) dispatch('tagsView/delAllViews', null, { root: true })
removeToken() removeToken()
removeTrxToken() removeTrxToken()
if (redirectToLogin) window.location.href = '/login' // if (redirectToLogin) window.location.href = '/login'
resolve() resolve()
} }
// 调用天融信单点退出系统 // 调用天融信单点退出系统

View File

@ -28,6 +28,7 @@ export default defineConfig({
css, css,
build: { build: {
outDir: 'cmc-web', outDir: 'cmc-web',
assetsDir: 'static' assetsDir: 'static',
sourcemap: true
} }
}) })