登录成功后,进入登录页自动跳转首页,加入多点管理

This commit is contained in:
zoujiandong
2023-07-17 14:43:35 +08:00
parent e9c038d4ed
commit 23c4fe9f9e
11 changed files with 940 additions and 35 deletions
+5 -2
View File
@@ -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();
}