|
@@ -22,29 +22,29 @@ router.beforeEach((to, from, next) => {
|
|
|
// 判断当前用户是否已拉取完user_info信息
|
|
|
store.dispatch('GetInfo').then(() => {
|
|
|
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
|
|
- console.log('to',to);
|
|
|
+ console.log('to', to)
|
|
|
// 根据roles权限生成可访问的路由表
|
|
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
|
|
})
|
|
|
}).catch(err => {
|
|
|
- store.dispatch('LogOut').then(() => {
|
|
|
- Message.error(err)
|
|
|
- })
|
|
|
+ store.dispatch('LogOut').then(() => {
|
|
|
+ Message.error(err)
|
|
|
})
|
|
|
+ })
|
|
|
} else {
|
|
|
next()
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if(to.path == '/codeHtml' || to.path === '/bigDataLogin'){
|
|
|
+ if (to.path == '/codeHtml' || to.path === '/bigDataLogin') {
|
|
|
next()
|
|
|
return
|
|
|
}
|
|
|
// 没有token
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
// 在免登录白名单,直接进入
|
|
|
- console.log('在免登录白名单');
|
|
|
+ console.log('在免登录白名单')
|
|
|
next()
|
|
|
} else {
|
|
|
console.log('没啦没啦')
|