|
|
|
@ -52,6 +52,24 @@ const initSystemSettings = () => { |
|
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
NProgress.start() |
|
|
|
NProgress.start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否是新会话(浏览器新打开)
|
|
|
|
|
|
|
|
const isNewSession = !sessionStorage.getItem('sessionInitialized') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isNewSession) { |
|
|
|
|
|
|
|
// 新会话:清除所有登录状态,强制跳转到登录页
|
|
|
|
|
|
|
|
sessionStorage.setItem('sessionInitialized', 'true') |
|
|
|
|
|
|
|
store.dispatch('LogOut').then(() => { |
|
|
|
|
|
|
|
if (to.path !== '/login') { |
|
|
|
|
|
|
|
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
NProgress.done() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (getToken()) { |
|
|
|
if (getToken()) { |
|
|
|
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) |
|
|
|
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) |
|
|
|
const isLock = store.getters.isLock |
|
|
|
const isLock = store.getters.isLock |
|
|
|
|