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.
145 lines
5.1 KiB
145 lines
5.1 KiB
import Vue from 'vue'; |
|
import Router from 'vue-router'; |
|
|
|
Vue.use(Router); |
|
|
|
let router = new Router({ |
|
mode: 'hash', |
|
base: process.env.BASE_URL, |
|
routes: [ |
|
{ |
|
path: '/', |
|
redirect: '/login' |
|
}, |
|
{ |
|
path: '/', |
|
component: () => import('../views/Home.vue'), |
|
meta: { title: '自述文件' }, |
|
children: [ |
|
{ |
|
path: '/customer', |
|
component: () => import( '../views/customer/customer.vue'), |
|
// meta: { title: '客户管理' } |
|
}, |
|
{ |
|
path: '/addcustomer', |
|
component: () => import( '../views/customer/AddCustomer.vue'), |
|
// meta: { title: '新增客户' } |
|
}, |
|
{ |
|
path: '/user', |
|
component: () => import( '../views/user/User.vue'), |
|
// meta: { title: '用户管理' } |
|
}, |
|
{ |
|
path: '/adduser', |
|
component: () => import( '../views/user/AddUser.vue'), |
|
// meta: { title: '新增用户' } |
|
}, |
|
{ |
|
path: '/order', |
|
component: () => import( '../views/order/Order.vue'), |
|
// meta: { title: '订单管理' } |
|
}, |
|
{ |
|
path: '/addorder', |
|
component: () => import( '../views/order/AddOrder.vue'), |
|
// meta: { title: '新增订单' } |
|
}, |
|
{ |
|
path: '/selectClient', |
|
component: () => import( '../views/order/selectClient.vue'), |
|
// meta: { title: '选择订单客户' } |
|
}, |
|
|
|
{ |
|
path: '/configure', |
|
component: () => import( '../views/serve/Configure.vue'), |
|
// meta: { title: '服务配置' } |
|
}, |
|
{ |
|
path: '/addconfigure', |
|
component: () => import( '../views/serve/AddConfigure.vue'), |
|
// meta: { title: '新增配置' } |
|
}, |
|
{ |
|
path: '/projectList', |
|
component: () => import( '../views/serve/projectList.vue'), |
|
// meta: { title: '项目管理' } |
|
}, |
|
{ |
|
path: '/projectAdd', |
|
component: () => import( '../views/serve/projectAdd.vue'), |
|
// meta: { title: '项目配置' } |
|
}, |
|
{ |
|
path: '/curriculum', |
|
component: () => import( '../views/course/Curriculum.vue'), |
|
// meta: { title: '课程管理' } |
|
}, |
|
{ |
|
path: '/addcurriculum', |
|
component: () => import( '../views/course/AddCurriculum.vue'), |
|
// meta: { title: '新建课程' } |
|
}, |
|
{ |
|
path: '/contentSettings', |
|
component: () => import( '../views/course/courseconfig.vue'), |
|
// meta: { title: '内容设置' } |
|
}, |
|
{ |
|
path: '/addlink', |
|
component: () => import( '../views/course/AddLink.vue'), |
|
// meta: { title: '添加环节' } |
|
}, |
|
{ |
|
path: '/data', |
|
component: () => import( '../views/data/Data.vue'), |
|
// meta: { title: '数据管理' } |
|
}, |
|
{ |
|
path: '/permission', |
|
component: () => import('../views/customer/Permission.vue'), |
|
// meta: { title: '应用权限', permission: true } |
|
}, |
|
{ |
|
path: '/person', |
|
component: () => import('../views/setting/Person.vue'), |
|
// meta: { title: '个人中心' } |
|
}, |
|
{ |
|
path: '/404', |
|
component: () => import('../views/404.vue'), |
|
// meta: { title: '404' } |
|
}, |
|
{ |
|
path: '/403', |
|
component: () => import('../views/403.vue'), |
|
// meta: { title: '403' } |
|
} |
|
] |
|
}, |
|
{ |
|
path: '/login', |
|
component: () => import('../views/Login.vue'), |
|
meta: { title: '登录' } |
|
}, |
|
{ |
|
path: '*', |
|
redirect: '/404' |
|
} |
|
] |
|
}); |
|
|
|
router.beforeEach(function(to, from, next) { |
|
// 根据路由元信息设置文档标题 |
|
window.document.title = to.meta.title || '中台'; |
|
//使用钩子函数对路由进行权限跳转 |
|
if (!sessionStorage.getItem('token') && to.path !== '/login') { |
|
next('/login'); |
|
} else { |
|
next(); |
|
} |
|
}); |
|
|
|
export default router;
|
|
|