Parcourir la source

Update index.js

jtoms il y a 4 ans
Parent
commit
599332437b
1 fichiers modifiés avec 37 ajouts et 32 suppressions
  1. 37 32
      src/router/index.js

+ 37 - 32
src/router/index.js

@@ -30,31 +30,6 @@ import Layout from '@/layout'
  * a base page that does not have permission requirements
  * all roles can be accessed
  */
-export const constantRoutes = [
-  {
-    path: '/login',
-    component: () => import('@/views/login/index'),
-    hidden: true
-  },
-  {
-    path: '/404',
-    component: () => import('@/views/404'),
-    hidden: true
-  },
-  {
-    path: '/',
-    component: Layout,
-    redirect: '/dashboard',
-    children: [
-      {
-        path: 'dashboard',
-        component: () => import('@/views/dashboard/index'),
-        name: 'Dashboard',
-        meta: { title: '首页', icon: 'dashboard', affix: true }
-      }
-    ]
-  }
-]
 
 export const asyncRoutes = [
   {
@@ -82,31 +57,35 @@ export const asyncRoutes = [
     path: '/user',
     component: Layout,
     name: 'User',
-    meta: { title: '用户', icon: 'el-icon-user' },
+    meta: {
+      title: '用户',
+      icon: 'el-icon-user',
+      authorities: ['oauth.user.find', 'oauth.role.find', 'oauth.role.find', 'oauth.user.find.operate.log', 'oauth.user.find.login.log']
+    },
     children: [
       {
         path: 'info',
         name: 'UserInfo',
         component: () => import('@/views/user/info'),
-        meta: { title: '用户管理' }
+        meta: { title: '用户管理', authorities: ['oauth.user.find'] }
       },
       {
         path: 'role',
         name: 'UserRole',
         component: () => import('@/views/user/role'),
-        meta: { title: '角色管理' }
+        meta: { title: '角色管理', authorities: ['oauth.role.find'] }
       },
       {
         path: 'operateLog',
         name: 'UserOperateLog',
         component: () => import('@/views/user/operateLog'),
-        meta: { title: '操作日志' }
+        meta: { title: '操作日志', authorities: ['oauth.user.find.operate.log'] }
       },
       {
         path: 'loginLog',
         name: 'UserLoginLog',
         component: () => import('@/views/user/loginLog'),
-        meta: { title: '登录日志' }
+        meta: { title: '登录日志', authorities: ['oauth.user.find.login.log'] }
       }
     ]
   },
@@ -114,13 +93,13 @@ export const asyncRoutes = [
     path: '/setting',
     component: Layout,
     name: 'Setting',
-    meta: { title: '设置', icon: 'el-icon-setting' },
+    meta: { title: '设置', icon: 'el-icon-setting', authorities: ['system.config.find'] },
     children: [
       {
         path: 'sysconfig',
         name: 'SettingSysconfig',
         component: () => import('@/views/form/index'),
-        meta: { title: '系统设置' }
+        meta: { title: '系统设置', authorities: ['system.config.find'] }
       }
     ]
   },
@@ -128,6 +107,32 @@ export const asyncRoutes = [
   { path: '*', redirect: '/404', hidden: true }
 ]
 
+export const constantRoutes = [
+  {
+    path: '/login',
+    component: () => import('@/views/login/index'),
+    hidden: true
+  },
+  {
+    path: '/404',
+    component: () => import('@/views/404'),
+    hidden: true
+  },
+  {
+    path: '/',
+    component: Layout,
+    redirect: '/dashboard',
+    children: [
+      {
+        path: 'dashboard',
+        component: () => import('@/views/dashboard/index'),
+        name: 'Dashboard',
+        meta: { title: '首页', icon: 'dashboard', affix: true }
+      }
+    ]
+  }
+]
+
 const createRouter = () => new Router({
   mode: 'history', // require service support
   scrollBehavior: () => ({ y: 0 }),