import Vue from "vue";
import Router from "vue-router";
import preview from "vue-photo-preview";
import "vue-photo-preview/dist/skin.css";
Vue.use(Router).use(preview);

/* Layout */
import Layout from "@/views/layout/Layout";

import role from "./modules/role";
import article from "./modules/article";
import member from "./modules/member";
import org from "./modules/org";
import marketing_tool from "./modules/marketing_tool";
import system from "./modules/system";
import site from "./modules/site";
import kefu from "./modules/kefu";

/** note: submenu only apppear when children.length>=1
 *   detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 **/

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length

// 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
is_menu: false               加载路由时验证用的(即该路由是否要在侧边栏展示，需要展示的即需要)，为 false 时表示该路由不需要进行权限验证

*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)

    // 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
    is_menu: false               加载路由时验证用的，为 false 时表示该路由不需要进行权限验证
    hidden: false                加载路由时验证用的，is_menu 为true时才有作用，为 true 时表示该路由需要进行权限验证
  }
**/
var _constant_router_map = [
  {
    path: "/token/verify",
    component: () => import("@/scrm_pages/index/verify_token"),
    hidden: true
  },
  {
    path: "/404",
    component: () => import("@/views/errorPage/404"),
    hidden: true
  },
  {
    path: "/401",
    component: () => import("@/views/errorPage/401"),
    hidden: true
  },

  // 启始页面
  {
    path: "/startpage",
    component: () => import("@/kpa_pages/index/index")
  },

  // 登录页面
  {
    path: "/login",
    component: () => import("@/kpa_pages/login/login")
  },
  // 已加入的团队
  {
    path: "/joinedGroup",
    component: () => import("@/kpa_pages/joinedGroup/index")
  },
  // 还没加入的团队
  {
    path: "/noJoinedGroup",
    component: () => import("@/kpa_pages/noJoinedGroup/index")
  },
  // 创建机构
  {
    path: "/createOrganization",
    component: () => import("@/kpa_pages/createOrganization/index")
  },
  // 首页
  {
    path: "/home",
    component: () => import("@/kpa_pages/home/index"),
    children: [
      {
        path: "/homeIndex",
        component: () => import("@/kpa_pages/homeIndex/index.vue")
      },
      {
        path: "/study",
        component: () => import("@/kpa_pages/study/index.vue")
      },
      {
        path: "/service",
        component: () => import("@/kpa_pages/service/index.vue")
      },
      {
        path: "/shop",
        component: () => import("@/kpa_pages/shop/index.vue")
      },
      {
        path: "/my",
        component: () => import("@/kpa_pages/my/index.vue")
      }
    ]
  },
  {
    path: "/search",
    component: () => import("@/kpa_pages/search/index")
  },
  // 注册页面
  {
    path: "/register",
    component: () => import("@/kpa_pages/register/register")
  },
  // 机构信息
  {
    path: "/orginfomation",
    component: () => import("@/kpa_pages/agecyInformation/index"),
    // eslint-disable-next-line no-irregular-whitespace
    children: [
      {
        // eslint-disable-next-line no-irregular-whitespace
        path: "/orginfomation/home",
        // eslint-disable-next-line no-irregular-whitespace
        component: () => import("@/kpa_pages/home/index")
      }
    ]
  },

  {
    path: "/forgetpassword",
    component: () => import("@/kpa_pages/forgetpassword/index")
  },
  {
    path: "/forgetpasswordnext",
    component: () => import("@/kpa_pages/forgetpassword/forget")
  },
  {
    path: "/nopassword",
    component: () => import("@/kpa_pages/nopassword/index")
  },
  {
    path: "/patientmanagement",
    component: () => import("@/kpa_pages/patientmanagement/index")
  },
  {
    path: "/addpatient",
    component: () => import("@/kpa_pages/addpatient/index")
  },
  {
    path: "/patientdetail",
    component: () => import("@/kpa_pages/patientDetail/index")
  },
  // 医嘱管理
  {
    path: "/doctoradvice",
    component: () => import("@/kpa_pages/doctorAdvice/index")
  },
  {
    path: "/",
    component: () => import("@/kpa_pages/index/index")
  },

  // 病程管理
  {
    path: "/coursemanagement",
    component: () => import("@/kpa_pages/courseManagement/index")
  },
  // 抢救记录
  {
    path: "/saverecord",
    component: () => import("@/kpa_pages/saveRecord/index")
  },
  // 检验检查
  {
    path: "/check",
    component: () => import("@/kpa_pages/check/index")
  },
  {
    path: "/allCheck",
    component: () => import("@/kpa_pages/allCheck/index")
  },

  // 血管通路

  // 长期处方
  {
    path: "/longDialysis",
    component: () => import("@/kpa_pages/longDialysis/index")
  },

  // 透析记录
  {
    path: "/dialysisrecord",
    component: () => import("@/kpa_pages/dialysisRecord/index")
  },

  // 耗材使用

  // 排班信息
  {
    path: "/scheduleInformation",
    component: () => import("@/kpa_pages/scheduleInformation")
  },

  // 宣教信息
  {
    path: "/missionInformation",
    component: () => import("@/kpa_pages/missionInformation/index")
  }
];

var _asy_router_map = [];

var is_asy_router = process.env.NODE_ENV === "production"; // true; 设置为 true 强制进行路由验证
if (!is_asy_router) {
  _constant_router_map = _constant_router_map.concat(_asy_router_map);
  _asy_router_map = [];
} else {
}

export const xt_constantRouterMap = _constant_router_map;
export const xt_asyncRouterMap = _asy_router_map;

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: xt_constantRouterMap
});
