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: 'inspectionTaskRaw'
  },
  children: [
    {
      path: 'inspectionTaskRaw',
      name: 'inspectionTaskRaw',
      component: resolve => require(['../components/inspectionTaskRaw/inspectionTaskRaw.vue'], resolve)
    }, 
    {
      path: 'taskAllocationProduct',
      name: 'taskAllocationProduct',
      component: resolve => require(['../components/taskAllocationProduct/taskAllocationProduct.vue'], resolve)
    },
    {
      path: 'taskAllocationMaterial',
      name: 'taskAllocationMaterial',
      component: resolve => require(['../components/taskAllocationMaterial/taskAllocationMaterial.vue'], resolve)
    },
    {
      path: 'taskAllocationControl',
      name: 'taskAllocationControl',
      component: resolve => require(['../components/taskAllocationControl/taskAllocationControl.vue'], resolve)
    },
    {
      path: 'personnelScheduling',
      name: 'personnelScheduling',
      component: resolve => require(['../components/personnelScheduling/personnelScheduling.vue'], resolve)
    },
    {
      path: 'personnelOutside',
      name: 'personnelOutside',
      component: resolve => require(['../components/personnelOutside/personnelOutside.vue'], resolve)
    },
    {
      path: 'inspectionTaskFinished',
      name: 'inspectionTaskFinished',
      component: resolve => require(['../components/inspectionTaskFinished/inspectionTaskFinished.vue'], resolve)
    },
    {
      path: 'inspectionTaskControl',
      name: 'inspectionTaskControl',
      component: resolve => require(['../components/inspectionTaskControl/inspectionTaskControl.vue'], resolve)
    },
    {
      path: 'shifting',
      name: 'shifting',
      component: resolve => require(['../components/shifting/shifting.vue'], resolve)
    },
    {
      path: 'centerPersonnelScheduling',
      name: 'centerPersonnelScheduling',
      component: resolve => require(['../components/centerPersonnelScheduling/centerPersonnelScheduling.vue'], resolve)
    },
    {
      path: 'planReassignment',
      name: 'planReassignment',
      component: resolve => require(['../components/planReassignment/planReassignment.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}
//         ]
//     }
//   ]
// })
