index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import { createRouter, createWebHashHistory } from 'vue-router'
  2. import HomeView from '../views/HomeView.vue'
  3. import MoreContent from '../views/MoreContent.vue'
  4. import TEXT from '../views/MoreContentCopy.vue'
  5. import MoreContentChange from '../views/MoreContentChange.vue'
  6. import PoemList from '../views/PoemList.vue'
  7. import PaintingList from '../views/PaintingList.vue'
  8. import PaintingDetailList from '../views/PaintingDetailList.vue'
  9. import GameView from '../views/GameView.vue'
  10. import SceneView from '../views/SceneView.vue'
  11. import BambooBookView from '../views/BambooBookView.vue'
  12. import BambooHotView from '../views/BambooHotView3/index.vue'
  13. import ShuanggouDetail from '../views/ShuangGouSheSeDetail.vue'
  14. import ShuanggouPaintingDetail from '../views/ShuanggouPaintingDetail.vue'
  15. import OnlineSceneView from '../views/OnlineSceneView.vue'
  16. // import store from '@/store/index.js'
  17. const routes = [
  18. // {
  19. // path: '/',
  20. // redirect: '/home',
  21. // },
  22. {
  23. path: '/',
  24. name: 'HomeView',
  25. component: HomeView,
  26. },
  27. {
  28. path: '/more-content-change',
  29. name: 'MoreContentChange',
  30. component: MoreContentChange,
  31. },
  32. // 待完善
  33. {
  34. path: '/TEXT',
  35. name: 'MoreContent2',
  36. component: TEXT,
  37. },
  38. {
  39. path: '/more-content',
  40. name: 'MoreContent',
  41. component: MoreContent,
  42. },
  43. {
  44. path: '/poem-list',
  45. name: 'PoemList',
  46. component: PoemList,
  47. },
  48. {
  49. path: '/painting-list',
  50. name: 'PaintingList',
  51. component: PaintingList,
  52. },
  53. {
  54. path: '/painting-detail-list',
  55. name: 'PaintingDetailList',
  56. component: PaintingDetailList,
  57. },
  58. // 游戏
  59. {
  60. path: '/game',
  61. name: 'Game',
  62. component: GameView,
  63. },
  64. // 线上展厅
  65. {
  66. path: '/scene',
  67. name: 'Scene',
  68. component: SceneView,
  69. },
  70. // 竹谱
  71. {
  72. path: '/bambooBook',
  73. name: 'BambooBook',
  74. component: BambooBookView,
  75. },
  76. // 竹子
  77. {
  78. path: '/bambooHot',
  79. name: 'BambooHot',
  80. component: BambooHotView,
  81. },
  82. // 双钩设色
  83. {
  84. path: '/shuanggouDetail',
  85. name: 'ShuanggouDetail',
  86. component: ShuanggouDetail
  87. },
  88. // 双沟设色-画作
  89. {
  90. path: '/shuanggou-painting-detail',
  91. name: 'ShuanggouPaintingDetail',
  92. component: ShuanggouPaintingDetail,
  93. },
  94. // 线上展厅
  95. {
  96. path: '/onlone-scene',
  97. name: 'OnlineScene',
  98. component: OnlineSceneView
  99. }
  100. ]
  101. const router = createRouter({
  102. history: createWebHashHistory(),
  103. routes
  104. })
  105. router.beforeEach((to, from) => {
  106. // 生产环境下强制每次都从首页进入
  107. if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'HomeView') {
  108. return '/'
  109. }
  110. })
  111. export default router