From 5186227a467bd34dc253e64b23bc96d3a07bb399 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 17 十一月 2021 17:39:53 +0800
Subject: [PATCH] 添加用户权限控制

---
 src/router/index.js |   91 ++++++++++++++++++++++++++++-----------------
 1 files changed, 56 insertions(+), 35 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index bac4ddc..e8786b8 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,42 +1,42 @@
-import Vue from 'vue'
-import VueRouter from 'vue-router'
-import Layout from '@/layouts'
-import { publicPath, routerMode } from '@/config'
+import Vue from "vue";
+import VueRouter from "vue-router";
+import Layout from "@/layouts";
+import { publicPath, routerMode } from "@/config";
 
-Vue.use(VueRouter)
+Vue.use(VueRouter);
 export const constantRoutes = [
   {
-    path: '/login',
-    component: () => import('@/views/login/index'),
+    path: "/login",
+    component: () => import("@/views/login/index"),
     hidden: true,
   },
   {
-    path: '/401',
-    name: '401',
-    component: () => import('@/views/401'),
+    path: "/401",
+    name: "401",
+    component: () => import("@/views/401"),
     hidden: true,
   },
   {
-    path: '/404',
-    name: '404',
-    component: () => import('@/views/404'),
+    path: "/404",
+    name: "404",
+    component: () => import("@/views/404"),
     hidden: true,
   },
-]
+];
 
 export const asyncRoutes = [
   {
-    path: '/',
+    path: "/",
     component: Layout,
-    redirect: '/index',
+    redirect: "/index",
     children: [
       {
-        path: 'index',
-        name: 'Index',
-        component: () => import('@/views/index/index'),
+        path: "index",
+        name: "Index",
+        component: () => import("@/views/index/index"),
         meta: {
-          title: '棣栭〉',
-          icon: 'home',
+          title: "棣栭〉",
+          icon: "home",
           affix: true,
         },
       },
@@ -44,31 +44,52 @@
   },
 
   {
-    path: '/project',
+    path: "/project",
     component: Layout,
-    redirect: 'project',
+    redirect: "project",
     // name: 'Vab',
     // alwaysShow: true,
     children: [
       {
-        path: 'index',
-        component: () => import('@/views/project/index'),
-        name: 'Project',
+        path: "index",
+        component: () => import("@/views/project/index"),
+        name: "Project",
         meta: {
-          title: '椤圭洰',
-          icon: 'box-open',
-          permissions: ['admin'],
+          title: "椤圭洰",
+          icon: "box-open",
+          affix: true,
         },
       },
     ],
   },
 
   {
-    path: '*',
-    redirect: '/404',
+    path: "/user",
+    component: Layout,
+    redirect: "user",
+    // name: 'Vab',
+    // alwaysShow: true,
+    children: [
+      {
+        path: "index",
+        component: () => import("@/views/user/index"),
+        name: "User",
+        meta: {
+          title: "鐢ㄦ埛",
+          icon: "user",
+          permissions: ["admin"],
+        },
+      },
+    ],
+    meta: { permissions: ["admin"] },
+  },
+
+  {
+    path: "*",
+    redirect: "/404",
     hidden: true,
   },
-]
+];
 
 const router = new VueRouter({
   base: publicPath,
@@ -77,10 +98,10 @@
     y: 0,
   }),
   routes: constantRoutes,
-})
+});
 
 export function resetRouter() {
-  location.reload()
+  location.reload();
 }
 
-export default router
+export default router;

--
Gitblit v1.8.0