import Vue from "vue"; import VueRouter from "vue-router"; // import HomeView from "../views/HomeView.vue"; import login from "@/views/login/Login.vue"; Vue.use(VueRouter); // const originalpush = VueRouter.prototype.push // VueRouter.prototype.push = function (location) { // return originalpush.call(this, location).catch(err => err) // } const routes = [ { path: "/", component: login, }, { path: "/login", name: "login", component: () => import("../views/login/Login.vue"), }, { path: "/home", name: "home", component: () => import(/* webpackChunkName: "about" */ "../views/Home.vue"), children: [ { path: "/role", component: () => import("../views/user-list/Role.vue"), }, { path: "/user-list", component: () => import("../views/user-list/UserList.vue"), }, { path: "/organization-units", component: () => import("../views/user-list/OrganizationUnits.vue"), }, { path: "/audit-log", component: () => import("../views/user-list/AuditLog.vue"), }, { path: "/guide-type", component: () => import("../views/basic-dictionary/GuideType.vue"), }, { path: "/medical-report-type", component: () => import("../views/basic-dictionary/MedicalReportType.vue"), }, { path: "/sex", component: () => import("../views/basic-dictionary/Sex.vue"), }, { path: "/marital-status", component: () => import("../views/basic-dictionary/MaritalStatus.vue"), }, { path: "/nation", component: () => import("../views/basic-dictionary/Nation.vue"), }, { path: "/birth-place", component: () => import("../views/basic-dictionary/BirthPlace.vue"), }, { path: "/result-status", component: () => import("../views/basic-dictionary/ResultStatus.vue"), }, { path: "/medical-type", component: () => import("../views/basic-dictionary/MedicalType.vue"), }, { path: "/personnel-type", component: () => import("../views/basic-dictionary/PersonnelType.vue"), }, { path: "/device-type", component: () => import("../views/basic-dictionary/DeviceType.vue"), }, { path: "/sample-type", component: () => import("../views/basic-dictionary/SampleType.vue"), }, { path: "/unit", component: () => import("../views/basic-dictionary/Unit.vue"), }, { path: "/diagnosis-postfix", component: () => import("../views/basic-dictionary/DiagnosisPostfix.vue"), }, { path: "/medical-conclusion-type", component: () => import("../views/basic-dictionary/MedicalConclusionType.vue"), }, { path: "/medical-conclusion", component: () => import("../views/basic-dictionary/MedicalConclusion.vue"), }, { path: "/sample-container", component: () => import("../views/basic-dictionary/SampleContainer.vue"), }, { path: "/common-char-type", component: () => import("../views/basic-dictionary/CommonCharType.vue"), }, { path: "/common-char", component: () => import("../views/basic-dictionary/CommonChar.vue"), }, { path: "/customer-org-type", component: () => import("../views/basic-dictionary/CustomerOrgType.vue"), }, { path: "/item-default-result", component: () => import("../views/basic-dictionary/ItemDefaultResult.vue"), }, { path: "/diagnosis-level", component: () => import("../views/basic-dictionary/DiagnosisLevel.vue"), }, { path: "/invoice-item-type", component: () => import("../views/fee-settings/InvoiceItemType.vue"), }, { path: "/pay-mode", component: () => import("../views/fee-settings/PayMode.vue"), }, { path: "/item-type", component: () => import("../views/common-settings/ItemType.vue"), }, { path: "/sample-group", component: () => import("../views/common-settings/SampleGroup.vue"), }, { path: "/asbitem", component: () => import("../views/fee-settings/Asbitem.vue"), }, { path: "/item", component: () => import("../views/fee-settings/Item.vue"), }, { path: "/reference-range", component: () => import("../views/fee-settings/ReferenceRange.vue"), }, { path: "/diagnosis", component: () => import("../views/fee-settings/Diagnosis.vue"), hidden: true, // meta: { // title: '诊断', // menu // } meat: { title: "诊断", noCache: true, menus: ["diagosis:advertDemandRelease"], }, }, { path: "/item-result-template", component: () => import("../views/fee-settings/ItemResultTemplate.vue"), }, { path: "/item-result-match", component: () => import("../views/fee-settings/ItemResultMatch.vue"), }, { path: "/item-template", component: () => import("../views/fee-settings/ItemTemplate.vue"), }, { path: "/medical-package", component: () => import("../views/fee-settings/MedicalPackage.vue"), }, { path: "/sex-hormone-reference-range", component: () => import("../views/fee-settings/SexHormoneReferenceRange.vue"), }, { path: "/diagnosis-template", component: () => import("../views/fee-settings/DiagnosisTemplate.vue"), }, { path: "/sys-parm-type", component: () => import("../views/fee-settings/SysParmSet.vue"), //../views/fee-settings/SysParmType.vue }, //---------------------- 体检登记 start ---------------------- { path: "/customerOrg", name: "体检单位设置", component: () => import("../views/customerOrg/customerOrg.vue"), }, { path: "/customerOrgGroup", name: "单位分组设置", component: () => import("../views/customerOrg/customerOrgGroup.vue"), }, { path: "/patientRegister", name: "体检人员登记", component: () => import("../views/customerOrg/patientRegister.vue"), }, { path: "/patientRegisterSign", name: "体检人员签到", component: () => import("../views/customerOrg/patientRegisterSign.vue"), }, { path: "/patientRegisterRecover", name: "体检表回收", component: () => import("../views/customerOrg/patientRegisterRecover.vue"), }, { path: "/patientRegisterRefuse", name: "弃检登记", component: () => import("../views/customerOrg/patientRegisterRefuse.vue"), }, //---------------------- 体检登记 start ---------------------- //---------------------- 体 检 start ---------------------- { path: "/doctorCheck", name: "体检医生诊台", component: () => import("../views/doctorCheck/doctorCheck.vue"), }, { path: "/sumDoctorCheck", name: "总检医生诊台", component: () => import("../views/doctorCheck/sumDoctorCheck.vue"), }, { path: "/personnelBatch", name: "人员预约登记", component: () => import("../views/doctorCheck/personnelBatch.vue"), }, //---------------------- 体 检 end ---------------------- ], }, ]; const router = new VueRouter({ //mode: "history", //base: process.env.BASE_URL, routes, }); router.beforeEach((to, form, next) => { let token = localStorage.getItem("token"); let tokentype = localStorage.getItem("tokentype"); if (to.path === "/login") { if (token != null) { next({ path: "/", }); } else { next(); } } else { if (token == null) { next({ path: "/login", }); } else { next(); } } }); export default router;