if (to.meta.requireAuth) { // 判断该路由是否需要登录权限
debugger
if (window.sessionStorage.getItem("sid")) {
let roleMenuList = store.state.role.roleMenuList; // 接口返回可以访问的菜单,存储在vuex中
console.log(roleMenuList)
if(roleMenuList.length !=0){
let isMenu = deepQuery(roleMenuList,to.name);
if (isMenu) {// 若存在,继续访问
next();
} else {
next({ path: '/home'})
}
}
else{
next({ path: '/home'}) // 将跳转的路由path作为参数,登录成功后跳转到该路由
}
}
else {
next({ path: '/login'})
}
}else{
next();
}