import { createRouter, createWebHashHistory } from 'vue-router' import Login from '../views/Login.vue' import Index from '../views/Index.vue' import MenuList from '../views/SystemMngr/Menu/List.vue' import AdminGroupList from '../views/SystemMngr/Group/List.vue' import AdminUserList from '../views/SystemMngr/User/List.vue' import AdminChangPwd from '../views/SystemMngr/User/ChangPwd.vue' import HealthCalendar from '../views/AppointmentMngr/HealthCalendar.vue' import Dashboard from '../views/MedicalCenter/Dashboard.vue' const router = createRouter({ history: createWebHashHistory(import.meta.env.BASE_URL), routes: [{ path: '/', name: 'Login1', component: Login, meta: { requiresAuth: false } }, { path: '/login', name: 'Login', component: Login, meta: { requiresAuth: false } }, { path: '/index', name: 'Index', component: Index, children: [{ path: '/dashboard', name: 'Dashboard', component: Dashboard, meta: { title: '数据面板' } }, { path: '/menuList', name: 'menuList', component: MenuList, meta: { title: '菜单管理' } }, { path: '/groupMngr', name: 'AdminGroupList', component: AdminGroupList, meta: { title: '组管理' } }, { path: '/adminUserList', name: 'AdminUserList', component: AdminUserList, meta: { title: '系统用户管理' } }, { path: '/adminChangPwd', name: 'AdminChangPwd', component: AdminChangPwd, meta: { title: '用户中心' } },{ path: '/systemMngr/systemConfig', name: 'SystemMngrSystemConfig', component: () => import('../views/SystemMngr/SystemConfig.vue'), meta: { title: '系统参数设置' } }, { path: '/healthCalendar', name: 'HealthCalendar', component: HealthCalendar, meta: { title: '体检日历' } }, { path: '/yewu/mainList', name: 'YewuManiList', component: () => import('../views/YeWu/MainList.vue'), meta: { title: '主工作列表' } }, { path: '/yewu/CheckItemConfig', name: 'YewuCheckItemConfig', component: () => import('../views/YeWu/CheckItemConfig.vue'), meta: { title: '检查项目设置' } },{ path: '/systemMngr/systemLog', name: 'SystemMngrsystemLog', component: () => import('../views/SystemMngr/SystemLog.vue'), meta: { title: '系统日志' } },{ path: '/planMngr/plantype', name: 'PlanMngrPlantype', component: () => import('../views/PlanMngr/PlanType.vue'), meta: { title: '号源类型' } },{ path: '/planMngr/planmodel', name: 'PlanMngrPlanModel', component: () => import('../views/PlanMngr/PlanModel.vue'), meta: { title: '号源模板' } },{ path: '/planMngr/plan', name: 'PlanMngrPlan', component: () => import('../views/PlanMngr/Plan.vue'), meta: { title: '号源明细' } },{ path: '/comboMngr/combo', name: 'ComboMngrCombo', component: () => import('../views/ComboMngr/Combo.vue'), meta: { title: '套餐管理' } },{ path: '/hospitalMngr/hospital', name: 'HospitalMngrHospital', component: () => import('../views/HospitalMngr/Hospital.vue'), meta: { title: '医院管理' } },{ path: '/hospitalMngr/1uestions', name: 'HospitalMngrQuestions', component: () => import('../views/HospitalMngr/Questions.vue'), meta: { title: '问答管理' } },{ path: '/orderMngr/order', name: 'OrderMngrOrder', component: () => import('../views/OrderMngr/Order.vue'), meta: { title: '订单列表' } },{ path: '/H5Mngr/articlesmngr', name: 'H5MngrArticlesMngr', component: () => import('../views/H5Mngr/ArticlesMngr.vue'), meta: { title: '文章管理' } },{ path: '/Question/Question', name: 'Question', component: () => import('../views/Question/Question.vue'), meta: { title: '问卷管理' } },{ path: '/Question/Question', name: 'Question', component: () => import('../views/Question/Question.vue'), meta: { title: '问卷管理' } },{ path: '/Question/QuestionQuestion', name: 'QuestionQuestion', component: () => import('../views/Question/QuestionQuestion.vue'), meta: { title: '问卷题库' } },{ path: '/Question/QuestionItem', name: 'QuestionItem', component: () => import('../views/Question/QuestionItem.vue'), meta: { title: '问卷项目' } },{ path: '/Question/QuestionList', name: 'QuestionList', component: () => import('../views/Question/QuestionList.vue'), meta: { title: '健康问卷' } },{ path: '/comboMngr/crowd', name: 'ComboMngrCrowd', component: () => import('../views/ComboMngr/Crowd.vue'), meta: { title: '套餐适用人群' } },{ path: '/h5mngr/analysistypes', name: 'H5MngrAnalysisTypes', component: () => import('../views/H5Mngr/AnalysisTypes.vue'), meta: { title: '趋势分析项目' } },{ path: '/combomngr/type', name: 'ComboMngrType', component: () => import('../views/ComboMngr/Type.vue'), meta: { title: '套餐类型' } },{ path: '/orderMngr/yuyueorder', name: 'OrderMngrYuYueOrder', component: () => import('../views/OrderMngr/OrderYuYue.vue'), meta: { title: '预约订单' } },{ path: '/CouponsMngr/Coupons', name: 'CouponsMngrCoupons', component: () => import('../views/CouponsMngr/Coupons.vue'), meta: { title: '代金券管理' } }] }, ] }) import { CheckMenuAuth } from "@/api/api.js"; import { ElMessage } from 'element-plus' router.beforeEach((to, from, next) => { console.log(to.meta.requiresAuth) const url = to.path if (to.meta.requiresAuth == false) { next() } else { const NewUrl = url.substring(1) CheckMenuAuth({ url: NewUrl }).then(res => { if (res.status) { next(); } else { ElMessage.error(res.msg) next('/'); } }) } }) export default router