用户身份切换

This commit is contained in:
熊丽君
2022-02-25 11:49:49 +08:00
parent d9ed341af9
commit dba078f637
10 changed files with 75 additions and 17 deletions

View File

@ -13,7 +13,7 @@ const whiteList = ['/login', '/auth-redirect', '/bind', '/register'];
router.beforeEach((to, from, next) => {
NProgress.start()
// 跳过登录验证
next();
// next();
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
@ -27,6 +27,7 @@ router.beforeEach((to, from, next) => {
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then((res) => {
store.dispatch('GenerateRoutes',res.data.select_identity).then(accessRoutes => {
// store.dispatch('GenerateRoutes',0).then(accessRoutes => { // 测试
// 根据roles权限生成可访问的路由表
// accessRoutes.forEach(route => {
// if (!isHttp(route.path)) {