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.

85 lines
2.5 KiB

import Vue from 'vue';
import VueRouter from 'vue-router';
import store from '../store';
import HomeView from '../views/HomeView.vue';
// import UserPosts from '../views/UserPosts.vue';
// import Franchise from '../views/Franchise.vue'
5 months ago
Vue.use(VueRouter)
const whiteSlideList = [ '/ui', '/hosInformation']; //侧边导航白名单
const whiteHeaderList = ['/','/doctorInformation', 'hosInformation'
]; //头部导航白名单
const whiteFooterList = ['/','/doctorInformation' ,'/hosInformation'
]; //底部白名单
const routes = [{
5 months ago
path: '/',
name: '首页',
component: HomeView,
// component: Franchise
5 months ago
},
{
path: '/doctorInformation',
component: () => import( /* webpackChunkName: "doctorInformation" */ '../views/DoctorInformation.vue'),
name: '医生信息',
children: [
]
},
{
path: '/hosInformation',
component: () => import( /* webpackChunkName: "hosInformation" */ '../views/HosInformation.vue'),
name: '医院信息',
children: [
]
},
{
path: '/addNewTreatment',
component: () => import( /* webpackChunkName: "addNewTreatment" */ '../views/AddNewTreatment.vue'),
name: '新增套餐',
children: [
]
},
{
path: '/ui',
name: 'ui组件',
component: () => import( /* webpackChunkName: "ui" */ '../views/elementGroups.vue')
},
{
path: '/super/ranking',
component: () => import( /* webpackChunkName: "Ranking" */ '../views/super/Ranking/Ranking.vue'),
children: [
{
path: 'checkProfit',
3 months ago
name: '产品毛利润排行',
component: () => import( /* webpackChunkName: "Ranking" */ '../views/super/Ranking/RankBatchList.vue'),
props: {pageTitle:'产品 - 毛利润排行', rank_type: 1, type: 'check_type'}
},
]
},
5 months ago
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
router.beforeEach((to, from, next) => {
console.log(to.path, 'to.path-----');
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 (whiteHeaderList.includes(to.path)) {
store.commit('SET_HEADER', true); // 登录页面不显示侧边栏
} else {
store.commit('SET_HEADER', false); // 其他页面显示侧边栏
}
next();
});
5 months ago
export default router