index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '../views/layout/Layout'
  6. /**
  7. * hidden: true if `hidden:true` will not show in the sidebar(default is false)
  8. * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
  9. * if not set alwaysShow, only more than one route under the children
  10. * it will becomes nested mode, otherwise not show the root menu
  11. * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
  12. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  13. * meta : {
  14. title: 'title' the name show in submenu and breadcrumb (recommend set)
  15. icon: 'svg-name' the icon show in the sidebar,
  16. }
  17. **/
  18. export const constantRouterMap = [
  19. {path: '/login', component: () => import('@/views/login/index'), hidden: true},
  20. {path: '/404', component: () => import('@/views/404'), hidden: true},
  21. {
  22. path: '',
  23. component: Layout,
  24. redirect: '/home',
  25. meta: {title: '首页', icon: 'home'},
  26. children: [{
  27. path: 'home',
  28. name: 'home',
  29. component: () => import('@/views/home/index'),
  30. meta: {title: '仪表盘', icon: 'dashboard'}
  31. },
  32. {
  33. name: 'document',
  34. path: 'https://www.macrozheng.com',
  35. meta: {title: '学习教程', icon: 'document'}
  36. },
  37. {
  38. name: 'video',
  39. path: 'https://www.macrozheng.com/mall/catalog/mall_video.html',
  40. meta: {title: '视频教程', icon: 'video'}
  41. },
  42. ]
  43. }
  44. ]
  45. export const asyncRouterMap = [
  46. {
  47. path: '/pms',
  48. component: Layout,
  49. redirect: '/pms/product',
  50. name: 'pms',
  51. meta: {title: '商品', icon: 'product'},
  52. children: [{
  53. path: 'product',
  54. name: 'product',
  55. component: () => import('@/views/pms/product/index'),
  56. meta: {title: '商品列表', icon: 'product-list'}
  57. },
  58. {
  59. path: 'addProduct',
  60. name: 'addProduct',
  61. component: () => import('@/views/pms/product/add'),
  62. meta: {title: '添加商品', icon: 'product-add'}
  63. },
  64. {
  65. path: 'updateProduct',
  66. name: 'updateProduct',
  67. component: () => import('@/views/pms/product/update'),
  68. meta: {title: '修改商品', icon: 'product-add'},
  69. hidden: true
  70. },
  71. {
  72. path: 'productCate',
  73. name: 'productCate',
  74. component: () => import('@/views/pms/productCate/index'),
  75. meta: {title: '商品分类', icon: 'product-cate'}
  76. },
  77. {
  78. path: 'addProductCate',
  79. name: 'addProductCate',
  80. component: () => import('@/views/pms/productCate/add'),
  81. meta: {title: '添加商品分类'},
  82. hidden: true
  83. },
  84. {
  85. path: 'updateProductCate',
  86. name: 'updateProductCate',
  87. component: () => import('@/views/pms/productCate/update'),
  88. meta: {title: '修改商品分类'},
  89. hidden: true
  90. },
  91. {
  92. path: 'productAttr',
  93. name: 'productAttr',
  94. component: () => import('@/views/pms/productAttr/index'),
  95. meta: {title: '商品类型', icon: 'product-attr'}
  96. },
  97. {
  98. path: 'productAttrList',
  99. name: 'productAttrList',
  100. component: () => import('@/views/pms/productAttr/productAttrList'),
  101. meta: {title: '商品属性列表'},
  102. hidden: true
  103. },
  104. {
  105. path: 'addProductAttr',
  106. name: 'addProductAttr',
  107. component: () => import('@/views/pms/productAttr/addProductAttr'),
  108. meta: {title: '添加商品属性'},
  109. hidden: true
  110. },
  111. {
  112. path: 'updateProductAttr',
  113. name: 'updateProductAttr',
  114. component: () => import('@/views/pms/productAttr/updateProductAttr'),
  115. meta: {title: '修改商品属性'},
  116. hidden: true
  117. },
  118. {
  119. path: 'brand',
  120. name: 'brand',
  121. component: () => import('@/views/pms/brand/index'),
  122. meta: {title: '品牌管理', icon: 'product-brand'}
  123. },
  124. {
  125. path: 'addBrand',
  126. name: 'addBrand',
  127. component: () => import('@/views/pms/brand/add'),
  128. meta: {title: '添加品牌'},
  129. hidden: true
  130. },
  131. {
  132. path: 'updateBrand',
  133. name: 'updateBrand',
  134. component: () => import('@/views/pms/brand/update'),
  135. meta: {title: '编辑品牌'},
  136. hidden: true
  137. }
  138. ]
  139. },
  140. {
  141. path: '/oms',
  142. component: Layout,
  143. redirect: '/oms/order',
  144. name: 'oms',
  145. meta: {title: '订单', icon: 'order'},
  146. children: [
  147. {
  148. path: 'order',
  149. name: 'order',
  150. component: () => import('@/views/oms/order/index'),
  151. meta: {title: '订单列表', icon: 'product-list'}
  152. },
  153. {
  154. path: 'orderDetail',
  155. name: 'orderDetail',
  156. component: () => import('@/views/oms/order/orderDetail'),
  157. meta: {title: '订单详情'},
  158. hidden:true
  159. },
  160. {
  161. path: 'deliverOrderList',
  162. name: 'deliverOrderList',
  163. component: () => import('@/views/oms/order/deliverOrderList'),
  164. meta: {title: '发货列表'},
  165. hidden:true
  166. },
  167. {
  168. path: 'orderSetting',
  169. name: 'orderSetting',
  170. component: () => import('@/views/oms/order/setting'),
  171. meta: {title: '订单设置', icon: 'order-setting'}
  172. },
  173. {
  174. path: 'returnApply',
  175. name: 'returnApply',
  176. component: () => import('@/views/oms/apply/index'),
  177. meta: {title: '退货申请处理', icon: 'order-return'}
  178. },
  179. {
  180. path: 'returnReason',
  181. name: 'returnReason',
  182. component: () => import('@/views/oms/apply/reason'),
  183. meta: {title: '退货原因设置', icon: 'order-return-reason'}
  184. },
  185. {
  186. path: 'returnApplyDetail',
  187. name: 'returnApplyDetail',
  188. component: () => import('@/views/oms/apply/applyDetail'),
  189. meta: {title: '退货原因详情'},
  190. hidden:true
  191. }
  192. ]
  193. },
  194. {
  195. path:'/sms',
  196. component: Layout,
  197. redirect: '/sms/coupon',
  198. name: 'sms',
  199. meta: {title: '营销', icon: 'sms'},
  200. children: [
  201. {
  202. path: 'flash',
  203. name: 'flash',
  204. component: () => import('@/views/sms/flash/index'),
  205. meta: {title: '秒杀活动列表', icon: 'sms-flash'}
  206. },
  207. {
  208. path: 'flashSession',
  209. name: 'flashSession',
  210. component: () => import('@/views/sms/flash/sessionList'),
  211. meta: {title: '秒杀时间段列表'},
  212. hidden:true
  213. },
  214. {
  215. path: 'selectSession',
  216. name: 'selectSession',
  217. component: () => import('@/views/sms/flash/selectSessionList'),
  218. meta: {title: '秒杀时间段选择'},
  219. hidden:true
  220. },
  221. {
  222. path: 'flashProductRelation',
  223. name: 'flashProductRelation',
  224. component: () => import('@/views/sms/flash/productRelationList'),
  225. meta: {title: '秒杀商品列表'},
  226. hidden:true
  227. },
  228. {
  229. path: 'coupon',
  230. name: 'coupon',
  231. component: () => import('@/views/sms/coupon/index'),
  232. meta: {title: '优惠券列表', icon: 'sms-coupon'}
  233. },
  234. {
  235. path: 'addCoupon',
  236. name: 'addCoupon',
  237. component: () => import('@/views/sms/coupon/add'),
  238. meta: {title: '添加优惠券'},
  239. hidden:true
  240. },
  241. {
  242. path: 'updateCoupon',
  243. name: 'updateCoupon',
  244. component: () => import('@/views/sms/coupon/update'),
  245. meta: {title: '修改优惠券'},
  246. hidden:true
  247. },
  248. {
  249. path: 'couponHistory',
  250. name: 'couponHistory',
  251. component: () => import('@/views/sms/coupon/history'),
  252. meta: {title: '优惠券领取详情'},
  253. hidden:true
  254. },
  255. {
  256. path: 'brand',
  257. name: 'homeBrand',
  258. component: () => import('@/views/sms/brand/index'),
  259. meta: {title: '品牌推荐', icon: 'product-brand'}
  260. },
  261. {
  262. path: 'new',
  263. name: 'homeNew',
  264. component: () => import('@/views/sms/new/index'),
  265. meta: {title: '新品推荐', icon: 'sms-new'}
  266. },
  267. {
  268. path: 'hot',
  269. name: 'homeHot',
  270. component: () => import('@/views/sms/hot/index'),
  271. meta: {title: '人气推荐', icon: 'sms-hot'}
  272. },
  273. {
  274. path: 'subject',
  275. name: 'homeSubject',
  276. component: () => import('@/views/sms/subject/index'),
  277. meta: {title: '专题推荐', icon: 'sms-subject'}
  278. },
  279. {
  280. path: 'advertise',
  281. name: 'homeAdvertise',
  282. component: () => import('@/views/sms/advertise/index'),
  283. meta: {title: '广告列表', icon: 'sms-ad'}
  284. },
  285. {
  286. path: 'addAdvertise',
  287. name: 'addHomeAdvertise',
  288. component: () => import('@/views/sms/advertise/add'),
  289. meta: {title: '添加广告'},
  290. hidden:true
  291. },
  292. {
  293. path: 'updateAdvertise',
  294. name: 'updateHomeAdvertise',
  295. component: () => import('@/views/sms/advertise/update'),
  296. meta: {title: '编辑广告'},
  297. hidden:true
  298. }
  299. ]
  300. },
  301. {
  302. path:'/ums',
  303. component: Layout,
  304. redirect: '/ums/admin',
  305. name: 'ums',
  306. meta: {title: '权限', icon: 'ums'},
  307. children: [
  308. {
  309. path: 'admin',
  310. name: 'admin',
  311. component: () => import('@/views/ums/admin/index'),
  312. meta: {title: '用户列表', icon: 'ums-admin'}
  313. },
  314. {
  315. path: 'role',
  316. name: 'role',
  317. component: () => import('@/views/ums/role/index'),
  318. meta: {title: '角色列表', icon: 'ums-role'}
  319. },
  320. {
  321. path: 'allocMenu',
  322. name: 'allocMenu',
  323. component: () => import('@/views/ums/role/allocMenu'),
  324. meta: {title: '分配菜单'},
  325. hidden: true
  326. },
  327. {
  328. path: 'allocResource',
  329. name: 'allocResource',
  330. component: () => import('@/views/ums/role/allocResource'),
  331. meta: {title: '分配资源'},
  332. hidden: true
  333. },
  334. {
  335. path: 'menu',
  336. name: 'menu',
  337. component: () => import('@/views/ums/menu/index'),
  338. meta: {title: '菜单列表', icon: 'ums-menu'}
  339. },
  340. {
  341. path: 'addMenu',
  342. name: 'addMenu',
  343. component: () => import('@/views/ums/menu/add'),
  344. meta: {title: '添加菜单'},
  345. hidden: true
  346. },
  347. {
  348. path: 'updateMenu',
  349. name: 'updateMenu',
  350. component: () => import('@/views/ums/menu/update'),
  351. meta: {title: '修改菜单'},
  352. hidden: true
  353. },
  354. {
  355. path: 'resource',
  356. name: 'resource',
  357. component: () => import('@/views/ums/resource/index'),
  358. meta: {title: '资源列表', icon: 'ums-resource'}
  359. },
  360. {
  361. path: 'resourceCategory',
  362. name: 'resourceCategory',
  363. component: () => import('@/views/ums/resource/categoryList'),
  364. meta: {title: '资源分类'},
  365. hidden: true
  366. }
  367. ]
  368. },
  369. {path: '*', redirect: '/404', hidden: true}
  370. ]
  371. export default new Router({
  372. // mode: 'history', //后端支持可开
  373. scrollBehavior: () => ({y: 0}),
  374. routes: constantRouterMap
  375. })