index.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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: '/appManage',
  64. component: Layout,
  65. name: '应用管理',
  66. meta: { title: '应用管理', icon: 'form' },
  67. children: [
  68. {
  69. path: 'appManage',
  70. name: '应用列表',
  71. component: () => import('@/views/appManage/index'),
  72. meta: { title: '应用列表', icon: 'app' }
  73. },
  74. {
  75. hidden: true,
  76. path: 'appManage/add',
  77. name: '新增应用',
  78. component: () => import('@/views/appManage/add'),
  79. meta: { title: '新增应用', icon: 'form' }
  80. },
  81. {
  82. hidden: true,
  83. path: 'appManage/edit',
  84. name: '编辑应用',
  85. component: () => import('@/views/appManage/edit'),
  86. meta: { title: '编辑应用', icon: 'form' }
  87. }
  88. ]
  89. },
  90. //微信配置
  91. {
  92. path: '/WeChatConfig',
  93. component: Layout,
  94. meta: { title: '微信配置', icon: 'form' },
  95. children: [
  96. {
  97. path: 'WeChatConfig',
  98. name: 'WeChatConfig',
  99. component: () => import('@/views/WeChatConfig/index'),
  100. meta: { title: '微信配置', icon: 'app' }
  101. },
  102. {
  103. hidden: true,
  104. path: 'WeChatConfig/Edit',
  105. name: '配置编辑',
  106. component: () => import('@/views/WeChatConfig/Edit'),
  107. meta: { title: '配置编辑', icon: 'form' }
  108. }
  109. ]
  110. },
  111. {
  112. path: '/login',
  113. component: () => import('@/views/login/index'),
  114. hidden: true
  115. },
  116. {
  117. path: '/404',
  118. component: () => import('@/views/404'),
  119. hidden: true
  120. },
  121. {
  122. path: 'external-link',
  123. component: Layout,
  124. children: [
  125. {
  126. path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  127. meta: { title: 'External Link', icon: 'link' }
  128. }
  129. ]
  130. },
  131. // 404 page must be placed at the end !!!
  132. { path: '*', redirect: '/404', hidden: true }
  133. ]
  134. const createRouter = () => new Router({
  135. // mode: 'history', // require service support
  136. scrollBehavior: () => ({ y: 0 }),
  137. routes: constantRoutes
  138. })
  139. const router = createRouter()
  140. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  141. export function resetRouter () {
  142. const newRouter = createRouter()
  143. router.matcher = newRouter.matcher // reset router
  144. }
  145. export default router