index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import HomeView from '../views/HomeView.vue'
  4. import RelicsAppr from "@/views/RelicsAppr.vue"
  5. import RelicDetail from "@/components/RelicDetail.vue"
  6. import SwkkFadeIn from "@/views/SwkkFadeIn.vue"
  7. import SwkkView from "@/views/SwkkView.vue"
  8. import ObliqueView from "@/views/ObliqueView.vue"
  9. import PanoView from "@/views/PanoView.vue"
  10. import PanoList from "@/components/PanoList.vue"
  11. Vue.use(VueRouter)
  12. const routes = [
  13. {
  14. path: '/',
  15. name: 'HomeView',
  16. component: HomeView,
  17. beforeEnter (to, from, next) {
  18. const audioNode = document.getElementById('global-audio')
  19. audioNode.pause()
  20. next()
  21. }
  22. },
  23. {
  24. path: '/swkk-fade-in',
  25. name: 'SwkkFadeIn',
  26. component: SwkkFadeIn,
  27. meta: {
  28. isShowBottomBar: false,
  29. canFullScreen: false,
  30. }
  31. },
  32. {
  33. path: '/swkk-view',
  34. name: 'SwkkView',
  35. component: SwkkView,
  36. meta: {
  37. isShowBottomBar: true,
  38. canFullScreen: true,
  39. },
  40. beforeEnter (to, from, next) {
  41. const audioNode = document.getElementById('global-audio')
  42. if (audioNode.src !== require(`@/assets/audios/${globalConfig.audioName.swkkView}.mp3`)) {
  43. audioNode.src = require(`@/assets/audios/${globalConfig.audioName.swkkView}.mp3`)
  44. audioNode.play()
  45. }
  46. next()
  47. },
  48. },
  49. {
  50. path: '/oblique-view',
  51. name: 'ObliqueView',
  52. component: ObliqueView,
  53. meta: {
  54. isShowBottomBar: true,
  55. canFullScreen: true,
  56. },
  57. children: [
  58. {
  59. path: './pano-list',
  60. name: 'PanoList',
  61. component: PanoList,
  62. meta: {
  63. isShowBottomBar: false,
  64. canFullScreen: false,
  65. }
  66. },
  67. ],
  68. },
  69. {
  70. path: '/pano-view',
  71. name: 'PanoView',
  72. component: PanoView,
  73. meta: {
  74. isShowBottomBar: true,
  75. canFullScreen: true,
  76. },
  77. children: [
  78. {
  79. path: './pano-list',
  80. name: 'PanoList',
  81. component: PanoList,
  82. meta: {
  83. isShowBottomBar: false,
  84. canFullScreen: false,
  85. }
  86. },
  87. ],
  88. },
  89. {
  90. path: '/relics-appr',
  91. name: 'RelicsAppr',
  92. component: RelicsAppr,
  93. meta: {
  94. isShowBottomBar: true,
  95. canFullScreen: false,
  96. },
  97. children: [
  98. {
  99. path: './relic-detail',
  100. name: 'RelicDetail',
  101. component: RelicDetail,
  102. meta: {
  103. isShowBottomBar: true,
  104. canFullScreen: false,
  105. }
  106. },
  107. ],
  108. beforeEnter (to, from, next) {
  109. const audioNode = document.getElementById('global-audio')
  110. if (audioNode.src !== require(`@/assets/audios/${globalConfig.audioName.relicsAppr}.mp3`)) {
  111. audioNode.src = require(`@/assets/audios/${globalConfig.audioName.relicsAppr}.mp3`)
  112. audioNode.play()
  113. }
  114. next()
  115. },
  116. },
  117. {
  118. path: '/about',
  119. name: 'about',
  120. // route level code-splitting
  121. // this generates a separate chunk (about.[hash].js) for this route
  122. // which is lazy-loaded when the route is visited.
  123. component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  124. }
  125. ]
  126. const router = new VueRouter({
  127. mode: 'history',
  128. base: process.env.BASE_URL,
  129. routes
  130. })
  131. export default router