index.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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' 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: '/login',
  32. component: () => import('@/views/login/index'),
  33. hidden: true
  34. },
  35. {
  36. path: '/404',
  37. component: () => import('@/views/404'),
  38. hidden: true
  39. },
  40. {
  41. path: '/',
  42. redirect: '/main', // 首页
  43. component: Layout,
  44. children: [
  45. {
  46. path: 'main',
  47. name: 'main',
  48. component: () => import('@/views/main/index'),
  49. meta: { title: '首页' }
  50. }
  51. ]
  52. },
  53. {
  54. path: '/teamDetail', // 乐团详情
  55. component: Layout,
  56. meta: { title: '乐团详情' },
  57. children: [
  58. {
  59. path: 'teamDetail',
  60. name: 'teamDetail',
  61. component: () => import('@/views/teamDetail/index'),
  62. meta: { title: '乐团详情' },
  63. },
  64. {
  65. path: 'studentSignin',
  66. name: 'studentSignin',
  67. component: () => import('@/views/teamDetail/components/studentSignin'),
  68. meta: { title: '学生点名' }
  69. },
  70. {
  71. path: 'teacherSignin',
  72. name: 'teacherSignin',
  73. component: () => import('@/views/teamDetail/components/teacherSignin'),
  74. meta: { title: '老师上课记录' }
  75. }
  76. ]
  77. },
  78. {
  79. path: '/teamBuild', // 创建乐团
  80. component: Layout,
  81. children: [
  82. {
  83. path: 'teamBuild',
  84. name: 'teamBuild',
  85. component: () => import('@/views/teamBuild/index'),
  86. meta: { title: '创建乐团' }
  87. }
  88. ]
  89. },
  90. {
  91. path: '/vipClass', // 小课
  92. component: Layout,
  93. meta: { title: 'vip管理' },
  94. children: [
  95. {
  96. path: 'vipClass',
  97. name: 'vipClass',
  98. component: () => import('@/views/vipClass/vipList'),
  99. meta: { title: 'vip课列表' }
  100. },
  101. {
  102. path: 'vipDetail',
  103. name: 'vipDetail',
  104. component: () => import('@/views/vipClass/vipDetail/index'),
  105. meta: { title: '调整记录' }
  106. },
  107. {
  108. path: 'resetClass',
  109. name: 'resetClass',
  110. component: () => import('@/views/vipClass/resetClasss'),
  111. meta: { title: 'vip课详情' }
  112. }
  113. ]
  114. }, {
  115. path: '/teacher',
  116. component: Layout,
  117. redirect: '/teacher/teacherList',
  118. meta: { title: '老师管理' },
  119. children: [
  120. {
  121. path: 'teacherList',
  122. name: 'teacherList',
  123. meta: { title: '老师列表' },
  124. component: () => import('@/views/teacherManager/teacherList')
  125. },
  126. {
  127. path: 'teacherDetail',
  128. name: 'teacherDetail',
  129. meta: { title: '老师详情' },
  130. component: () => import('@/views/teacherManager/teacherDetail/index')
  131. }
  132. ]
  133. }, {
  134. path: '/student',
  135. component: Layout,
  136. redirect: '/student/studentList',
  137. meta: { title: '学生管理' },
  138. children: [
  139. {
  140. path: 'studentList',
  141. meta: { title: '学生列表' },
  142. component: () => import('@/views/studentManager/studentList'),
  143. },
  144. {
  145. path: 'studentdetaile',
  146. meta: { title: '学员详情' },
  147. component: () => import('@/views/studentManager/index'),
  148. }
  149. ]
  150. }, {
  151. path: '/business',
  152. component: Layout,
  153. redirect: '/business/orderManager/income',
  154. meta: { title: '交易管理' },
  155. children: [
  156. {
  157. path: 'order',
  158. meta: { title: '订单管理' },
  159. component: () => import('@/views/businessManager/orderManager/index'),// Parent router-view
  160. children: [{
  161. path: 'income',
  162. meta: { title: '收入' },
  163. component: () => import('@/views/businessManager/orderManager/income')
  164. }, {
  165. path: 'backMoney',
  166. meta: { title: '退费管理' },
  167. component: () => import('@/views/businessManager/orderManager/backMoney')
  168. }, {
  169. path: 'expend',
  170. meta: { title: '支出' },
  171. component: () => import('@/views/businessManager/orderManager/expend')
  172. }]
  173. },
  174. {
  175. path: 'shopManager',
  176. meta: { title: '商品管理' },
  177. component: () => import('@/views/businessManager/shopManager/index'),
  178. children: [
  179. {
  180. path: 'shopList',
  181. meta: { title: '商品列表' },
  182. component: () => import('@/views/businessManager/shopManager/shopList')
  183. },
  184. {
  185. path: 'shopCategroy',
  186. meta: { title: '商品分类' },
  187. component: () => import('@/views/businessManager/shopManager/shopCategory')
  188. }
  189. ]
  190. }
  191. ]
  192. },
  193. {
  194. path: '/example',
  195. component: Layout,
  196. redirect: '/example/table',
  197. name: 'Example',
  198. meta: { title: 'Example', icon: 'example' },
  199. children: [
  200. {
  201. path: 'table',
  202. name: 'Table',
  203. component: () => import('@/views/table/index'),
  204. meta: { title: 'Table' }
  205. },
  206. {
  207. path: 'tree',
  208. name: 'Tree',
  209. component: () => import('@/views/tree/index'),
  210. meta: { title: 'Tree' }
  211. }
  212. ]
  213. },
  214. {
  215. path: '/form',
  216. component: Layout,
  217. children: [
  218. {
  219. path: 'index',
  220. name: 'Form',
  221. component: () => import('@/views/form/index'),
  222. meta: { title: 'Form' }
  223. }
  224. ]
  225. },
  226. {
  227. path: '/nested',
  228. component: Layout,
  229. redirect: '/nested/menu1',
  230. name: 'Nested',
  231. meta: {
  232. title: 'Nested',
  233. icon: 'nested'
  234. },
  235. children: [
  236. {
  237. path: 'menu1',
  238. component: () => import('@/views/nested/menu1/index'), // Parent router-view
  239. name: 'Menu1',
  240. meta: { title: 'Menu1' },
  241. children: [
  242. {
  243. path: 'menu1-1',
  244. component: () => import('@/views/nested/menu1/menu1-1'),
  245. name: 'Menu1-1',
  246. meta: { title: 'Menu1-1' }
  247. },
  248. {
  249. path: 'menu1-2',
  250. component: () => import('@/views/nested/menu1/menu1-2'),
  251. name: 'Menu1-2',
  252. meta: { title: 'Menu1-2' },
  253. children: [
  254. {
  255. path: 'menu1-2-1',
  256. component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
  257. name: 'Menu1-2-1',
  258. meta: { title: 'Menu1-2-1' }
  259. },
  260. {
  261. path: 'menu1-2-2',
  262. component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
  263. name: 'Menu1-2-2',
  264. meta: { title: 'Menu1-2-2' }
  265. }
  266. ]
  267. },
  268. {
  269. path: 'menu1-3',
  270. component: () => import('@/views/nested/menu1/menu1-3'),
  271. name: 'Menu1-3',
  272. meta: { title: 'Menu1-3' }
  273. }
  274. ]
  275. },
  276. {
  277. path: 'menu2',
  278. component: () => import('@/views/nested/menu2/index'),
  279. meta: { title: 'menu2' }
  280. }
  281. ]
  282. },
  283. {
  284. path: 'external-link',
  285. component: Layout,
  286. children: [
  287. {
  288. path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  289. meta: { title: 'External Link' }
  290. }
  291. ]
  292. },
  293. // 404 page must be placed at the end !!!
  294. { path: '*', redirect: '/404', hidden: true }
  295. ]
  296. const createRouter = () => new Router({
  297. // mode: 'history', // require service support
  298. scrollBehavior: () => ({ y: 0 }),
  299. routes: constantRoutes
  300. })
  301. const router = createRouter()
  302. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  303. export function resetRouter () {
  304. const newRouter = createRouter()
  305. router.matcher = newRouter.matcher // reset router
  306. }
  307. export default router