index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Home from '../pages/Home.vue'
  4. import RuleDesc from "@/views/gui/RuleDesc.vue"
  5. import RuleDescMobile from "@/views/gui/RuleDescMobile.vue"
  6. import Login from "@/views/gui/Login.vue"
  7. import SignUp from "@/views/gui/SignUp.vue"
  8. import Share from "@/views/gui/Share.vue"
  9. import QuestionPositionTip from "@/views/gui/QuestionPositionTip.vue"
  10. const originalPush = VueRouter.prototype.push
  11. VueRouter.prototype.push = function push (location) {
  12. return originalPush.call(this, location).catch(err => err)
  13. }
  14. Vue.use(VueRouter)
  15. const routes = [
  16. {
  17. path: '/',
  18. name: 'Home',
  19. component: Home,
  20. beforeEnter: ((to, from, next) => {
  21. if (!to.query.m) {
  22. router.replace({
  23. path: '/',
  24. query: {
  25. m: 'SS-SbPlRnV7Wg',
  26. },
  27. })
  28. location.reload()
  29. } else {
  30. next()
  31. }
  32. }),
  33. children: [
  34. {
  35. path: 'rule-desc',
  36. name: 'RuleDesc',
  37. component: RuleDesc,
  38. },
  39. {
  40. path: 'rule-desc-mobile',
  41. name: 'RuleDescMobile',
  42. component: RuleDescMobile,
  43. },
  44. {
  45. path: 'login',
  46. name: 'Login',
  47. component: Login,
  48. },
  49. {
  50. path: 'sign-up',
  51. name: 'SignUp',
  52. component: SignUp,
  53. },
  54. {
  55. path: 'share',
  56. name: 'Share',
  57. component: Share,
  58. },
  59. {
  60. path: 'question-position-tip',
  61. name: 'QuestionPositionTip',
  62. component: QuestionPositionTip,
  63. },
  64. ]
  65. }
  66. ]
  67. const router = new VueRouter({
  68. routes
  69. })
  70. export default router