index.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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: '/',
  32. component: Layout,
  33. redirect: '/dashboard',
  34. children: [{
  35. path: 'dashboard',
  36. name: 'Dashboard',
  37. component: () => import('@/views/dashboard/index'),
  38. meta: { title: '首页', icon: 'dashboard' }
  39. }]
  40. },
  41. {
  42. path: '/gameManage',
  43. component: Layout,
  44. name: '游戏管理',
  45. meta: { title: '游戏管理', icon: 'form' },
  46. children: [
  47. {
  48. path: 'gameManage',
  49. name: '游戏列表',
  50. component: () => import('@/views/gameManage/index'),
  51. meta: { title: '游戏列表', icon: 'game' }
  52. },
  53. {
  54. hidden: true,
  55. path: 'gameManage/edit',
  56. name: 'gameEdit',
  57. component: () => import('@/views/gameManage/edit'),
  58. meta: { title: '编辑游戏', icon: 'form' }
  59. }
  60. ]
  61. },
  62. {
  63. path: '/gamePerson',
  64. component: Layout,
  65. meta: { title: '游戏结果管理', icon: 'form' },
  66. children: [
  67. {
  68. path: 'gamePerson',
  69. name: '',
  70. component: () => import('@/views/gamePerson/index'),
  71. meta: { title: '游戏结果列表', icon: 'gamePerson' }
  72. }
  73. ]
  74. },
  75. // 微信配置
  76. {
  77. path: '/WeChatConfig',
  78. component: Layout,
  79. meta: { title: '微信配置', icon: 'form' },
  80. children: [
  81. {
  82. path: 'WeChatConfig',
  83. name: 'WeChatConfig',
  84. component: () => import('@/views/WeChatConfig/index'),
  85. meta: { title: '微信配置', icon: 'wx' }
  86. },
  87. {
  88. hidden: true,
  89. path: 'WeChatConfig/Edit',
  90. name: '配置编辑',
  91. component: () => import('@/views/WeChatConfig/Edit'),
  92. meta: { title: '配置编辑', icon: 'form' }
  93. }
  94. ]
  95. },
  96. // 应用管理
  97. {
  98. path: '/AppController',
  99. component: Layout,
  100. meta: { title: '应用管理', icon: 'form' },
  101. children: [
  102. {
  103. path: 'AppController',
  104. name: '',
  105. component: () => import('@/views/AppController/index'),
  106. meta: { title: '应用管理', icon: 'appconfig' }
  107. }
  108. ]
  109. },
  110. {
  111. path: '/login',
  112. component: () => import('@/views/login/index'),
  113. hidden: true
  114. },
  115. {
  116. path: '/404',
  117. component: () => import('@/views/404'),
  118. hidden: true
  119. },
  120. {
  121. path: 'external-link',
  122. component: Layout,
  123. children: [
  124. {
  125. path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  126. meta: { title: 'External Link', icon: 'link' }
  127. }
  128. ]
  129. },
  130. // 404 page must be placed at the end !!!
  131. { path: '*', redirect: '/404', hidden: true }
  132. ]
  133. const createRouter = () => new Router({
  134. // mode: 'history', // require service support
  135. scrollBehavior: () => ({ y: 0 }),
  136. routes: constantRoutes
  137. })
  138. const router = createRouter()
  139. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  140. export function resetRouter() {
  141. const newRouter = createRouter()
  142. router.matcher = newRouter.matcher // reset router
  143. }
  144. export default router