import Vue from 'vue'
import Router from 'vue-router'

import routerBefore from '@/config/routerBefore.js'
// 主要
// import main from '@/components/main.vue'
// 页面示例
// import mypage from '../components/myPage.vue'
Vue.use(Router)
const constantRouterMap = [{
  path: '/',
  name: 'main',
  component: resolve => require(['@/components/main.vue'], resolve),
  redirect: {
    name: 'sampleHandoverAndSamplePreparationRoom'
  },
  children: [
    {
      path: 'sampleHandoverAndSamplePreparationRoom',
      name: 'sampleHandoverAndSamplePreparationRoom',
      component: resolve => require(['../components/sampleHandoverAndSamplePreparationRoom/sampleHandoverAndSamplePreparationRoom.vue'], resolve)
    },
    {
      path: 'deliveryAnalysisRoom',
      name: 'deliveryAnalysisRoom',
      component: resolve => require(['../components/sampleHandoverAndSamplePreparationRoom/deliveryAnalysisRoom.vue'], resolve)
    },
    {
      path: 'sampleDeliverySampling',
      name: 'sampleDeliverySampling',
      component: resolve => require(['../components/sampleHandoverAndSamplePreparationRoom/sampleDeliverySampling.vue'], resolve)
    },
    {
      path: 'analysisOfSample',
      name: 'analysisOfSample',
      component: resolve => require(['../components/analysisOfSample/analysisOfSample.vue'], resolve)
    },
    {
      path: 'sampleRoom',
      name: 'sampleRoom',
      component: resolve => require(['../components/analysisOfSample/sampleRoom.vue'], resolve)
    },
    {
      path: 'sampleManagementAndSamplePreparationRoom',
      name: 'sampleManagementAndSamplePreparationRoom',
      component: resolve => require(['../components/sampleManagementAndSamplePreparationRoom/sampleManagementAndSamplePreparationRoom.vue'], resolve)
    },
    {
      path: 'sampleRsetentionManagementAnalysisRoom',
      name: 'sampleRsetentionManagementAnalysisRoom',
      component: resolve => require(['../components/sampleRsetentionManagementAnalysisRoom/sampleRsetentionManagementAnalysisRoom.vue'], resolve)
    },
    {
      path: 'fetchConnent',
      name: 'fetchConnent',
      component: resolve => require(['../components/fetchConnent/fetchConnent.vue'], resolve)
    },
    {
      path: 'deputySample',
      name: 'deputySample',
      component: resolve => require(['../components/deputySample/deputySample.vue'], resolve)
    },
    {
      path: 'sampleTrack',
      name: 'sampleTrack',
      component: resolve => require(['../components/sampleTrack/sampleTrack.vue'], resolve)
    }
  ]
}];
const router = new Router({
  routes: constantRouterMap
})

//  before
routerBefore(router, constantRouterMap);

export default router;
//  constantRouterMap
export const routes = constantRouterMap;
// export default new Router({
//   routes: [
//     {
//       path: '/',
//       name: 'main',
//       component: main,
//       redirect: {name: 'mypage'},
//       children: [
//         {path: 'mypage', name: 'mypage', component: mypage}
//         ]
//     }
//   ]
// })
