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: 'moistureTest'
  },
  children: [
    {
      path: 'moistureTest',
      name: 'moistureTest',
      component: resolve => require(['../components/moistureTest'], resolve)
    },
    {
      path: 'allWeighted',
      name: 'allWeighted',
      component: resolve => require(['../components/allWeighted'], resolve)
    },
    //测试分析
    {
      path: 'testManagement',
      name: 'testManagement',
      component: resolve => require(['../components/testManagement/testManagement'], resolve)
    },
    { // 内审管理
      path: 'internalAuditManagement',
      name: 'internalAuditManagement',
      component: resolve => require(['../../standardManagement/components/internalAuditManagement/internalAuditManagement.vue'], resolve)
    },
    { // 消息推送配置
      path: 'messageConfiguration',
      name: 'messageConfiguration',
      component: resolve => require(['../components/messageConfiguration/messageConfiguration.vue'], resolve)
    },
    {
      path: 'weightManagement',
      name: 'weightManagement',
      component: resolve => require(['../components/weightManagement'], resolve)
    },
    {
      path: 'collectRecord',
      name: 'collectRecord',
      component: resolve => require(['../components/collectRecord'], resolve)
    },
    {
      path: 'oldCollectRecord',
      name: 'oldCollectRecord',
      component: resolve => require(['../components/oldCollectRecord'], resolve)
    },
    {
      path: 'messagePushConfiguration',
      name: 'messagePushConfiguration',
      component: resolve => require(['../components/messagePushConfiguration'], resolve)
    },
    {
      path: 'oldDataInfo',
      name: 'oldDataInfo',
      component: resolve => require(['../components/oldDataInfo'], resolve)
    },
    {
      path: 'fireAssaying',
      name: 'fireAssaying',
      component: resolve => require(['../components/fireAssaying'], resolve)
    },
    {
      path: 'fireAssayingAudit',
      name: 'fireAssayingAudit',
      component: resolve => require(['../components/fireAssayingAudit'], resolve)
    },
    {
      path: 'guixiWeighing',
      name: 'guixiWeighing',
      component: resolve => require(['../components/guixiWeighing'], 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}
//         ]
//     }
//   ]
// })
