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: "secondApprove",
    },
    children: [
      {
        path: "secondApprove/",
        name: "secondApprove",
        component: (resolve) =>
          require(["../components/secondApprove"], resolve),
      },
      {
        path: "threeApprove/",
        name: "threeApprove",
        component: (resolve) =>
          require(["../components/threeApprove"], resolve),
      },
      {
        path: "fourApprove/",
        name: "fourApprove",
        component: (resolve) => require(["../components/fourApprove"], resolve),
      },
      {
        path: "fiveApprove/",
        name: "fiveApprove",
        component: (resolve) => require(["../components/fiveApprove"], resolve),
      },
      {
        path: "batchApprove",
        name: "batchApprove",
        component: (resolve) =>
          require(["../components/batchApprove"], resolve),
      },
      {
        path: "batchModifyApprove",
        name: "batchModifyApprove",
        component: (resolve) =>
          require(["../components/batchModifyApprove"], resolve),
      },
      {
        path: "sixApprove",
        name: "sixApprove",
        component: (resolve) => require(["../components/sixApprove"], resolve),
      },
      {
        path: "notificationConfig",
        name: "notificationConfig",
        component: (resolve) =>
          require(["../components/notificationConfig"], resolve),
      },
      {
        path: "approveOperationLogManagement",
        name: "approveOperationLogManagement",
        component: (resolve) =>
          require(["../components/approveOperationLogManagement"], resolve),
      },
      {
        path: "telegraphRes",
        name: "telegraphRes",
        component: (resolve) =>
          require(["../components/telegraphRes"], 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}
//         ]
//     }
//   ]
// })
