import { createRouter, createWebHashHistory } from 'vue-router'
import GeneralView from '../views/General.vue'
import HistoryView from '../views/History.vue'
import TreasureView from '../views/Treasure.vue'
import TreasureDetail from '../views/TreasureDetail.vue'
import MetaverseView from '../views/Metaverse.vue'
import TestView from '../views/Test.vue'

// import store from '@/store/index.js'

const routes = [
  { path: '/', redirect: '/general' }, // todo: 这个会导致/history也匹配到？！
  {
    path: '/general',
    name: 'GeneralView',
    component: GeneralView,
    meta: {
      isShow3DMap: true,
    }
  },
  {
    path: '/history',
    name: 'HistoryView',
    component: HistoryView,
  },
  {
    path: '/treasure',
    name: 'TreasureView',
    component: TreasureView,
  },
  {
    path: '/Treasure-detail',
    name: 'TreasureDetail',
    component: TreasureDetail,
  },
  {
    path: '/metaverse',
    name: 'MetaverseView',
    component: MetaverseView,
  },
  {
    path: '/test',
    name: 'TestView',
    component: TestView,
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

// router.beforeEach((to, from) => {
//   // 生产环境下强制每次都从首页进入
//   if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'home-view') {
//     return '/'
//   }
// })

export default router
