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: 'certificateTemplateMaintenance'
  },
  children: [
    {
      path: 'certificateTemplateMaintenance',
      name: 'certificateTemplateMaintenance',
      component: resolve => require(['../components/certificateTemplateMaintenance/certificateTemplateMaintenance.vue'], resolve)
    },
    {
      path: 'certificateSubitemConfiguration',
      name: 'certificateSubitemConfiguration',
      component: resolve => require(['../components/certificateSubitemConfiguration/certificateSubitemConfiguration.vue'], resolve)
    },
    {
      path: 'certificateOfTheMaterial',
      name: 'certificateOfTheMaterial',
      component: resolve => require(['../components/certificateOfTheMaterial/certificateOfTheMaterial.vue'], resolve)
    },
    {
      path: 'reportSheetGeneration',
      name: 'reportSheetGeneration',
      component: resolve => require(['../components/reportSheetGeneration/reportSheetGeneration.vue'], resolve)
    },
    {
      path: 'warrantyBooklets',
      name: 'warrantyBooklets',
      component: resolve => require(['../components/warrantyBooklets/warrantyBooklets.vue'], resolve)
    },
    {
      path: 'warrantyInquiry',
      name: 'warrantyInquiry',
      component: resolve => require(['../components/warrantyInquiry/warrantyInquiry.vue'], resolve)
    },
    {
      path: 'reportFormEnquiry',
      name: 'reportFormEnquiry',
      component: resolve => require(['../components/reportFormEnquiry/reportFormEnquiry.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}
//         ]
//     }
//   ]
// })
