index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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: '/topicList',
  138. component: Layout,
  139. redirect: '/topicList',
  140. children: [{
  141. path: 'topicList',
  142. name: 'TopicList',
  143. component: () => import('@/views/topicList/index'),
  144. meta: { title: '专题列表', icon: 'dashboard' }
  145. }]
  146. },
  147. {
  148. path: '/topicRelation',
  149. component: Layout,
  150. redirect: '/topicRelation',
  151. children: [{
  152. path: 'topicRelation',
  153. name: 'TopicRelation',
  154. component: () => import('@/views/topicRelation/index'),
  155. meta: { title: '专题课件' }
  156. }],
  157. hidden: true
  158. },
  159. {
  160. path: '/courseList',
  161. component: Layout,
  162. redirect: '/courseList',
  163. children: [{
  164. path: 'courseList',
  165. name: 'CourseList',
  166. component: () => import('@/views/courseList/index'),
  167. meta: { title: '课程列表', icon: 'dashboard' }
  168. }]
  169. },
  170. {
  171. path: '/memberList',
  172. component: Layout,
  173. redirect: '/memberList',
  174. children: [{
  175. path: 'memberList',
  176. name: 'MemberList',
  177. component: () => import('@/views/memberList/index'),
  178. meta: { title: '用户列表', icon: 'dashboard' }
  179. }]
  180. },
  181. {
  182. path: '/memberOrder',
  183. component: Layout,
  184. redirect: '/memberOrder',
  185. children: [{
  186. path: 'memberOrder',
  187. name: 'MemberOrder',
  188. component: () => import('@/views/memberOrder/index'),
  189. meta: { title: '用户订单' }
  190. }],
  191. hidden: true
  192. },
  193. {
  194. path: '/memberAuth',
  195. component: Layout,
  196. redirect: '/memberAuth',
  197. children: [{
  198. path: 'memberAuth',
  199. name: 'MemberAuth',
  200. component: () => import('@/views/memberAuth/index'),
  201. meta: { title: '用户权限' }
  202. }],
  203. hidden: true
  204. },
  205. // 404 page must be placed at the end !!!
  206. { path: '*', redirect: '/404', hidden: true }
  207. ]
  208. const createRouter = () => new Router({
  209. // mode: 'history', // require service support
  210. scrollBehavior: () => ({ y: 0 }),
  211. routes: constantRoutes
  212. })
  213. const router = createRouter()
  214. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  215. export function resetRouter() {
  216. const newRouter = createRouter()
  217. router.matcher = newRouter.matcher // reset router
  218. }
  219. export default router