登录成功后,进入登录页自动跳转首页,加入多点管理
This commit is contained in:
+5
-2
@@ -75,7 +75,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
// 判断用户Token是否获取
|
||||
if (to.name !== 'login' && !store.token) {
|
||||
next({ name: 'login' });
|
||||
} else {
|
||||
}else {
|
||||
// 判断判断权限有无获取
|
||||
if (store.token && permissionStore.addRouters.length==0) {
|
||||
//store.getUserInfo();
|
||||
@@ -88,7 +88,10 @@ router.beforeEach(async (to, from, next) => {
|
||||
// next(to.fullPath);
|
||||
// 如果 addRoute 并未完成,路由守卫会一层一层的执行执行,直到 addRoute 完成,找到对应的路由
|
||||
next({ ...to, replace: true });
|
||||
} else {
|
||||
}else if(to.name == 'login' && store.token && permissionStore.addRouters.length>0){
|
||||
const menuList= permissionStore.menuList;
|
||||
next({ path: menuList[0].children[0].path });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user