You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.8 KiB
97 lines
2.8 KiB
import Vue from 'vue';
|
|
import VueRouter from 'vue-router';
|
|
import store from '../store';
|
|
import HomeView from '../views/HomeView.vue';
|
|
|
|
Vue.use(VueRouter)
|
|
const whiteSlideList = [ '/ui', '/hosInformation']; //侧边导航白名单
|
|
const blackHeaderList = ['/ErrorAccess']; //头部导航黑名单
|
|
const whiteFooterList = ['/','/doctorInformation' ,'/hosInformation','/addNewTreatment']; //底部白名单
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: '首页',
|
|
component: HomeView,
|
|
meta: {
|
|
title: '医生列表',
|
|
hideBreadcrumb: true // 首页不显示面包屑
|
|
}
|
|
},
|
|
{
|
|
path: '/doctorInformation',
|
|
name: '医生信息',
|
|
component: () => import('../views/DoctorInformation.vue'),
|
|
meta: {
|
|
title: '编辑信息',
|
|
breadcrumbParent: '首页' // 手动指定父级
|
|
}
|
|
},
|
|
{
|
|
path: '/ErrorAccess',
|
|
name: '访问出错',
|
|
component: () => import('../views/ErrorAccess.vue'),
|
|
meta: {
|
|
title: '访问出错',
|
|
hideBreadcrumb: true // 首页不显示面包屑
|
|
}
|
|
},
|
|
{
|
|
path: '/hosInformation',
|
|
name: '医院信息',
|
|
component: () => import('../views/HosInformation.vue'),
|
|
meta: {
|
|
title: '编辑医院',
|
|
breadcrumbParent: '医生信息' // 手动指定父级
|
|
// r如果想隐藏中间层级
|
|
// breadcrumbParent: '首页', // 跳过医生信息
|
|
// hideInBreadcrumb: true // 可选:隐藏当前项
|
|
}
|
|
},
|
|
{
|
|
path: '/weChatPayment',
|
|
name: '微信收款',
|
|
component: () => import('../views/weChatPayment.vue'),
|
|
meta: {
|
|
title: '微信收款',
|
|
breadcrumbParent: '编辑医院' // 手动指定父级
|
|
// r如果想隐藏中间层级
|
|
// breadcrumbParent: '首页', // 跳过医生信息
|
|
// hideInBreadcrumb: true // 可选:隐藏当前项
|
|
}
|
|
},
|
|
|
|
{
|
|
path: '/addNewTreatment',
|
|
component: () => import( /* webpackChunkName: "addNewTreatment" */ '../views/AddNewTreatment.vue'),
|
|
name: '新增套餐',
|
|
meta: {
|
|
hideBreadcrumb: true // 首页不显示面包屑
|
|
}
|
|
}
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
mode: 'history',
|
|
base: process.env.BASE_URL,
|
|
routes
|
|
})
|
|
router.beforeEach((to, from, next) => {
|
|
if (whiteSlideList.includes(to.path)) {
|
|
store.commit('SET_SIDEBAR', true); // 登录页面不显示侧边栏
|
|
} else {
|
|
store.commit('SET_SIDEBAR', false); // 其他页面显示侧边栏
|
|
}
|
|
if (whiteFooterList.includes(to.path)) {
|
|
store.commit('SET_FOOTER', true); // 登录页面不显示底部信息
|
|
} else {
|
|
store.commit('SET_FOOTER', false); // 其他页面显示底部信息
|
|
}
|
|
if (blackHeaderList.includes(to.path)) {
|
|
store.commit('SET_HEADER', false); // 登录页面不显示顶部
|
|
} else {
|
|
store.commit('SET_HEADER', true); // 其他页面显示顶部
|
|
}
|
|
next();
|
|
});
|
|
|
|
export default router
|