index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. import TeacherRouter from "./teacherRouter";
  4. import AppRouter from "./appRouter";
  5. import AuditionRouter from "./auditionRouter";
  6. import ServiceRouter from "./serviceRouter";
  7. Vue.use(Router);
  8. let defaultRouter = [
  9. {
  10. path: "/",
  11. redirect: {
  12. name: "business",
  13. },
  14. },
  15. {
  16. path: "/queryFortuneBag",
  17. name: "FortuneBag",
  18. component: () =>
  19. import(
  20. /* webpackChunkName:'CallNames'*/ "@/views/teacher/queryList/queryFortuneBag"
  21. ),
  22. meta: {
  23. descrition: "页面查看",
  24. weight: 1, // 页面权重
  25. },
  26. },
  27. {
  28. path: "/queryActiveList",
  29. name: "ActiveList",
  30. component: () =>
  31. import(
  32. /* webpackChunkName:'CallNames'*/ "@/views/teacher/queryList/queryActiveList"
  33. ),
  34. meta: {
  35. descrition: "页面查看",
  36. weight: 1, // 页面权重
  37. },
  38. },
  39. {
  40. path: "/guide",
  41. name: "guide",
  42. component: () =>
  43. import(/* webpackChunkName:'CallNames'*/ "@/views/rules/guide"),
  44. meta: {
  45. descrition: "投屏引导",
  46. weight: 1, // 页面权重
  47. },
  48. },
  49. {
  50. path: "/applyActive",
  51. name: "applyActive",
  52. component: () =>
  53. import(
  54. /* webpackChunkName:'applyActive' */ "@/views/applyActive/index.vue"
  55. ),
  56. meta: {
  57. descrition: "考级活动",
  58. weight: 0,
  59. },
  60. },
  61. {
  62. path: "/registerProtocol",
  63. name: "registerProtocol",
  64. component: () =>
  65. import(
  66. /* webpackChunkName:'registerProtocol' */ "@/views/protocol/registerProtocol.vue"
  67. ),
  68. meta: {
  69. descrition: "查看协议",
  70. weight: 0,
  71. },
  72. },
  73. {
  74. path: "/auth",
  75. name: "auth",
  76. component: () =>
  77. import(/* webpackChunkName:'auth' */ "@/views/protocol/auth.vue"),
  78. meta: {
  79. descrition: "实名认证",
  80. weight: 0,
  81. },
  82. },
  83. {
  84. path: "/afterClassEvaluate",
  85. name: "afterClassEvaluate",
  86. component: () =>
  87. import(
  88. /* webpackChunkName:'afterClassEvaluate' */ "@/views/afterClassEvaluate/index.vue"
  89. ),
  90. meta: {
  91. descrition: "课后评价",
  92. weight: 0,
  93. },
  94. },
  95. {
  96. path: "/afterClassEvaluateDetail",
  97. name: "afterClassEvaluateDetail",
  98. component: () =>
  99. import(
  100. /* webpackChunkName:'afterClassEvaluateDetail' */ "@/views/afterClassEvaluate/detail.vue"
  101. ),
  102. meta: {
  103. descrition: "课后详情",
  104. weight: 0,
  105. },
  106. },
  107. {
  108. path: "/massMessage",
  109. name: "massMessage",
  110. component: () =>
  111. import(/* webpackChunkName:'massMessage' */ "@/views/massMessage/index"),
  112. meta: {
  113. descrition: "群发消息",
  114. weight: 2,
  115. },
  116. },
  117. {
  118. path: "/massOperation",
  119. name: "massOperation",
  120. component: () =>
  121. import(
  122. /* webpackChunkName:'massOperation' */ "@/views/massMessage/operation"
  123. ),
  124. meta: {
  125. descrition: "定时消息",
  126. weight: 2,
  127. },
  128. },
  129. // {
  130. // path: "/serviceStudent",
  131. // name: "serviceStudent",
  132. // component: () =>
  133. // import(
  134. // /* webpackChunkName:'serviceStudent' */ "@/views/serviceStudent/index"
  135. // ),
  136. // meta: {
  137. // descrition: "商品销售",
  138. // weight: 2,
  139. // },
  140. // },
  141. ];
  142. defaultRouter = defaultRouter
  143. .concat(TeacherRouter)
  144. .concat(AppRouter)
  145. .concat(AuditionRouter)
  146. .concat(ServiceRouter);
  147. const router = new Router({
  148. // mode: 'history',
  149. base: process.env.BASE_URL,
  150. routes: defaultRouter,
  151. scrollBehavior() {
  152. return { x: 0, y: 0 };
  153. },
  154. });
  155. router.onError((error) => {
  156. const pattern = /Loading chunk (\d)+ failed/g;
  157. const isChunkLoadFailed = error.message.match(pattern);
  158. const targetPath = router.history.pending.fullPath;
  159. if (isChunkLoadFailed) {
  160. router.replace(targetPath);
  161. }
  162. });
  163. export default router;