index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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: '/404',
  37. component: () => import('@/views/404'),
  38. hidden: true
  39. },
  40. {
  41. path: '/',
  42. component: Layout,
  43. redirect: '/dashboard',
  44. children: [
  45. {
  46. path: 'dashboard',
  47. name: '主板',
  48. component: () => import('@/views/dashboard/index'),
  49. meta: {
  50. title: '主板',
  51. icon: 'dashboard'
  52. }
  53. }
  54. ]
  55. },
  56. // 404 page must be placed at the end !!!
  57. {
  58. path: '*',
  59. redirect: '/404',
  60. hidden: true
  61. }
  62. ];
  63. // TODO 上方菜单搬运下方,在meta追加roles
  64. /**
  65. * asyncRoutes
  66. * the routes that need to be dynamically loaded based on user roles
  67. */
  68. export const asyncRoutes = [
  69. {
  70. path: '/statistics',
  71. component: Layout,
  72. redirect: '/statistics/DownloadImage',
  73. name: '数据统计',
  74. meta: {
  75. title: '数据统计',
  76. icon: 'el-icon-s-help',
  77. roles: ['admin', 'operate']
  78. },
  79. children: [
  80. {
  81. path: 'DownloadImage',
  82. name: '下载照片',
  83. component: () => import('@/views/statistics/downloadImage/index'),
  84. meta: {
  85. title: '下载照片',
  86. // icon: 'table'
  87. roles: ['admin', 'operate']
  88. }
  89. },
  90. {
  91. path: 'UploadImage',
  92. name: '上传照片',
  93. component: () => import('@/views/statistics/uploadImage/index'),
  94. meta: {
  95. title: '上传照片',
  96. // icon: 'tree'
  97. roles: ['admin', 'operate']
  98. }
  99. },
  100. {
  101. path: 'WithdrawalRecord',
  102. name: '提现记录',
  103. component: () => import('@/views/statistics/withdrawalRecord/index'),
  104. meta: {
  105. title: '提现记录',
  106. // icon: 'tree'
  107. roles: ['admin', 'operate']
  108. }
  109. }
  110. ]
  111. },
  112. {
  113. path: '/photographerManagement',
  114. component: Layout,
  115. redirect: '/photographerManagement/PhotoVerify',
  116. name: '摄影师',
  117. meta: {
  118. title: '摄影师',
  119. icon: 'el-icon-s-help',
  120. roles: ['admin', 'photoer', 'photoer_management']
  121. },
  122. children: [
  123. {
  124. path: 'PhotoVerify',
  125. name: '摄影师', // add by 梁展鹏 20210723 因为只有一个菜单,所以暂时把菜单名称写到这里。实际上这里是"照片管理"
  126. component: () =>
  127. import('@/views/photographerManagement/photoVerify/index'),
  128. meta: {
  129. title: '摄影师',
  130. // icon: 'tree',
  131. roles: ['admin', 'photoer', 'photoer_management']
  132. }
  133. }
  134. ]
  135. },
  136. {
  137. path: '/photoManagement',
  138. component: Layout,
  139. redirect: '/photoManagement/ImageGoodsManagement',
  140. name: '图片库管理',
  141. meta: {
  142. title: '图片库管理',
  143. icon: 'el-icon-s-help',
  144. roles: ['admin', 'photo_management', 'photoer_management']
  145. },
  146. children: [
  147. {
  148. path: 'EventsList',
  149. name: '活动列表',
  150. component: () => import('@/views/photoManagement/eventsList/index'),
  151. meta: {
  152. title: '活动列表',
  153. // icon: 'tree',
  154. roles: ['admin', 'photoer_management']
  155. }
  156. },
  157. {
  158. path: 'ImageGoodsManagement',
  159. name: '照片商品管理',
  160. component: () =>
  161. import('@/views/photoManagement/imageGoodsManagement/index'),
  162. meta: {
  163. title: '照片商品管理',
  164. // icon: 'table',
  165. roles: ['admin', 'photo_management']
  166. }
  167. },
  168. {
  169. path: 'PhotoVerifyManagement',
  170. name: '上传照片审核',
  171. component: () =>
  172. import('@/views/photoManagement/photoVerifyManagement/index'),
  173. meta: {
  174. title: '上传照片审核',
  175. // icon: 'tree',
  176. roles: ['admin', 'photoer_management']
  177. }
  178. }
  179. ]
  180. },
  181. {
  182. path: '/certification-management',
  183. component: Layout,
  184. redirect: '/certification-management/PhotographerVerify',
  185. name: '认证管理',
  186. meta: {
  187. title: '认证管理',
  188. icon: 'el-icon-s-help',
  189. roles: ['admin', 'photoer_management', 'business']
  190. },
  191. children: [
  192. {
  193. path: 'PhotographerVerify',
  194. name: '摄影师认证审核',
  195. component: () =>
  196. import('@/views/photographerManagement/photographerVerify/index'),
  197. meta: {
  198. title: '摄影师认证审核',
  199. // icon: 'table',
  200. roles: ['admin', 'photoer_management']
  201. }
  202. },
  203. {
  204. path: 'SceneVerify',
  205. name: '场景审核',
  206. component: () => import('@/views/sceneManagement/sceneVerify/index'),
  207. meta: {
  208. title: '场景审核',
  209. // icon: 'tree',
  210. roles: ['admin', 'business']
  211. }
  212. },
  213. {
  214. path: 'SceneList',
  215. name: '场景列表',
  216. component: () => import('@/views/sceneManagement/sceneList/index'),
  217. meta: {
  218. title: '场景列表',
  219. // icon: 'table',
  220. roles: ['admin', 'business']
  221. }
  222. }
  223. ]
  224. },
  225. {
  226. path: '/memberManagement',
  227. component: Layout,
  228. redirect: '/memberManagement/MemberLever',
  229. name: '会员管理',
  230. meta: {
  231. title: '会员管理',
  232. icon: 'el-icon-s-help',
  233. roles: ['admin', 'operate']
  234. },
  235. children: [
  236. {
  237. path: 'MemberLever',
  238. name: '会员等级',
  239. component: () => import('@/views/memberManagement/memberLever/index'),
  240. meta: {
  241. title: '会员等级',
  242. // icon: 'table',
  243. roles: ['admin', 'operate']
  244. }
  245. },
  246. {
  247. path: 'MemberList',
  248. name: '会员列表',
  249. component: () => import('@/views/memberManagement/memberList/index'),
  250. meta: {
  251. title: '会员列表',
  252. // icon: 'tree',
  253. roles: ['admin', 'operate']
  254. }
  255. }
  256. ]
  257. },
  258. {
  259. path: '/financialManagement',
  260. component: Layout,
  261. redirect: '/financialManagement/OrderManagement',
  262. name: '财务管理',
  263. meta: {
  264. title: '财务管理',
  265. icon: 'el-icon-s-help',
  266. roles: ['admin', 'finance']
  267. },
  268. children: [
  269. {
  270. path: 'OrderManagement',
  271. name: '订单列表',
  272. component: () =>
  273. import('@/views/financialManagement/orderManagement/index'),
  274. meta: {
  275. title: '订单列表',
  276. // icon: 'table',
  277. roles: ['admin', 'finance']
  278. }
  279. },
  280. {
  281. path: 'CashDetail',
  282. name: '用户资金明细',
  283. component: () => import('@/views/financialManagement/cashDetail/index'),
  284. meta: {
  285. title: '用户资金明细',
  286. // icon: 'tree',
  287. roles: ['admin', 'finance']
  288. }
  289. },
  290. {
  291. path: 'PointsSetting',
  292. name: '积分设置',
  293. component: () => import('@/views/pointsManagement/pointsSetting/index'),
  294. meta: {
  295. title: '积分设置',
  296. // icon: 'tree',
  297. roles: ['admin', 'finance']
  298. }
  299. }
  300. ]
  301. },
  302. {
  303. path: '/pointsManagement',
  304. component: Layout,
  305. redirect: '/pointsManagement/PointsDetail',
  306. name: '积分管理',
  307. meta: {
  308. title: '积分管理',
  309. icon: 'el-icon-s-help',
  310. roles: ['admin']
  311. },
  312. children: [
  313. {
  314. path: 'PointsDetail',
  315. name: '积分明细',
  316. component: () => import('@/views/pointsManagement/pointsDetail/index'),
  317. meta: {
  318. title: '积分明细',
  319. // icon: 'table',
  320. roles: ['admin']
  321. }
  322. }
  323. ]
  324. },
  325. {
  326. path: '/baseManagement',
  327. component: Layout,
  328. redirect: '/baseManagement/BannerManagement',
  329. name: '基础管理',
  330. meta: {
  331. title: '基础管理',
  332. icon: 'el-icon-s-help',
  333. roles: ['admin', 'operate', 'designer']
  334. },
  335. children: [
  336. {
  337. path: 'TrendManagement',
  338. name: '热搜词管理',
  339. component: () => import('@/views/baseManagement/trending/index'),
  340. meta: {
  341. title: '热搜词管理',
  342. // icon: 'tree',
  343. roles: ['admin', 'operate']
  344. }
  345. },
  346. {
  347. path: 'BannerManagement',
  348. name: 'Banner管理',
  349. component: () =>
  350. import('@/views/baseManagement/bannerManagement/index'),
  351. meta: {
  352. title: 'Banner管理',
  353. // icon: 'table',
  354. roles: ['admin', 'designer']
  355. }
  356. },
  357. {
  358. path: 'InfoManagement',
  359. name: '资讯管理',
  360. component: () => import('@/views/baseManagement/infoManagement/index'),
  361. meta: {
  362. title: '资讯管理',
  363. // icon: 'tree',
  364. roles: ['admin', 'operate']
  365. }
  366. },
  367. {
  368. path: 'ProblemFeedbackManagement',
  369. name: '问题管理',
  370. component: () =>
  371. import('@/views/baseManagement/problemFeedbackManagement/index'),
  372. meta: {
  373. title: '问题管理',
  374. // icon: 'tree',
  375. roles: ['admin', 'operate']
  376. }
  377. }
  378. ]
  379. },
  380. {
  381. path: '/systemManagement',
  382. component: Layout,
  383. redirect: '/systemManagement/AccountManagement',
  384. name: '系统管理',
  385. meta: {
  386. title: '系统管理',
  387. icon: 'el-icon-s-help',
  388. roles: ['admin']
  389. },
  390. children: [
  391. {
  392. path: 'AccountManagement',
  393. name: '账号列表',
  394. component: () =>
  395. import('@/views/systemManagement/accountManagement/index'),
  396. meta: {
  397. title: '账号列表',
  398. // icon: 'table',
  399. roles: ['admin']
  400. }
  401. },
  402. {
  403. path: 'RoleManagement',
  404. name: '角色列表',
  405. component: () =>
  406. import('@/views/systemManagement/roleManagement/index'),
  407. meta: {
  408. title: '角色列表',
  409. // icon: 'tree',
  410. roles: ['admin']
  411. }
  412. }
  413. ]
  414. },
  415. {
  416. path: '/helpInfo',
  417. component: Layout,
  418. redirect: '/helpInfo/IssueType',
  419. name: '帮助信息',
  420. meta: {
  421. title: '帮助信息',
  422. icon: 'el-icon-s-help',
  423. roles: ['admin', 'operate']
  424. },
  425. children: [
  426. {
  427. path: 'IssueType',
  428. name: '问题分类',
  429. component: () => import('@/views/helpInfo/issueType/index'),
  430. meta: {
  431. title: '问题分类',
  432. // icon: 'table',
  433. roles: ['admin', 'operate']
  434. }
  435. },
  436. {
  437. path: 'Information',
  438. name: '信息内容',
  439. component: () => import('@/views/helpInfo/information/index'),
  440. meta: {
  441. title: '信息内容',
  442. // icon: 'tree',
  443. roles: ['admin', 'operate']
  444. }
  445. }
  446. ]
  447. }
  448. ];
  449. const createRouter = () =>
  450. new Router({
  451. // mode: 'history', // require service support
  452. scrollBehavior: () => ({
  453. y: 0
  454. }),
  455. routes: constantRoutes
  456. });
  457. const router = createRouter();
  458. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  459. export function resetRouter() {
  460. const newRouter = createRouter();
  461. router.matcher = newRouter.matcher; // reset router
  462. }
  463. export default router;