梁展鹏 3 år sedan
förälder
incheckning
978422ab33
1 ändrade filer med 197 tillägg och 273 borttagningar
  1. 197 273
      src/router/index.js

+ 197 - 273
src/router/index.js

@@ -60,110 +60,134 @@ export const constantRoutes = [
     ]
   },
 
-  // {
-  //   path: '/statistics',
-  //   component: Layout,
-  //   redirect: '/statistics/DownloadImage',
-  //   name: '数据统计',
-  //   meta: {
-  //     title: '数据统计',
-  //     icon: 'el-icon-s-help'
-  //   },
-  //   children: [
-  //     {
-  //       path: 'DownloadImage',
-  //       name: '下载照片',
-  //       component: () => import('@/views/statistics/downloadImage/index'),
-  //       meta: {
-  //         title: '下载照片'
-  //         // icon: 'table'
-  //       }
-  //     },
-  //     {
-  //       path: 'UploadImage',
-  //       name: '上传照片',
-  //       component: () => import('@/views/statistics/uploadImage/index'),
-  //       meta: {
-  //         title: '上传照片'
-  //         // icon: 'tree'
-  //       }
-  //     },
-  //     {
-  //       path: 'WithdrawalRecord',
-  //       name: '提现记录',
-  //       component: () => import('@/views/statistics/withdrawalRecord/index'),
-  //       meta: {
-  //         title: '提现记录'
-  //         // icon: 'tree'
-  //       }
-  //     }
-  //   ]
-  // },
+  // 404 page must be placed at the end !!!
+  {
+    path: '*',
+    redirect: '/404',
+    hidden: true
+  }
+];
+
+// TODO 上方菜单搬运下方,在meta追加roles
+/**
+ * asyncRoutes
+ * the routes that need to be dynamically loaded based on user roles
+ */
+export const asyncRoutes = [
+  {
+    path: '/statistics',
+    component: Layout,
+    redirect: '/statistics/DownloadImage',
+    name: '数据统计',
+    meta: {
+      title: '数据统计',
+      icon: 'el-icon-s-help',
+      roles: ['admin', 'editor']
+    },
+    children: [
+      {
+        path: 'DownloadImage',
+        name: '下载照片',
+        component: () => import('@/views/statistics/downloadImage/index'),
+        meta: {
+          title: '下载照片',
+          // icon: 'table'
+          roles: ['admin']
+        }
+      },
+      {
+        path: 'UploadImage',
+        name: '上传照片',
+        component: () => import('@/views/statistics/uploadImage/index'),
+        meta: {
+          title: '上传照片',
+          // icon: 'tree'
+          roles: ['admin']
+        }
+      },
+      {
+        path: 'WithdrawalRecord',
+        name: '提现记录',
+        component: () => import('@/views/statistics/withdrawalRecord/index'),
+        meta: {
+          title: '提现记录',
+          // icon: 'tree'
+          roles: ['admin']
+        }
+      }
+    ]
+  },
 
-  // {
-  //   path: '/photographerManagement',
-  //   component: Layout,
-  //   redirect: '/photographerManagement/PhotoVerify',
-  //   name: '摄影师',
-  //   meta: {
-  //     title: '摄影师',
-  //     icon: 'el-icon-s-help'
-  //   },
-  //   children: [
-  //     {
-  //       path: 'PhotoVerify',
-  //       name: '摄影师', // add by 梁展鹏 20210723 因为只有一个菜单,所以暂时把菜单名称写到这里。实际上这里是"照片管理"
-  //       component: () =>
-  //         import('@/views/photographerManagement/photoVerify/index'),
-  //       meta: {
-  //         title: '摄影师'
-  //         // icon: 'tree'
-  //       }
-  //     }
-  //   ]
-  // },
+  {
+    path: '/photographerManagement',
+    component: Layout,
+    redirect: '/photographerManagement/PhotoVerify',
+    name: '摄影师',
+    meta: {
+      title: '摄影师',
+      icon: 'el-icon-s-help',
+      roles: ['admin', 'editor', 'photoer']
+    },
+    children: [
+      {
+        path: 'PhotoVerify',
+        name: '摄影师', // add by 梁展鹏 20210723 因为只有一个菜单,所以暂时把菜单名称写到这里。实际上这里是"照片管理"
+        component: () =>
+        import('@/views/photographerManagement/photoVerify/index'),
+        meta: {
+          title: '摄影师',
+          // icon: 'tree',
+          roles: ['admin']
+        }
+      }
+    ]
+  },
 
-  // {
-  //   path: '/photoManagement',
-  //   component: Layout,
-  //   redirect: '/photoManagement/ImageGoodsManagement',
-  //   name: '图片库管理',
-  //   meta: {
-  //     title: '图片库管理',
-  //     icon: 'el-icon-s-help'
-  //   },
-  //   children: [
-  //     {
-  //       path: 'EventsList',
-  //       name: '活动列表',
-  //       component: () => import('@/views/photoManagement/eventsList/index'),
-  //       meta: {
-  //         title: '活动列表'
-  //         // icon: 'tree'
-  //       }
-  //     },
-  //     {
-  //       path: 'ImageGoodsManagement',
-  //       name: '照片商品管理',
-  //       component: () =>
-  //         import('@/views/photoManagement/imageGoodsManagement/index'),
-  //       meta: {
-  //         title: '照片商品管理'
-  //         // icon: 'table'
-  //       }
-  //     },
-  //     {
-  //       path: 'PhotoVerifyManagement',
-  //       name: '上传照片审核',
-  //       component: () =>
-  //         import('@/views/photoManagement/photoVerifyManagement/index'),
-  //       meta: {
-  //         title: '上传照片审核'
-  //         // icon: 'tree'
-  //       }
-  //     }
-  //   ]
-  // },
+  {
+    path: '/photoManagement',
+    component: Layout,
+    redirect: '/photoManagement/ImageGoodsManagement',
+    name: '图片库管理',
+    meta: {
+      title: '图片库管理',
+      icon: 'el-icon-s-help',
+      roles: ['admin']
+    },
+    children: [
+      {
+        path: 'EventsList',
+        name: '活动列表',
+        component: () => import('@/views/photoManagement/eventsList/index'),
+        meta: {
+          title: '活动列表',
+          // icon: 'tree',
+          roles: ['admin']
+        }
+      },
+      {
+        path: 'ImageGoodsManagement',
+        name: '照片商品管理',
+        component: () =>
+        import('@/views/photoManagement/imageGoodsManagement/index'),
+        meta: {
+          title: '照片商品管理',
+          // icon: 'table',
+          roles: ['admin']
+        }
+      },
+      {
+        path: 'PhotoVerifyManagement',
+        name: '上传照片审核',
+        component: () =>
+        import('@/views/photoManagement/photoVerifyManagement/index'),
+        meta: {
+          title: '上传照片审核',
+          // icon: 'tree',
+          roles: ['admin']
+        }
+      }
+    ]
+  },
 
   {
     path: '/certification-management',
@@ -172,17 +196,19 @@ export const constantRoutes = [
     name: '认证管理',
     meta: {
       title: '认证管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
         path: 'PhotographerVerify',
         name: '摄影师认证审核',
         component: () =>
-          import('@/views/photographerManagement/photographerVerify/index'),
+        import('@/views/photographerManagement/photographerVerify/index'),
         meta: {
-          title: '摄影师认证审核'
-          // icon: 'table'
+          title: '摄影师认证审核',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
@@ -190,8 +216,9 @@ export const constantRoutes = [
         name: '场景审核',
         component: () => import('@/views/sceneManagement/sceneVerify/index'),
         meta: {
-          title: '场景审核'
-          // icon: 'tree'
+          title: '场景审核',
+          // icon: 'tree',
+          roles: ['admin']
         }
       },
       {
@@ -199,8 +226,9 @@ export const constantRoutes = [
         name: '场景列表',
         component: () => import('@/views/sceneManagement/sceneList/index'),
         meta: {
-          title: '场景列表'
-          // icon: 'table'
+          title: '场景列表',
+          // icon: 'table',
+          roles: ['admin']
         }
       }
     ]
@@ -213,7 +241,8 @@ export const constantRoutes = [
     name: '会员管理',
     meta: {
       title: '会员管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
@@ -221,8 +250,9 @@ export const constantRoutes = [
         name: '会员等级',
         component: () => import('@/views/memberManagement/memberLever/index'),
         meta: {
-          title: '会员等级'
-          // icon: 'table'
+          title: '会员等级',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
@@ -230,8 +260,9 @@ export const constantRoutes = [
         name: '会员列表',
         component: () => import('@/views/memberManagement/memberList/index'),
         meta: {
-          title: '会员列表'
-          // icon: 'tree'
+          title: '会员列表',
+          // icon: 'tree',
+          roles: ['admin']
         }
       }
     ]
@@ -244,17 +275,19 @@ export const constantRoutes = [
     name: '财务管理',
     meta: {
       title: '财务管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
         path: 'OrderManagement',
         name: '订单列表',
         component: () =>
-          import('@/views/financialManagement/orderManagement/index'),
+        import('@/views/financialManagement/orderManagement/index'),
         meta: {
-          title: '订单列表'
-          // icon: 'table'
+          title: '订单列表',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
@@ -262,8 +295,9 @@ export const constantRoutes = [
         name: '用户资金明细',
         component: () => import('@/views/financialManagement/cashDetail/index'),
         meta: {
-          title: '用户资金明细'
-          // icon: 'tree'
+          title: '用户资金明细',
+          // icon: 'tree',
+          roles: ['admin']
         }
       },
       {
@@ -271,8 +305,9 @@ export const constantRoutes = [
         name: '积分设置',
         component: () => import('@/views/pointsManagement/pointsSetting/index'),
         meta: {
-          title: '积分设置'
-          // icon: 'tree'
+          title: '积分设置',
+          // icon: 'tree',
+          roles: ['admin']
         }
       }
     ]
@@ -285,7 +320,8 @@ export const constantRoutes = [
     name: '积分管理',
     meta: {
       title: '积分管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
@@ -293,8 +329,9 @@ export const constantRoutes = [
         name: '积分明细',
         component: () => import('@/views/pointsManagement/pointsDetail/index'),
         meta: {
-          title: '积分明细'
-          // icon: 'table'
+          title: '积分明细',
+          // icon: 'table',
+          roles: ['admin']
         }
       }
     ]
@@ -307,7 +344,8 @@ export const constantRoutes = [
     name: '基础管理',
     meta: {
       title: '基础管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
@@ -315,18 +353,20 @@ export const constantRoutes = [
         name: '热搜词管理',
         component: () => import('@/views/baseManagement/trending/index'),
         meta: {
-          title: '热搜词管理'
-          // icon: 'tree'
+          title: '热搜词管理',
+          // icon: 'tree',
+          roles: ['admin']
         }
       },
       {
         path: 'BannerManagement',
         name: 'Banner管理',
         component: () =>
-          import('@/views/baseManagement/bannerManagement/index'),
+        import('@/views/baseManagement/bannerManagement/index'),
         meta: {
-          title: 'Banner管理'
-          // icon: 'table'
+          title: 'Banner管理',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
@@ -334,18 +374,20 @@ export const constantRoutes = [
         name: '资讯管理',
         component: () => import('@/views/baseManagement/infoManagement/index'),
         meta: {
-          title: '资讯管理'
-          // icon: 'tree'
+          title: '资讯管理',
+          // icon: 'tree',
+          roles: ['admin']
         }
       },
       {
         path: 'ProblemFeedbackManagement',
         name: '问题管理',
         component: () =>
-          import('@/views/baseManagement/problemFeedbackManagement/index'),
+        import('@/views/baseManagement/problemFeedbackManagement/index'),
         meta: {
-          title: '问题管理'
-          // icon: 'tree'
+          title: '问题管理',
+          // icon: 'tree',
+          roles: ['admin']
         }
       }
     ]
@@ -358,27 +400,30 @@ export const constantRoutes = [
     name: '系统管理',
     meta: {
       title: '系统管理',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
         path: 'AccountManagement',
         name: '账号列表',
         component: () =>
-          import('@/views/systemManagement/accountManagement/index'),
+        import('@/views/systemManagement/accountManagement/index'),
         meta: {
-          title: '账号列表'
-          // icon: 'table'
+          title: '账号列表',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
         path: 'RoleManagement',
         name: '角色列表',
         component: () =>
-          import('@/views/systemManagement/roleManagement/index'),
+        import('@/views/systemManagement/roleManagement/index'),
         meta: {
-          title: '角色列表'
-          // icon: 'tree'
+          title: '角色列表',
+          // icon: 'tree',
+          roles: ['admin']
         }
       }
     ]
@@ -391,7 +436,8 @@ export const constantRoutes = [
     name: '帮助信息',
     meta: {
       title: '帮助信息',
-      icon: 'el-icon-s-help'
+      icon: 'el-icon-s-help',
+      roles: ['admin']
     },
     children: [
       {
@@ -399,8 +445,9 @@ export const constantRoutes = [
         name: '问题分类',
         component: () => import('@/views/helpInfo/issueType/index'),
         meta: {
-          title: '问题分类'
-          // icon: 'table'
+          title: '问题分类',
+          // icon: 'table',
+          roles: ['admin']
         }
       },
       {
@@ -408,132 +455,9 @@ export const constantRoutes = [
         name: '信息内容',
         component: () => import('@/views/helpInfo/information/index'),
         meta: {
-          title: '信息内容'
-          // icon: 'tree'
-        }
-      }
-    ]
-  },
-
-  // 404 page must be placed at the end !!!
-  {
-    path: '*',
-    redirect: '/404',
-    hidden: true
-  }
-];
-
-// TODO 上方菜单搬运下方,在meta追加roles
-/**
- * asyncRoutes
- * the routes that need to be dynamically loaded based on user roles
- */
-export const asyncRoutes = [
-  {
-    path: '/statistics',
-    component: Layout,
-    redirect: '/statistics/DownloadImage',
-    name: '数据统计',
-    meta: {
-      title: '数据统计',
-      icon: 'el-icon-s-help',
-      roles: ['admin', 'editor'] // you can set roles in root nav
-    },
-    children: [
-      {
-        path: 'DownloadImage',
-        name: '下载照片',
-        component: () => import('@/views/statistics/downloadImage/index'),
-        meta: {
-          title: '下载照片',
-          // icon: 'table'
-          roles: ['admin'] // or you can only set roles in sub nav
-        }
-      },
-      {
-        path: 'UploadImage',
-        name: '上传照片',
-        component: () => import('@/views/statistics/uploadImage/index'),
-        meta: {
-          title: '上传照片',
-          // icon: 'tree'
-          roles: ['admin'] // or you can only set roles in sub nav
-        }
-      },
-      {
-        path: 'WithdrawalRecord',
-        name: '提现记录',
-        component: () => import('@/views/statistics/withdrawalRecord/index'),
-        meta: {
-          title: '提现记录'
-          // icon: 'tree'
-        }
-      }
-    ]
-  },
-
-  {
-    path: '/photographerManagement',
-    component: Layout,
-    redirect: '/photographerManagement/PhotoVerify',
-    name: '摄影师',
-    meta: {
-      title: '摄影师',
-      icon: 'el-icon-s-help',
-      roles: ['admin', 'editor', 'photoer'] // you can set roles in root nav
-    },
-    children: [
-      {
-        path: 'PhotoVerify',
-        name: '摄影师', // add by 梁展鹏 20210723 因为只有一个菜单,所以暂时把菜单名称写到这里。实际上这里是"照片管理"
-        component: () =>
-          import('@/views/photographerManagement/photoVerify/index'),
-        meta: {
-          title: '摄影师'
-          // icon: 'tree'
-        }
-      }
-    ]
-  },
-
-  {
-    path: '/photoManagement',
-    component: Layout,
-    redirect: '/photoManagement/ImageGoodsManagement',
-    name: '图片库管理',
-    meta: {
-      title: '图片库管理',
-      icon: 'el-icon-s-help',
-      roles: ['admin'] // you can set roles in root nav
-    },
-    children: [
-      {
-        path: 'EventsList',
-        name: '活动列表',
-        component: () => import('@/views/photoManagement/eventsList/index'),
-        meta: {
-          title: '活动列表'
-          // icon: 'tree'
-        }
-      },
-      {
-        path: 'ImageGoodsManagement',
-        name: '照片商品管理',
-        component: () =>
-          import('@/views/photoManagement/imageGoodsManagement/index'),
-        meta: {
-          title: '照片商品管理'
-          // icon: 'table'
-        }
-      },
-      {
-        path: 'PhotoVerifyManagement',
-        name: '上传照片审核',
-        component: () =>
-          import('@/views/photoManagement/photoVerifyManagement/index'),
-        meta: {
-          title: '上传照片审核'
-          // icon: 'tree'
+          title: '信息内容',
+          // icon: 'tree',
+          roles: ['admin']
         }
       }
     ]