index.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /* Home */
  7. import Home from '@/views/home/index'
  8. /**
  9. * Note: sub-menu only appear when route children.length >= 1
  10. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  11. *
  12. * hidden: true if set true, item will not show in the sidebar(default is false)
  13. * alwaysShow: true if set true, will always show the root menu
  14. * if not set alwaysShow, when item has more than one children route,
  15. * it will becomes nested mode, otherwise not show the root menu
  16. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  17. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  18. * meta : {
  19. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  20. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  21. icon: 'svg-name' the icon show in the sidebar
  22. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  23. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  24. }
  25. */
  26. /**
  27. * constantRoutes
  28. * a base page that does not have permission requirements
  29. * all roles can be accessed
  30. */
  31. export const constantRoutes = [
  32. {
  33. path: '/login',
  34. component: () => import('@/views/login/index'),
  35. hidden: true
  36. },
  37. {
  38. path: '/404',
  39. component: () => import('@/views/404'),
  40. hidden: true
  41. },
  42. {
  43. path: '/',
  44. component: Home,
  45. hidden: true
  46. },
  47. {
  48. path: '/home',
  49. component: Home,
  50. name: '首页',
  51. hidden: true
  52. },
  53. // {
  54. // path: '/home',
  55. // component: Layout,
  56. // redirect: '/dashboard',
  57. // children: [{
  58. // path: 'dashboard',
  59. // name: 'Dashboard',
  60. // component: () => import('@/views/dashboard/index'),
  61. // meta: { title: 'Dashboard', icon: 'dashboard' }
  62. // }]
  63. // },
  64. {
  65. path: '/env-platform',
  66. component: Layout,
  67. redirect: '/env-platform/env',
  68. name: '环境',
  69. meta: { title: '环境平台', icon: 'env_platform' },
  70. children: [
  71. {
  72. path: 'env',
  73. name: 'env',
  74. component: () => import('@/views/env/index.vue'),
  75. meta: { title: '环境管理', icon: 'env' }
  76. },
  77. {
  78. path: 'businessline',
  79. name: 'businessline',
  80. component: () => import('@/views/env/index.vue'),
  81. meta: { title: '业务线管理', icon: 'businessline' }
  82. },
  83. {
  84. path: 'whitelist',
  85. name: 'whitelist',
  86. component: () => import('@/views/env/index.vue'),
  87. meta: { title: '白名单管理', icon: 'whitelist' }
  88. },
  89. {
  90. path: 'module',
  91. name: 'module',
  92. component: () => import('@/views/env/index.vue'),
  93. meta: { title: '模块管理', icon: 'module' }
  94. },
  95. {
  96. path: 'group',
  97. name: 'group',
  98. component: () => import('@/views/env/index.vue'),
  99. meta: { title: 'Group管理', icon: 'group' }
  100. },
  101. {
  102. path: 'topic',
  103. name: 'topic',
  104. component: () => import('@/views/env/index.vue'),
  105. meta: { title: 'Topic管理', icon: 'topic' }
  106. },
  107. {
  108. path: 'mq',
  109. name: 'mq',
  110. component: () => import('@/views/env/index.vue'),
  111. meta: { title: 'MQ管理', icon: 'MQ' }
  112. },
  113. {
  114. path: 'data',
  115. name: 'data',
  116. component: () => import('@/views/env/index.vue'),
  117. meta: { title: '数据统计', icon: 'data' }
  118. }
  119. ]
  120. },
  121. {
  122. path: '/mock',
  123. component: Layout,
  124. redirect: '/mock/interface',
  125. name: 'Mock',
  126. meta: { title: 'Mock服务', icon: 'example' },
  127. children: [
  128. {
  129. path: 'interface',
  130. name: 'Interface',
  131. component: () => import('@/views/mock/interface'),
  132. meta: { title: 'dubbo mock', icon: 'interface' }
  133. },
  134. {
  135. path: 'interface/:rule',
  136. name: 'Rule',
  137. hidden: true,
  138. component: () => import('@/views/mock/rule'),
  139. meta: { title: 'dubbo规则' }
  140. },
  141. {
  142. path: 'httpmock',
  143. name: 'httpmock',
  144. component: () => import('@/views/mock/httpmock'),
  145. meta: { title: 'http mock', icon: 'rule' }
  146. },
  147. {
  148. path: 'httpmock/:httprule',
  149. name: 'Httprule',
  150. hidden: true,
  151. component: () => import('@/views/mock/httprule'),
  152. meta: { title: 'httpmock规则' }
  153. }
  154. ]
  155. },
  156. {
  157. path: '/cure',
  158. component: Layout,
  159. redirect: '/cure/commonTools/redis',
  160. name: 'cure',
  161. meta: { title: '数据中心', icon: 'group' },
  162. children: [
  163. {
  164. path: 'commonTools',
  165. name: '通用工具',
  166. alwaysShow: true,
  167. component: () => import('@/views/cure/menu1/index.vue'),
  168. meta: { title: '通用工具', icon: 'interface' },
  169. children: [
  170. {
  171. path: 'redis',
  172. name: 'Redis',
  173. component: () => import('@/views/cure/menu1/action.vue'),
  174. meta: { title: '获取Redis的数据', icon: 'interface' }
  175. }
  176. ]
  177. },
  178. {
  179. path: 'daijia',
  180. name: '代驾数据构造',
  181. component: () => import('@/views/cure/menu1/index.vue'),
  182. alwaysShow: true,
  183. meta: { title: '代驾数据构造', icon: 'rule' },
  184. children: [
  185. {
  186. path: 'highBottomLine',
  187. name: 'HighBottomLine',
  188. component: () => import('@/views/cure/menu1/Homes.vue'),
  189. meta: { title: '司机高底线切换', icon: 'interface' }
  190. }
  191. ]
  192. }
  193. ]
  194. },
  195. { path: '*', redirect: '/404', hidden: true }
  196. ]
  197. const createRouter = () => new Router({
  198. // mode: 'history', // require service support
  199. scrollBehavior: () => ({ y: 0 }),
  200. routes: constantRoutes
  201. })
  202. const router = createRouter()
  203. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  204. export function resetRouter() {
  205. const newRouter = createRouter()
  206. router.matcher = newRouter.matcher // reset router
  207. }
  208. export default router