zs 9 months ago
parent
commit
1e29c13e06
2 changed files with 39 additions and 4 deletions
  1. 11 3
      src/components/Breadcrumb/index.vue
  2. 28 1
      src/layout/site.js

+ 11 - 3
src/components/Breadcrumb/index.vue

@@ -10,6 +10,8 @@
 </template>
 
 <script>
+import pathToRegexp from 'path-to-regexp';
+
 export default {
   data() {
     return {
@@ -35,7 +37,7 @@ export default {
       const first = matched[0];
 
       if (!this.isDashboard(first)) {
-        matched = [{ path: '/homeIndex', meta: { title: '系统首页' } }].concat(matched);
+        matched = [{ path: '/homeIndex', redirect: '/homeIndex', meta: { title: '系统首页' } }].concat(matched);
       }
 
       this.levelList = matched.filter((item) => item.meta && item.meta.title && item.meta.breadcrumb !== false);
@@ -45,7 +47,13 @@ export default {
       if (!name) {
         return false;
       }
-      return name.trim() === 'homeIndex';
+      return name.trim().toLocaleLowerCase() === 'HomeIndex'.toLocaleLowerCase();
+    },
+    pathCompile(path) {
+      // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
+      const { params } = this.$route;
+      var toPath = pathToRegexp.compile(path);
+      return toPath(params);
     },
     handleLink(item) {
       const { redirect, path } = item;
@@ -53,7 +61,7 @@ export default {
         this.$router.push(redirect);
         return;
       }
-      this.$router.push(path);
+      this.$router.push(this.pathCompile(path));
     },
   },
 };

+ 28 - 1
src/layout/site.js

@@ -67,7 +67,7 @@ export const admin_style_thr = {
 export const menus = [
   {
     id: 'menus_1',
-    icon: 'el-icon-user',
+    icon: 'el-icon-house',
     name: '系统首页',
     path: '/homeIndex',
     type: '0',
@@ -112,6 +112,33 @@ export const menus = [
       },
     ],
   },
+  {
+    id: 'menus_3',
+    icon: 'el-icon-user',
+    name: '用户管理',
+    type: '1',
+    children: [
+      {
+        id: 'menus_3_1',
+        icon: 'el-icon-user',
+        name: '管理员管理',
+        path: '/users/admin',
+      },
+      {
+        id: 'menus_3_2',
+        icon: 'el-icon-user',
+        name: '客服管理',
+        path: '/users/user',
+      },
+    ],
+  },
+  {
+    id: 'menus_4',
+    icon: 'el-icon-question',
+    name: '题库管理',
+    path: '/question',
+    type: '0',
+  },
 ];
 
 // 是否启用