import { createRouter, createWebHashHistory } from 'vue-router'
import StartView from "@/views/StartView.vue"
import StepOne from "@/views/StepOne.vue"
import StepTwo from "@/views/StepTwo.vue"
import StepThree from "@/views/StepThree.vue"
import StepFour from "@/views/StepFour.vue"
import StepFive from "@/views/StepFive.vue"
import StepSix from "@/views/StepSix.vue"
import StepSeven from "@/views/StepSeven.vue"

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

const routes = [
  {
    path: '/start',
    name: 'StartView',
    component: StartView,
  },
  {
    path: '/step-one',
    name: 'StepOne',
    component: StepOne,
  },
  {
    path: '/step-two',
    name: 'StepTwo',
    component: StepTwo,
  },
  {
    path: '/step-three',
    name: 'StepThree',
    component: StepThree,
  },
  {
    path: '/step-four',
    name: 'StepFour',
    component: StepFour,
  },
  {
    path: '/step-five',
    name: 'StepFive',
    component: StepFive,
  },
  {
    path: '/step-six',
    name: 'StepSix',
    component: StepSix,
  },
  {
    path: '/step-seven',
    name: 'StepSeven',
    component: StepSeven,
  },
]

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

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

export default router
