index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import Vue from 'vue';
  11. import Router from 'vue-router';
  12. Vue.use(Router);
  13. /* Layout */
  14. import Layout from '@/layout';
  15. /* Router Modules */
  16. // import componentsRouter from './modules/components'
  17. import productRouter from './modules/product';
  18. import orderRouter from './modules/order';
  19. import userRouter from './modules/user';
  20. import distributionRouter from './modules/distribution';
  21. import marketingRouter from './modules/marketing';
  22. import financeRouter from './modules/finance';
  23. import operationRouter from './modules/operation';
  24. import merchant from './modules/merchant';
  25. import pagediy from '@/router/modules/pagediy';
  26. import riderRouter from '@/router/modules/rider';
  27. import secondhandRouter from './modules/secondhand';
  28. import expressRouter from './modules/express';
  29. /**
  30. * Note: sub-menu only appear when route children.length >= 1
  31. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  32. *
  33. * hidden: true if set true, item will not show in the sidebar(default is false)
  34. * alwaysShow: true if set true, will always show the root menu
  35. * if not set alwaysShow, when item has more than one children route,
  36. * it will becomes nested mode, otherwise not show the root menu
  37. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  38. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  39. * meta : {
  40. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  41. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  42. icon: 'svg-name' the icon show in the sidebar
  43. noCache: true if set true, the page will no be cached(default is false)
  44. affix: true if set true, the tag will affix in the tags-view
  45. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  46. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  47. }
  48. */
  49. /**
  50. * constantRoutes
  51. * a base page that does not have permission requirements
  52. * all roles can be accessed
  53. *
  54. */
  55. export const constantRoutes = [
  56. // 商品
  57. productRouter,
  58. // 订单
  59. orderRouter,
  60. // 会员
  61. userRouter,
  62. // 分销
  63. distributionRouter,
  64. // 营销
  65. marketingRouter,
  66. // 财务
  67. financeRouter,
  68. // 设置
  69. operationRouter,
  70. //商户管理
  71. merchant,
  72. // 页面diy
  73. pagediy,
  74. // 骑手
  75. riderRouter,
  76. //二手交易
  77. secondhandRouter,
  78. //快递
  79. expressRouter,
  80. {
  81. path: '/404',
  82. component: () => import('@/views/error-page/404'),
  83. hidden: true,
  84. },
  85. {
  86. path: '/page/design/creatDevise/:id?/:type?',
  87. component: () => import('@/views/pagediy/devise/creatDevise'),
  88. hidden: true,
  89. },
  90. {
  91. path: '/redirect',
  92. component: Layout,
  93. hidden: true,
  94. children: [
  95. {
  96. path: '/redirect/:path(.*)',
  97. component: () => import('@/views/redirect/index'),
  98. },
  99. ],
  100. },
  101. {
  102. path: '/login',
  103. component: () => import('@/views/login/index'),
  104. hidden: true,
  105. },
  106. {
  107. path: '/auth-redirect',
  108. component: () => import('@/views/login/auth-redirect'),
  109. hidden: true,
  110. },
  111. {
  112. path: '/401',
  113. component: () => import('@/views/error-page/401'),
  114. hidden: true,
  115. },
  116. // {
  117. // path: '/',
  118. // component: Layout,
  119. // redirect: '/dashboard',
  120. // name: 'Dashboard',
  121. // meta: {
  122. // title: '控制台',
  123. // icon: 'clipboard',
  124. // },
  125. // children: [
  126. // {
  127. // path: '/dashboard',
  128. // component: () => import('@/views/dashboard/index'),
  129. // name: 'DashboardIndex',
  130. // meta: { title: '主页', icon: 'dashboard' },
  131. // },
  132. // ],
  133. // },
  134. {
  135. path: '/',
  136. component: Layout,
  137. redirect: '/dashboard',
  138. children: [
  139. {
  140. path: '/dashboard',
  141. component: () => import('@/views/dashboard/index'),
  142. name: 'Dashboard',
  143. meta: { title: '主页', icon: 'dashboard', isAffix: true },
  144. },
  145. ],
  146. },
  147. {
  148. path: '/setting/uploadPicture',
  149. component: () => import('@/components/base/uploadPicture.vue'),
  150. name: 'uploadPicture',
  151. },
  152. // 404 page must be placed at the end !!!
  153. { path: '*', redirect: '/404', hidden: true },
  154. ];
  155. /**
  156. * asyncRoutes
  157. * the routes that need to be dynamically loaded based on user roles
  158. */
  159. export const asyncRoutes = [];
  160. const createRouter = () =>
  161. new Router({
  162. // mode: 'history', // require service support
  163. mode: 'history',
  164. scrollBehavior: () => ({ y: 0 }),
  165. routes: constantRoutes,
  166. });
  167. const router = createRouter();
  168. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  169. export function resetRouter() {
  170. const newRouter = createRouter();
  171. router.matcher = newRouter.matcher; // reset router
  172. }
  173. export default router;