index.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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: '/categoryManager',
  195. component: Layout,
  196. meta: { title: '系统内部管理' },
  197. children: [{
  198. path: 'adminManager',
  199. name: 'adminManager',
  200. meta: { title: '权限管理' },
  201. component: () => import('@/views/categroyManager/adminManager')
  202. },
  203. {
  204. path: 'staffManager',
  205. name: 'staffManager',
  206. meta: { title: '员工管理' },
  207. component: () => import('@/views/categroyManager/staffManager')
  208. }, {
  209. path: 'branchManager',
  210. name: 'branchManager',
  211. meta: { title: '合作单位' },
  212. component: () => import('@/views/categroyManager/branchManager')
  213. }, {
  214. path: 'addressManager',
  215. name: 'addressManager',
  216. meta: { title: '教学点管理' },
  217. component: () => import('@/views/categroyManager/addressManager')
  218. }
  219. ]
  220. }, {
  221. path: '/mapDemo',
  222. component: Layout,
  223. meta: { title: '地图案例' },
  224. children: [
  225. {
  226. path: 'map',
  227. component: () => import('@/views/mapDemo/index'),
  228. meta: { title: '地图' }
  229. }
  230. ]
  231. }
  232. ,
  233. {
  234. path: '/example',
  235. component: Layout,
  236. redirect: '/example/table',
  237. name: 'Example',
  238. meta: { title: 'Example', icon: 'example' },
  239. children: [
  240. {
  241. path: 'table',
  242. name: 'Table',
  243. component: () => import('@/views/table/index'),
  244. meta: { title: 'Table' }
  245. },
  246. {
  247. path: 'tree',
  248. name: 'Tree',
  249. component: () => import('@/views/tree/index'),
  250. meta: { title: 'Tree' }
  251. }
  252. ]
  253. },
  254. {
  255. path: '/form',
  256. component: Layout,
  257. children: [
  258. {
  259. path: 'index',
  260. name: 'Form',
  261. component: () => import('@/views/form/index'),
  262. meta: { title: 'Form' }
  263. }
  264. ]
  265. },
  266. {
  267. path: '/nested',
  268. component: Layout,
  269. redirect: '/nested/menu1',
  270. name: 'Nested',
  271. meta: {
  272. title: 'Nested',
  273. icon: 'nested'
  274. },
  275. children: [
  276. {
  277. path: 'menu1',
  278. component: () => import('@/views/nested/menu1/index'), // Parent router-view
  279. name: 'Menu1',
  280. meta: { title: 'Menu1' },
  281. children: [
  282. {
  283. path: 'menu1-1',
  284. component: () => import('@/views/nested/menu1/menu1-1'),
  285. name: 'Menu1-1',
  286. meta: { title: 'Menu1-1' }
  287. },
  288. {
  289. path: 'menu1-2',
  290. component: () => import('@/views/nested/menu1/menu1-2'),
  291. name: 'Menu1-2',
  292. meta: { title: 'Menu1-2' },
  293. children: [
  294. {
  295. path: 'menu1-2-1',
  296. component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
  297. name: 'Menu1-2-1',
  298. meta: { title: 'Menu1-2-1' }
  299. },
  300. {
  301. path: 'menu1-2-2',
  302. component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
  303. name: 'Menu1-2-2',
  304. meta: { title: 'Menu1-2-2' }
  305. }
  306. ]
  307. },
  308. {
  309. path: 'menu1-3',
  310. component: () => import('@/views/nested/menu1/menu1-3'),
  311. name: 'Menu1-3',
  312. meta: { title: 'Menu1-3' }
  313. }
  314. ]
  315. },
  316. {
  317. path: 'menu2',
  318. component: () => import('@/views/nested/menu2/index'),
  319. meta: { title: 'menu2' }
  320. }
  321. ]
  322. },
  323. {
  324. path: 'external-link',
  325. component: Layout,
  326. children: [
  327. {
  328. path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  329. meta: { title: 'External Link' }
  330. }
  331. ]
  332. },
  333. // 404 page must be placed at the end !!!
  334. { path: '*', redirect: '/404', hidden: true }
  335. ]
  336. const createRouter = () => new Router({
  337. // mode: 'history', // require service support
  338. scrollBehavior: () => ({ y: 0 }),
  339. routes: constantRoutes
  340. })
  341. const router = createRouter()
  342. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  343. export function resetRouter () {
  344. const newRouter = createRouter()
  345. router.matcher = newRouter.matcher // reset router
  346. }
  347. export default router