diff --git a/ALOps_sys_fe/alops-ui/src/permission.js b/ALOps_sys_fe/alops-ui/src/permission.js index e0e32981..8dd24576 100644 --- a/ALOps_sys_fe/alops-ui/src/permission.js +++ b/ALOps_sys_fe/alops-ui/src/permission.js @@ -21,12 +21,8 @@ router.beforeEach((to, from, next) => { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/ if (to.path === '/login') { - // 登录后根据角色重定向到不同主页 - if (store.getters.roles && store.getters.roles.includes('admin')) { - next({ path: '/index_admin' }) - } else { - next({ path: '/' }) - } + // 登录后直接重定向到首页 + next({ path: '/' }) NProgress.done() } else if (isWhiteList(to.path)) { next() @@ -37,11 +33,10 @@ router.beforeEach((to, from, next) => { store.dispatch('user/getInfo').then(() => { isRelogin.show = false store.dispatch('permission/GenerateRoutes').then(accessRoutes => { - // 根据roles权限生成可访问的路由表 - router.addRoutes(accessRoutes) // 动态添加可访问路由表 - // 获取角色信息后,判断是跳转到默认路由还是管理员路由 - const redirectPath = store.getters.roles.includes('admin') ? '/index_admin' : to.path - next({ path: redirectPath, replace: true }) // hack方法 确保addRoutes已完成 + // 动态添加可访问路由表 + router.addRoutes(accessRoutes) + // 统一使用目标路径进行跳转 + next({ path: to.path, replace: true }) // hack方法 确保addRoutes已完成 }) }).catch(err => { store.dispatch('user/LogOut').then(() => { @@ -50,16 +45,7 @@ router.beforeEach((to, from, next) => { }) }) } else { - // 如果访问的是根路径,根据角色重定向 - if (to.path === '/') { - if (store.getters.roles.includes('admin')) { - next({ path: '/index_admin', replace: true }) - } else { - next() - } - } else { - next() - } + next() } } } else { diff --git a/ALOps_sys_fe/alops-ui/src/router/index.js b/ALOps_sys_fe/alops-ui/src/router/index.js index 0b076c27..4c2cee88 100644 --- a/ALOps_sys_fe/alops-ui/src/router/index.js +++ b/ALOps_sys_fe/alops-ui/src/router/index.js @@ -30,32 +30,6 @@ import Layout from '@/layout' // 公共路由 export const constantRoutes = [ - { - path: '', - component: Layout, - redirect: 'index', - children: [ - { - path: 'index_admin', - component: () => import('@/views/index'), - name: 'Index', - meta: { title: '首页', icon: 'dashboard', affix: true, roles: ['common'] } - } - ] - }, - // { - // path: '', - // component: Layout, - // redirect: 'index', - // children: [ - // { - // path: 'index_admin', - // component: () => import('@/views/index_1'), - // name: 'IndexAdmin', - // meta: { title: '管理员首页', icon: 'dashboard', affix: true, fullscreen: true } - // } - // ] - // }, { path: '/redirect', component: Layout, @@ -96,7 +70,7 @@ export const constantRoutes = [ path: 'index', component: () => import('@/views/index'), name: 'Index', - meta: { title: '首页', icon: 'dashboard', affix: true, roles: ['common'] } + meta: { title: '首页', icon: 'dashboard' } } ] }, diff --git a/ALOps_sys_fe/alops-ui/src/views/index.vue b/ALOps_sys_fe/alops-ui/src/views/index.vue index a534e48e..b1a2cda1 100644 --- a/ALOps_sys_fe/alops-ui/src/views/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/index.vue @@ -1,546 +1,1898 @@ - - + \ No newline at end of file