index.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. Vue.use(Router);
  4. /* Layout */
  5. import Layout from "@/layout";
  6. /**
  7. * Note: sub-menu only appear when route children.length >= 1
  8. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  9. *
  10. * hidden: true if set true, item will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu
  12. * if not set alwaysShow, when item has more than one children route,
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  18. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  19. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  20. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  21. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  22. }
  23. */
  24. /**
  25. * constantRoutes
  26. * a base page that does not have permission requirements
  27. * all roles can be accessed
  28. */
  29. export const constantRoutes = [
  30. {
  31. path: "/login",
  32. component: () => import("@/views/login/index"),
  33. hidden: true,
  34. },
  35. {
  36. path: "/external/open_engin",
  37. name: "open_engin",
  38. component: () => import("@/views/external/open_engin"),
  39. hidden: true,
  40. },
  41. {
  42. path: "/404",
  43. component: () => import("@/views/404"),
  44. hidden: true,
  45. },
  46. {
  47. path: "/return_goods",
  48. component: Layout,
  49. children: [
  50. {
  51. path: "new_apply",
  52. name: "new_apply",
  53. component: () => import("@/views/supply/apply/new_apply"),
  54. meta: { title: "零售退货申请", icon: "" },
  55. },
  56. {
  57. path: "new_engin",
  58. name: "new_apply",
  59. component: () => import("@/views/supply/apply/new_engin"),
  60. meta: { title: "工程退货申请", icon: "" },
  61. },
  62. ],
  63. },
  64. // {
  65. // path: '/goods',
  66. // component: Layout,
  67. // name: 'goods',
  68. // meta: { title: '商品管理', icon: 'el-icon-s-help' },
  69. // children: [
  70. // {
  71. // path: 'goods_index',
  72. // name: 'goods_index',
  73. // component: () => import('@/views/goods/goods_index'),
  74. // meta: { title: '商品列表', icon: 'form' }
  75. // },
  76. // {
  77. // path: 'goods_add',
  78. // name: 'goods_add',
  79. // hidden: true,
  80. // component: () => import('@/views/goods/goods_add'),
  81. // meta: { title: '添加商品', icon: 'form', parent:{ name:'goods_index' }}
  82. // },
  83. // {
  84. // path: 'classify_index',
  85. // name: 'classify',
  86. // component: () => import('@/views/goods/classify_index'),
  87. // meta: { title: '分类管理', icon: 'form' }
  88. // }
  89. // ]
  90. // },
  91. // {
  92. // path: '/order',
  93. // component: Layout,
  94. // name: 'order',
  95. // meta: { title: '订单管理', icon: 'el-icon-s-help' },
  96. // children: [
  97. // {
  98. // path: 'order_list',
  99. // name: 'order_list',
  100. // component: () => import('@/views/order/order_list'),
  101. // meta: { title: '订单列表', icon: 'form'}
  102. // },
  103. // {
  104. // path: 'detail',
  105. // name: 'detail',
  106. // hidden: true,
  107. // component: () => import('@/views/order/detail'),
  108. // meta: { title: '订单详情', parent:{ name:'order_list' } },
  109. // },
  110. // {
  111. // path: 'order_refund',
  112. // name: 'order_refund',
  113. // component: () => import('@/views/order/order_refund'),
  114. // meta: { title: '维权订单', icon: 'form'},
  115. // },
  116. // {
  117. // path: 'order_refund/order_refund_detail',
  118. // name: 'order_refund_detail',
  119. // hidden: true,
  120. // component: () => import('@/views/order/order_refund_detail'),
  121. // meta: { title: '维权详情', parent:{ name:'order_refund' } }
  122. // },
  123. // {
  124. // path: 'invoice',
  125. // name: 'invoice',
  126. // component: () => import('@/views/order/invoice'),
  127. // meta: { title: '开发票', icon: 'form' }
  128. // }
  129. // ]
  130. // },
  131. // {
  132. // path: '/activity',
  133. // component: Layout,
  134. // name: 'activity',
  135. // meta: { title: '活动管理', icon: 'el-icon-s-help' },
  136. // children: [
  137. // {
  138. // path: 'seckill_index',
  139. // name: 'seckill_index',
  140. // component: () => import('@/views/activity/seckill_index'),
  141. // meta: { title: '秒杀活动', icon: 'form' }
  142. // },
  143. // {
  144. // path: 'seckill_add',
  145. // name: 'seckill_add',
  146. // hidden: true,
  147. // component: () => import('@/views/activity/seckill_add'),
  148. // meta: { title: '添加商品', icon: 'form', parent:{ name:'seckill_index' }}
  149. // },
  150. // {
  151. // path: 'coupon_index',
  152. // name: 'coupon',
  153. // component: () => import('@/views/activity/coupon_index'),
  154. // meta: { title: '优惠券设置', icon: 'form' }
  155. // }
  156. // ]
  157. // },
  158. // {
  159. // path: '/member',
  160. // component: Layout,
  161. // name: 'member',
  162. // meta: { title: '会员管理', icon: 'el-icon-s-help' },
  163. // children: [
  164. // {
  165. // path: 'index',
  166. // name: 'index',
  167. // component: () => import('@/views/member/index'),
  168. // meta: { title: '会员管理', icon: 'form' }
  169. // }
  170. // ]
  171. // },
  172. // {
  173. // path: '/settlement',
  174. // component: Layout,
  175. // name: 'settlement',
  176. // meta: { title: '结算管理', icon: 'el-icon-s-help' },
  177. // children: [
  178. // {
  179. // path: 'index',
  180. // name: 'settlement_index',
  181. // component: () => import('@/views/settlement/index'),
  182. // meta: { title: '结算管理', icon: 'form' }
  183. // }
  184. // ]
  185. // },
  186. // {
  187. // path: '/freight',
  188. // component: Layout,
  189. // name: 'freight',
  190. // meta: { title: '配送管理', icon: 'el-icon-s-help' },
  191. // children: [
  192. // {
  193. // path: 'index',
  194. // name: 'freight_index',
  195. // component: () => import('@/views/freight/index'),
  196. // meta: { title: '配送管理', icon: 'form' }
  197. // }
  198. // ]
  199. // },
  200. // {
  201. // path: '/storage',
  202. // component: Layout,
  203. // name: 'storage',
  204. // meta: { title: '仓储管理', icon: 'el-icon-s-help' },
  205. // children: [
  206. // {
  207. // path: 'index',
  208. // name: 'storage_index',
  209. // component: () => import('@/views/storage/index'),
  210. // meta: { title: '仓储管理', icon: 'form' }
  211. // }
  212. // ]
  213. // },
  214. // {
  215. // path: '/notice',
  216. // component: Layout,
  217. // name: 'notice',
  218. // meta: { title: '消息中心', icon: 'el-icon-s-help' },
  219. // children: [
  220. // {
  221. // path: 'index',
  222. // name: 'notice_index',
  223. // component: () => import('@/views/notice/index'),
  224. // meta: { title: '消息列表', icon: 'form' }
  225. // }
  226. // ]
  227. // },
  228. // {
  229. // path: '/setting',
  230. // component: Layout,
  231. // name: 'Setting',
  232. // meta: { title: '系统设置', icon: 'el-icon-s-tools' },
  233. // alwaysShow: true,
  234. // children: [
  235. // {
  236. // path: 'personal',
  237. // name: 'personal',
  238. // component: () => import('@/views/setting/personal'),
  239. // meta: { title: '个人信息', icon: 'table' }
  240. // },
  241. // {
  242. // path: 'account',
  243. // name: 'account',
  244. // component: () => import('@/views/setting/account'),
  245. // meta: { title: '账户管理', icon: 'table' }
  246. // },
  247. // {
  248. // path: 'role',
  249. // name: 'role',
  250. // component: () => import('@/views/setting/role'),
  251. // meta: { title: '权限管理', icon: 'table' }
  252. // },
  253. // {
  254. // path: 'oplog',
  255. // name: 'oplog',
  256. // component: () => import('@/views/setting/oplog'),
  257. // meta: { title: '操作日志', icon: 'table' }
  258. // },
  259. // {
  260. // path: 'banner',
  261. // name: 'banner',
  262. // component: () => import('@/views/setting/banner'),
  263. // meta: { title: '轮播图管理', icon: 'table' }
  264. // }
  265. // ]
  266. // },
  267. // 404 page must be placed at the end !!!
  268. // { path: '*', redirect: '/404', hidden: true }
  269. ];
  270. const createRouter = () =>
  271. new Router({
  272. // mode: 'history', // require service support
  273. scrollBehavior: () => ({ y: 0 }),
  274. routes: constantRoutes,
  275. });
  276. const router = createRouter();
  277. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  278. export function resetRouter() {
  279. const newRouter = createRouter();
  280. router.matcher = newRouter.matcher; // reset router
  281. }
  282. export default router;