index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /**
  7. * 参照: https://panjiachen.github.io/vue-element-admin-site/zh/guide/essentials/router-and-nav.html
  8. *
  9. * hidden: true 设置为true不会出现在侧边栏默认false
  10. * alwaysShow: true 设为true变成下拉菜单
  11. * redirect: noRedirect 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
  12. * name:'router-name' 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  13. * meta : {
  14. roles: ['admin','editor'] 设置该路由进入的权限,支持多个权限叠加
  15. title: 'title' 设置该路由在侧边栏和面包屑中展示的名字
  16. icon: 'svg-name' 设置该路由的图标
  17. breadcrumb: false 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  18. activeMenu: '/example/list' 如果设置为false,则不会在breadcrumb面包屑中显示
  19. }
  20. */
  21. export const constantRoutes = [
  22. {
  23. path: '/login',
  24. component: () => import('@/views/login/index'),
  25. hidden: true
  26. },
  27. {
  28. path: '/404',
  29. component: () => import('@/views/404'),
  30. hidden: true
  31. },
  32. {
  33. path: '/',
  34. component: Layout,
  35. redirect: '/dashboard',
  36. children: [{
  37. path: 'dashboard',
  38. name: 'Dashboard',
  39. component: () => import('@/views/dashboard/index'),
  40. meta: { title: '首页', icon: 'dashboard', affix: true }
  41. }]
  42. },
  43. {
  44. path: '/schoolTimetable',
  45. component: Layout,
  46. redirect: '/schoolTimetable',
  47. children: [{
  48. path: 'schoolTimetable',
  49. name: 'SchoolTimetable',
  50. component: () => import('@/views/schoolTimetable/index'),
  51. meta: { title: '课程表', icon: 'dashboard' }
  52. }]
  53. },
  54. {
  55. path: '/dashboardBlockRow',
  56. component: Layout,
  57. redirect: '/dashboardBlockRow',
  58. children: [{
  59. path: 'dashboardBlockRow',
  60. name: 'DashboardBlockRow',
  61. component: () => import('@/views/dashboardBlockRow/index'),
  62. meta: { title: '首页行管理' }
  63. }],
  64. hidden: true
  65. },
  66. {
  67. path: '/dashboardRowItem',
  68. component: Layout,
  69. redirect: '/dashboardRowItem',
  70. children: [{
  71. path: 'dashboardRowItem',
  72. name: 'DashboardRowItem',
  73. component: () => import('@/views/dashboardRowItem/index'),
  74. meta: { title: '首页项列表' }
  75. }],
  76. hidden: true
  77. },
  78. {
  79. path: '/tempateList',
  80. component: Layout,
  81. redirect: '/tempateList',
  82. children: [{
  83. path: 'tempateList',
  84. name: 'TempateList',
  85. component: () => import('@/views/tempateList/index'),
  86. meta: { title: '模板列表', icon: 'dashboard' }
  87. }]
  88. },
  89. {
  90. path: '/uploadTab',
  91. component: Layout,
  92. redirect: '/uploadTab',
  93. children: [{
  94. path: 'uploadTab',
  95. name: 'UploadTab',
  96. component: () => import('@/views/uploadTab/index'),
  97. meta: { title: '导入表格' }
  98. }],
  99. hidden: true
  100. },
  101. {
  102. path: '/schoolDetail',
  103. component: Layout,
  104. redirect: '/schoolDetail',
  105. children: [{
  106. path: 'schoolDetail',
  107. name: 'SchoolDetail',
  108. component: () => import('@/views/schoolDetail/index'),
  109. meta: { title: '课程表详情' }
  110. }],
  111. hidden: true
  112. },
  113. {
  114. path: '/categoryList',
  115. component: Layout,
  116. redirect: '/categoryList',
  117. children: [{
  118. path: 'categoryList',
  119. name: 'CategoryList',
  120. component: () => import('@/views/categoryList/index'),
  121. meta: { title: '专区列表', icon: 'dashboard' }
  122. }]
  123. },
  124. {
  125. path: '/categoryRelation',
  126. component: Layout,
  127. redirect: '/categoryRelation',
  128. children: [{
  129. path: 'categoryRelation',
  130. name: 'CategoryRelation',
  131. component: () => import('@/views/categoryRelation/index'),
  132. meta: { title: '专区课程列表' }
  133. }],
  134. hidden: true
  135. },
  136. {
  137. path: '/memberList',
  138. component: Layout,
  139. redirect: '/memberList',
  140. children: [{
  141. path: 'memberList',
  142. name: 'MemberList',
  143. component: () => import('@/views/memberList/index'),
  144. meta: { title: '用户列表', icon: 'dashboard' }
  145. }]
  146. },
  147. {
  148. path: '/memberOrder',
  149. component: Layout,
  150. redirect: '/memberOrder',
  151. children: [{
  152. path: 'memberOrder',
  153. name: 'MemberOrder',
  154. component: () => import('@/views/memberOrder/index'),
  155. meta: { title: '用户订单' }
  156. }],
  157. hidden: true
  158. },
  159. {
  160. path: '/memberAuth',
  161. component: Layout,
  162. redirect: '/memberAuth',
  163. children: [{
  164. path: 'memberAuth',
  165. name: 'MemberAuth',
  166. component: () => import('@/views/memberAuth/index'),
  167. meta: { title: '用户权限' }
  168. }],
  169. hidden: true
  170. },
  171. // 404 page must be placed at the end !!!
  172. { path: '*', redirect: '/404', hidden: true }
  173. ]
  174. const createRouter = () => new Router({
  175. // mode: 'history', // require service support
  176. scrollBehavior: () => ({ y: 0 }),
  177. routes: constantRoutes
  178. })
  179. const router = createRouter()
  180. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  181. export function resetRouter() {
  182. const newRouter = createRouter()
  183. router.matcher = newRouter.matcher // reset router
  184. }
  185. export default router