|
|
|
@ -30,11 +30,11 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
|
|
|
|
}) |
|
|
|
|
}).catch(err => { |
|
|
|
|
store.dispatch('LogOut').then(() => { |
|
|
|
|
Message.error(err) |
|
|
|
|
next({ path: '/' }) |
|
|
|
|
}) |
|
|
|
|
store.dispatch('LogOut').then(() => { |
|
|
|
|
Message.error(err) |
|
|
|
|
next({ path: '/' }) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
next() |
|
|
|
|
} |
|
|
|
@ -45,7 +45,11 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
// 在免登录白名单,直接进入
|
|
|
|
|
next() |
|
|
|
|
} else { |
|
|
|
|
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
|
|
|
|
localStorage.setItem("intendedRoute", to.fullPath); |
|
|
|
|
next({ |
|
|
|
|
path: '/login', |
|
|
|
|
query: { redirect: to.fullPath } |
|
|
|
|
}) // 否则全部重定向到登录页
|
|
|
|
|
NProgress.done() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|