|
|
import Vue from "vue";import VueRouter from "vue-router";// import HomeView from "../views/HomeView.vue";
import login from "@/views/login.vue"Vue.use(VueRouter);const routes = [ { path: "/", name: "login", component: login, }, { path: "/about", name: "about",
component: () => import("../views/AboutView.vue"), }, { path: "/login", name: "login",
component: () => import("../views/login.vue"), }, { path: "/hoem", name: "hoem",
component: () => import(/* webpackChunkName: "about" */ "../views/hoem.vue"), children: [ { path: "/my", name: "my", component: () => import('../views/my.vue') }, { path: '/userlist', name: 'userlist', component: () => import('../views/userlist.vue') }, { path: '/organization', name: 'organization', component: () => import('../views/organization.vue') }, { path: '/dailyrecord', name: 'dailyrecord', component: () => import('../views/dailyrecord.vue') }, { path: '/departmentset', name: 'departmentset', component: () => import('../views/departmentset.vue') }, { path: '/medicalexaminatitype', name: 'medicalexaminatitype', component: () => import('../components/medicalexaminatitype.vue') }, { path: '/gender', name: 'gender', component: () => import('../components/gender.vue') }, { path: '/maritalstatus', name: 'maritalstatus', component: () => import('../components/maritalstatus.vue') }, { path: '/nation', name: 'nation', component: () => import('../components/nation.vue') }, { path: '/nativeplace', name: 'nativeplace', component: () => import('../components/nativeplace.vue') }, { path: '/resultstatus', name: 'resultstatus', component: () => import('../components/resultstatus.vue') }, { path: '/examinationcategory', name: 'examinationcategory', component: () => import('../components/examinationcategory.vue') }, { path: '/personnelcategory', name: 'personnelcategory', component: () => import('../components/personnelcategory.vue') }, { path: '/instrument', name: 'instrument', component: () => import('../components/instrument.vue') }, { path: '/specimentype', name: 'specimentype', component: () => import('../components/specimentype.vue') }, { path: '/unit', name: 'unit', component: () => import('../components/unit.vue') }, { path: '/diagnosticsuffix', name: 'diagnosticsuffix', component: () => import('../components/diagnosticsuffix.vue') }, { path: '/physicalcategory', name: 'physicalcategory', component: () => import('../components/physicalcategory.vue') }, { path: '/medicalexamination', name: 'medicalexamination', component: () => import('../components/medicalexamination.vue') }, { path: '/sepecimencontainer', name: 'sepecimencontainer', component: () => import('../components/sepecimencontainer.vue') }, { path: '/commoncharacter', name: 'commoncharacter', component: () => import('../components/commoncharacter.vue') }, { path: '/commoncused', name: 'commoncused', component: () => import('../components/commoncused.vue') }, { path: '/customeersevice', name: 'customeersevice', component: () => import('../components/customeersevice.vue') }, { path: '/projectresults', name: 'projectresults', component: () => import('../components/projectresults.vue') }, { path: '/diagnosticleve', name: 'diagnosticleve', component: () => import('../components/diagnosticleve.vue') }, { path: '/invoicecategory', name: 'invoicecategory', component: () => import('../views/feesettings/invoicecategory.vue') }, { path: '/paymentmethod', name: 'paymentmethod', component: () => import('../views/feesettings/paymentmethod.vue') }, { path: '/itemtype', name: 'itemtype', component: () => import('../views/feesettings/itemtype.vue') }, { path: '/barcodegroupping', name: 'barcodegroupping', component: () => import('../views/feesettings/barcodegroupping.vue') }, { path: '/groupsandproject', name: 'groupsandproject', component: () => import('../views/feesettings/groupsandproject.vue') }, { path: '/projectitem', name: 'projectitem', component: () => import('../views/feesettings/projectitem.vue') }, { path: '/referencerange', name: 'referencerange', component: () => import('../views/feesettings/referencerange.vue') }, { path: '/diagnosis', name: 'diagnosis', component: () => import('../views/diagnosis.vue') }, { path: '/projectresulttemplate', name: 'projectresulttemplate', component: () => import('../views/feesettings/projectresulttemplate.vue') }, ] },];
const router = new VueRouter({ 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;
|