|
|
|
@ -30,10 +30,14 @@ router.beforeEach((to, from, next) => { |
|
|
|
|
store.dispatch('GenerateRoutes').then(accessRoutes => { |
|
|
|
|
// 根据roles权限生成可访问的路由表
|
|
|
|
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
|
|
Cookies.set('roleId',null) |
|
|
|
|
let path = '/' |
|
|
|
|
if (res.user.roles[0].roleId == 128){ |
|
|
|
|
Cookies.set('roleId',res.user.roles[0].roleId) |
|
|
|
|
path = '/analyze' |
|
|
|
|
}else{ |
|
|
|
|
Cookies.set('roleId',null) |
|
|
|
|
path = '/' |
|
|
|
|
} |
|
|
|
|
if (to.path === '/home'){ |
|
|
|
|
next({path,replace:true}) |
|
|
|
|