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) {
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')

View File

@ -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')

View File

@ -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()
}
// 调用天融信单点退出系统

View File

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