index.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. /**
  28. * Note: sub-menu only appear when route children.length >= 1
  29. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  30. *
  31. * hidden: true if set true, item will not show in the sidebar(default is false)
  32. * alwaysShow: true if set true, will always show the root menu
  33. * if not set alwaysShow, when item has more than one children route,
  34. * it will becomes nested mode, otherwise not show the root menu
  35. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  36. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  37. * meta : {
  38. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  39. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  40. icon: 'svg-name' the icon show in the sidebar
  41. noCache: true if set true, the page will no be cached(default is false)
  42. affix: true if set true, the tag will affix in the tags-view
  43. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  44. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  45. }
  46. */
  47. /**
  48. * constantRoutes
  49. * a base page that does not have permission requirements
  50. * all roles can be accessed
  51. *
  52. */
  53. export const constantRoutes = [
  54. // 商品
  55. productRouter,
  56. // 订单
  57. orderRouter,
  58. // 会员
  59. userRouter,
  60. // 分销
  61. distributionRouter,
  62. // 营销
  63. marketingRouter,
  64. // 财务
  65. financeRouter,
  66. // 设置
  67. operationRouter,
  68. //商户管理
  69. merchant,
  70. // 页面diy
  71. pagediy,
  72. // 骑手
  73. riderRouter,
  74. {
  75. path: '/404',
  76. component: () => import('@/views/error-page/404'),
  77. hidden: true,
  78. },
  79. {
  80. path: '/page/design/creatDevise/:id?/:type?',
  81. component: () => import('@/views/pagediy/devise/creatDevise'),
  82. hidden: true,
  83. },
  84. {
  85. path: '/redirect',
  86. component: Layout,
  87. hidden: true,
  88. children: [
  89. {
  90. path: '/redirect/:path(.*)',
  91. component: () => import('@/views/redirect/index'),
  92. },
  93. ],
  94. },
  95. {
  96. path: '/login',
  97. component: () => import('@/views/login/index'),
  98. hidden: true,
  99. },
  100. {
  101. path: '/auth-redirect',
  102. component: () => import('@/views/login/auth-redirect'),
  103. hidden: true,
  104. },
  105. {
  106. path: '/401',
  107. component: () => import('@/views/error-page/401'),
  108. hidden: true,
  109. },
  110. // {
  111. // path: '/',
  112. // component: Layout,
  113. // redirect: '/dashboard',
  114. // name: 'Dashboard',
  115. // meta: {
  116. // title: '控制台',
  117. // icon: 'clipboard',
  118. // },
  119. // children: [
  120. // {
  121. // path: '/dashboard',
  122. // component: () => import('@/views/dashboard/index'),
  123. // name: 'DashboardIndex',
  124. // meta: { title: '主页', icon: 'dashboard' },
  125. // },
  126. // ],
  127. // },
  128. {
  129. path: '/',
  130. component: Layout,
  131. redirect: '/dashboard',
  132. children: [
  133. {
  134. path: '/dashboard',
  135. component: () => import('@/views/dashboard/index'),
  136. name: 'Dashboard',
  137. meta: { title: '主页', icon: 'dashboard', isAffix: true },
  138. },
  139. ],
  140. },
  141. {
  142. path: '/setting/uploadPicture',
  143. component: () => import('@/components/base/uploadPicture.vue'),
  144. name: 'uploadPicture',
  145. },
  146. // 404 page must be placed at the end !!!
  147. { path: '*', redirect: '/404', hidden: true },
  148. ];
  149. /**
  150. * asyncRoutes
  151. * the routes that need to be dynamically loaded based on user roles
  152. */
  153. export const asyncRoutes = [];
  154. const createRouter = () =>
  155. new Router({
  156. // mode: 'history', // require service support
  157. mode: 'history',
  158. scrollBehavior: () => ({ y: 0 }),
  159. routes: constantRoutes,
  160. });
  161. const router = createRouter();
  162. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  163. export function resetRouter() {
  164. const newRouter = createRouter();
  165. router.matcher = newRouter.matcher; // reset router
  166. }
  167. export default router;