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: 'visualInspectionManagement'
  },
  children: [
    {
      path: 'visualInspectionManagement',
      name: 'visualInspectionManagement',
      component: resolve => require(['../components/visualInspectionManagement/visualInspectionManagement.vue'], resolve)
    },
    {
      path: 'samplingTaskRaw',
      name: 'samplingTaskRaw',
      component: resolve => require(['../components/samplingTaskRaw/samplingTaskRaw.vue'], resolve)
    },
    {
      path: 'samplingTaskFinished',
      name: 'samplingTaskFinished',
      component: resolve => require(['../components/samplingTaskFinished/samplingTaskFinished.vue'], resolve)
    },{
      path: 'samplingTaskCosntrol',
      name: 'samplingTaskCosntrol',
      component: resolve => require(['../components/samplingTaskCosntrol/samplingTaskCosntrol.vue'], resolve)
    },{
      path: 'drawSampling',
      name: 'drawSampling',
      component: resolve => require(['../components/drawSampling/drawSampling.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}
//         ]
//     }
//   ]
// })
