index.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 asyncRoutes = [
  30. {
  31. path: '/bz/base',
  32. component: Layout,
  33. name: 'bz',
  34. meta: {
  35. title: '业务资源管理',
  36. icon: 'el-icon-eleme',
  37. authorities: ['bz.base.venue.find']
  38. },
  39. redirect: '/bz/base/venue',
  40. children: [
  41. {
  42. path: 'venue',
  43. name: 'BzBaseVenue',
  44. component: () => import('@/views/bz/base/venue/index'),
  45. meta: { title: '场馆', authorities: ['bz.base.venue.find'] }
  46. },
  47. {
  48. path: 'scenery',
  49. name: 'BzBaseScenery',
  50. component: () => import('@/views/bz/base/scenery/index'),
  51. meta: { title: '景区' }
  52. },
  53. {
  54. path: 'holidayVillage',
  55. name: 'BzBaseHolidayVillage',
  56. component: () => import('@/views/bz/base/holidayVillage/index'),
  57. meta: { title: '度假村' }
  58. },
  59. {
  60. path: 'hotel',
  61. name: 'BzBaseHotel',
  62. component: () => import('@/views/bz/base/hotel/index'),
  63. meta: { title: '酒店' }
  64. },
  65. {
  66. path: 'homeStay',
  67. name: 'BzBaseHomeStay',
  68. component: () => import('@/views/bz/base/homeStay/index'),
  69. meta: { title: '民宿' }
  70. },
  71. {
  72. path: 'tourist',
  73. name: 'BzBaseTourist',
  74. component: () => import('@/views/bz/base/tourist/index'),
  75. meta: { title: '旅行社' }
  76. }
  77. ]
  78. },
  79. {
  80. path: '/appKey',
  81. component: Layout,
  82. name: 'AppKey',
  83. meta: { title: '接口', icon: 'el-icon-eleme', authorities: ['app.key.find', 'app.key.request.logs'] },
  84. redirect: '/appKey/index',
  85. children: [
  86. {
  87. path: 'index',
  88. name: 'AppKeyIndex',
  89. component: () => import('@/views/appKey/index'),
  90. meta: { title: 'AppKey管理', authorities: ['app.key.find'] }
  91. },
  92. {
  93. path: 'requestLogs',
  94. name: 'AppKeyRequestLogs',
  95. component: () => import('@/views/appKey/requestLogs'),
  96. meta: { title: '调用日志', authorities: ['app.key.request.logs'] }
  97. }
  98. ]
  99. },
  100. {
  101. path: '/user',
  102. component: Layout,
  103. name: 'User',
  104. meta: {
  105. title: '用户',
  106. icon: 'el-icon-user',
  107. authorities: ['oauth.user.find', 'oauth.role.find', 'oauth.role.find', 'oauth.user.find.operate.log', 'oauth.user.find.login.log']
  108. },
  109. children: [
  110. {
  111. path: 'info',
  112. name: 'UserInfo',
  113. component: () => import('@/views/user/info'),
  114. meta: { title: '用户管理', authorities: ['oauth.user.find'] }
  115. },
  116. {
  117. path: 'role',
  118. name: 'UserRole',
  119. component: () => import('@/views/user/role'),
  120. meta: { title: '角色管理', authorities: ['oauth.role.find'] }
  121. },
  122. {
  123. path: 'operateLog',
  124. name: 'UserOperateLog',
  125. component: () => import('@/views/user/operateLog'),
  126. meta: { title: '操作日志', authorities: ['oauth.user.find.operate.log'] }
  127. },
  128. {
  129. path: 'loginLog',
  130. name: 'UserLoginLog',
  131. component: () => import('@/views/user/loginLog'),
  132. meta: { title: '登录日志', authorities: ['oauth.user.find.login.log'] }
  133. }
  134. ]
  135. },
  136. {
  137. path: '/setting',
  138. component: Layout,
  139. name: 'Setting',
  140. meta: { title: '设置', icon: 'el-icon-setting', authorities: ['system.config.find'] },
  141. children: [
  142. {
  143. path: 'systemConfig',
  144. name: 'SettingSystemConfig',
  145. component: () => import('@/views/setting/systemConfig'),
  146. meta: { title: '系统设置', authorities: ['system.config.find'] }
  147. }
  148. ]
  149. },
  150. // 404 page must be placed at the end !!!
  151. { path: '*', redirect: '/404', hidden: true }
  152. ]
  153. export const constantRoutes = [
  154. {
  155. path: '/login',
  156. component: () => import('@/views/login/index'),
  157. hidden: true
  158. },
  159. {
  160. path: '/api/docs',
  161. component: () => import('@/views/apidocs/index'),
  162. hidden: true
  163. },
  164. {
  165. path: '/404',
  166. component: () => import('@/views/404'),
  167. hidden: true
  168. },
  169. {
  170. path: '/',
  171. component: Layout,
  172. redirect: '/dashboard',
  173. children: [
  174. {
  175. path: 'dashboard',
  176. component: () => import('@/views/dashboard/index'),
  177. name: 'Dashboard',
  178. meta: { title: '控制面片', icon: 'dashboard', affix: true }
  179. }
  180. ]
  181. }
  182. ]
  183. const createRouter = () => new Router({
  184. mode: 'hash', // require service support
  185. scrollBehavior: () => ({ y: 0 }),
  186. routes: constantRoutes
  187. })
  188. const router = createRouter()
  189. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  190. export function resetRouter() {
  191. const newRouter = createRouter()
  192. router.matcher = newRouter.matcher // reset router
  193. }
  194. export default router