import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    redirect: "/main",
    component: () => import("../views/main.vue"),

    children: [

      {
        path: "/main",
        name: "Main",
        component: () => import("../components/main/index.vue"),
        // component: resolve => require(['../components/main/index.vue'],resolve)
      },
      {
        path: "/list",
        name: "JobList",
        component: () => import("../components/FirstJob/joblist.vue"),
        // component: resolve => require(['../components/FirstJob/joblist.vue'],resolve)
      },
      {
        path: "/list1",
        name: "JobList",
        component: () => import("../components/FirstJob/joblist1.vue"),
      },
      {
        path: "/detail",
        name: "Detail",
        component: () => import("../components/FirstJob/detail.vue"),
      },
      // {
      //   path: "/serviceoutlets",
      //   name: "serviceoutlets",
      //   // route level code-splitting
      //   // this generates a separate chunk (about.[hash].js) for this route
      //   // which is lazy-loaded when the route is visited.
      //   component: () => import("../components/ServiceOutlets/index.vue"),
      // },
      {
        path: "/aboutus",
        name: "aboutus",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import("../components/AboutUs/index.vue"),
      },
      {
        path: "/recordbill",
        name: "recordbill",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import("../components/FirstJob/recordBill.vue"),
      },
      {
        path: "/recordsuccess",
        name: "recordsuccess",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import("../components/FirstJob/components/recordSuccess.vue"),
      },
      {
        path: "/login",
        name: "login",
        // component: () => import("../components/Login/login.vue"),
        component: () => import("../views/login.vue"),
        // redirect: "/login",

        children: [
          {
            path: "/login",
            name: "login",
            component: () => import("../components/Login/login.vue"),
          },
          {
            path: "/updatepsw",
            name: "updatepsw",
            component: () => import("../components/Login/updatepsw.vue"),
          },
          // {
          //   path: "/register",
          //   name: "register",
          //   component: () => import("../components/Login/register.vue"),
          // },
        ],
      },
      {
        path: "mytownsman",
        name: "mytownsman",
        component: () =>
          import("../components/userinfo/usercenter/components/townsman.vue"),
      },
      {
        path: "dataStatistics",
        name: "dataStatistics",
        component: () =>
          import("../components/userinfo/usercenter/components/dataStatistics.vue"),
      },
      {
        path: "mybill",
        name: "mybill",
        component: () =>
          import("../components/userinfo/usercenter/components/mybill.vue"),
        // component: resolve => require(['../components/userinfo/usercenter/components/mybill.vue'],resolve)
      },
      {
        path: "merchantManagement",
        name: "merchantManagement",
        component: () => import("../components/merchantManagement/index.vue"),
        redirect: "merchantManagement/memberInfo",

        children: [
          {
            path: "memberInfo",
            name: "memberinfo",
            component: () => import("../components/merchantManagement/memberInfo.vue"),
          },
          {
            path: "bocaiTV",
            name: "bocaiTV",
            component: () => import(
              "../components/userinfo/accountsetting/components/bocaiTV.vue"
            ),
          },
          {
            path: "dataScreen",
            name: "dataScreen",
            component: () => import("../components/merchantManagement/dataScreen.vue"),
          },
        ]
      },

      {
        path: "accountsetting",
        name: "accountsetting",
        component: () => import("../components/userinfo/accountsetting/inedex.vue"),
        redirect: "accountsetting/boundtel",
        children: [
          {
            path: "loginpsw",
            name: "loginpsw",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/loginpsw.vue"
              ),
          },
          {
            path: "boundtel",
            name: "boundtel",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/boundtel.vue"
              ),
          },
          {
            path: "boundwx",
            name: "boundwx",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/boundwx.vue"
              ),
          },
          {
            path: "boundbankcard",
            name: "boundbankcard",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/boundbankcard.vue"
              ),
          },
          {
            path: "realname",
            name: "realname",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/realname.vue"
              ),
          },
          {
            path: "myintegral",
            name: "myintegral",
            component: () =>
              import(
                "../components/userinfo/usercenter/components/myintegral.vue"
              ),
          },
          {
            path: "mycard",
            name: "mycard",
            component: () =>
              import("../components/userinfo/usercenter/components/mycard.vue"),
          },
          {
            path: "mybalance",
            name: "mybalance",
            component: () =>
              import(
                "../components/userinfo/usercenter/components/mybalance.vue"
              ),
          },
          {
            path: "bocaiTV",
            name: "bocaiTV",
            component: () =>
              import(
                "../components/userinfo/accountsetting/components/bocaiTV.vue"
              ),
          },
        ],
      },
    ],
  },
  {
    path: "/largeScreen",
    name: "largeScreen",
    component: () => import("../components/screen/largeScreen.vue"),
    // component: resolve => require(['../components/FirstJob/joblist.vue'],resolve)
  },
  {
    path: "/userinfo",
    name: "userinfo",
    component: () => import("../views/userinfo.vue"),
    redirect: "usercenter",
    children: [
      {
        path: "usercenter",
        name: "usercenter",
        component: () => import("../components/userinfo/usercenter/index.vue"),
        redirect: "usercenter/myintegral",
        children: [
          // {
          //   path: "townsman",
          //   name: "townsman",
          //   component: () =>
          //     import(
          //       "../components/userinfo/usercenter/components/townsman.vue"
          //     ),
          // },
          // {
          //   path: "mybill",
          //   name: "mybill",
          //   component: () =>
          //     import("../components/userinfo/usercenter/components/mybill.vue"),
          // },
          {
            path: "myintegral",
            name: "myintegral",
            component: () =>
              import(
                "../components/userinfo/usercenter/components/myintegral.vue"
              ),
          },
          {
            path: "mycard",
            name: "mycard",
            component: () =>
              import("../components/userinfo/usercenter/components/mycard.vue"),
          },
          {
            path: "mybalance",
            name: "mybalance",
            component: () =>
              import(
                "../components/userinfo/usercenter/components/mybalance.vue"
              ),
          },
        ],
      },

      {
        path: "mytownsman",
        name: "mytownsman",
        component: () =>
          import("../components/userinfo/usercenter/components/townsman.vue"),
      },
      {
        path: "mybill",
        name: "mybill",
        component: () =>
          import("../components/userinfo/usercenter/components/mybill.vue"),
      },
    ], 
  },
  {
    path: "/merchantBack",
    name: "merchantBack",
    redirect: "merchantBack/homePage",

    component: () => import("../views/merchantBack.vue"),
    children: [
      {
        path: "memberInfo",
        name: "MemberInfo",
        component: () => import("../components/merchantManagement/memberInfo.vue"),
      },
      {
        path: "dataStatistics",
        name: "DataStatistics",
        component: () => import("../components/userinfo/usercenter/components/dataStatistics.vue"),
      },
      {
        path: "bocaiTV",
        name: "BocaiTV",
        component: () => import(
          "../components/userinfo/accountsetting/components/bocaiTV.vue"
        ),
      },
      // 数据大屏
      {
        path: "dataScreen",
        name: "DataScreen",
        component: () => import("../components/merchantManagement/dataScreen.vue"),
      },
      // 角色管理
      {
        path: "roleManagement",
        name: "RoleManagement",
        component: () => import("../components/merchantManagement/roleManagement.vue"),
      },
      // 工作台
      {
        path: "workBench",
        name: "WorkBench",
        component: () => import("../components/merchantManagement/workBench.vue"),
      },
      // 通知中心
      {
        path: "notificationCenter",
        name: "NotificationCenter",
        component: () => import("../components/merchantManagement/notificationCenter.vue"),
      },
      // 后台首页
      {
        path: "homePage",
        name: "HomePage",
        component: () => import("../components/merchantManagement/homePage.vue"),
      },
      // 职位列表
      {
        path: "jobList",
        name: "TheJobList",
        component: () => import("../components/merchantManagement/jobList.vue"),
      },
      // 佣金配置
      {
        path: "brokerageConfig",
        name: "BrokerageConfig",
        component: () => import("../components/merchantManagement/brokerageConfig.vue"),
      },
      // 老乡列表
      {
        path: "townsmanList",
        name: "TownsmanList",
        component: () => import("../components/merchantManagement/townsmanList.vue"),
      },
      // 代理列表
      {
        path: "agencyList",
        name: "AgencyList",
        component: () => import("../components/merchantManagement/agencyList.vue"),
      },
      // 通讯录
      {
        path: "infoList",
        name: "InfoList",
        component: () => import("../components/merchantManagement/infoList.vue"),
      },
      // 工单列表
      {
        path: "orderList",
        name: "OrderList",
        component: () => import("../components/merchantManagement/orderList.vue"),
      },
      // 我的账单
      {
        path: "mineBill",
        name: "MineBill",
        component: () => import("../components/merchantManagement/mineBill.vue"),
      },
      // 企微配置
      {
        path: "qiwei",
        name: "Qiwei",
        component: () => import("../components/merchantManagement/qiwei.vue"),
      },
      // 导航配置
      {
        path: "navigationConfig",
        name: "NavigationConfig",
        component: () => import("../components/merchantManagement/navigationConfig.vue"),
      },
      // 企业信息
      {
        path: "firmInfo",
        name: "FirmInfo",
        component: () => import("../components/merchantManagement/firmInfo.vue"),
      },
      // 服务市场
      {
        path: "serviceMarket",
        name: "ServiceMarket",
        component: () => import("../components/merchantManagement/serviceMarket.vue"),
      },
    ]
  },
  {
    path: "*",
    name: "404",
    component: () => import("../views/404.vue"),
  },
  // {
  //   path: "/login",
  //   name: "Loginpage",
  //   component: () => import("../views/login.vue"),
  //   redirect: "/login",
  //   children: [
  //     {
  //       path: "/register",
  //       name: "register",
  //       component: () => import("../components/Login/register.vue"),
  //     },
  //   ],
  // },
];

const router = new VueRouter({
  routes,
});

export default router;
