travel/admin/src/router/index.js

282 lines
5.9 KiB
JavaScript
Raw Normal View History

2024-06-24 11:52:30 +08:00
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect/index')
}
]
},
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/auth-redirect',
component: () => import('@/views/login/auth-redirect'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error-page/404'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error-page/401'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
meta: { title: '系统面板', icon: 'dashboard', affix: true }
}
]
}
]
/**
* asyncRoutes
* the routes that need to be dynamically loaded based on user roles
*/
export const asyncRoutes = [
{
path: '/system',
component: Layout,
redirect: '/system',
alwaysShow: true,
name: 'System',
meta: {
title: '系统管理',
icon: 'el-icon-s-home',
roles: ['admin']
},
children: [
{
path: 'admin',
component: () => import('@/views/admin/index'),
name: 'Admin',
meta: {
title: '管理员',
roles: ['admin']
}
},
{
path: 'works',
component: () => import('@/views/admin/works'),
name: 'Works',
meta: {
title: '排班表',
roles: ['admin']
}
},
{
path: 'onlines',
component: () => import('@/views/onlines/online.vue'),
name: 'onlines',
meta: {
title: '客服在线列表',
roles: ['admin']
}
2024-06-24 20:58:23 +08:00
}/*,
2024-06-24 11:52:30 +08:00
{
path: 'shortcut',
component: () => import('@/views/shortcut/shortcutContent.vue'),
name: 'shortcut',
meta: {
title: '快捷内容设置',
roles: ['admin']
}
2024-06-24 20:58:23 +08:00
},
2024-06-24 11:52:30 +08:00
{
path: 'teams',
component: () => import('@/views/admin/teams'),
name: 'Teams',
meta: {
title: '团队',
roles: ['admin']
}
}*/
]
},
{
path: '/order',
component: Layout,
redirect: '/order/index',
alwaysShow: true,
name: 'Orders',
meta: {
title: '订单管理',
icon: 'money',
2024-06-24 20:58:23 +08:00
roles: ['order_index', 'editor']
2024-06-24 11:52:30 +08:00
},
children: [
{
path: 'index',
component: () => import('@/views/order/index'),
name: 'OrderList',
meta: {
title: '订单列表',
2024-06-24 20:58:23 +08:00
roles: ['order_pub', 'editor']
2024-06-24 11:52:30 +08:00
}
},
/* {
path: 'pub',
component: () => import('@/views/order/pub'),
name: 'OrderPub',
meta: {
title: '公海订单',
roles: ['order_pub','editor']
}
},*/
{
path: 'back',
component: () => import('@/views/order/back'),
name: 'OrderBack',
meta: {
title: '流转订单',
2024-06-24 20:58:23 +08:00
roles: ['order_back', 'editor']
2024-06-24 11:52:30 +08:00
}
}
]
},
{
path: '/log',
component: Layout,
redirect: '/log/index',
alwaysShow: true,
name: 'Log',
meta: {
title: '日志记录',
icon: 'nested',
2024-06-24 20:58:23 +08:00
roles: ['follow_index', 'log_index', 'editor']
2024-06-24 11:52:30 +08:00
},
children: [
{
path: 'follow',
component: () => import('@/views/log/follow'),
name: 'Follow',
meta: {
title: '跟进记录',
2024-06-24 20:58:23 +08:00
roles: ['follow_index', 'editor']
2024-06-24 11:52:30 +08:00
}
},
{
path: 'index',
component: () => import('@/views/log/index'),
name: 'LogIndex',
meta: {
title: '日志记录',
roles: ['log_index']
}
}
]
},
{
path: '/data',
component: Layout,
redirect: '/data/index',
alwaysShow: true,
name: 'Data',
meta: {
title: '数据统计',
icon: 'chart',
roles: ['data_index']
},
children: [
{
path: 'index',
component: () => import('@/views/data/index'),
name: 'Index',
meta: {
title: '跟进统计',
roles: ['data_index']
}
},
2024-06-24 20:58:23 +08:00
/* {
2024-06-24 11:52:30 +08:00
path: 'online',
component: () => import('@/views/data/online'),
name: 'Index',
meta: {
title: '在线时长',
roles: ['data_online']
}
},
{
path: 'anchor',
component: () => import('@/views/data/anchor'),
name: 'Anchor',
meta: {
title: '主播概况',
roles: ['data_anchor']
}
2024-06-24 20:58:23 +08:00
},*/
2024-06-24 11:52:30 +08:00
{
path: 'sale',
component: () => import('@/views/data/sale'),
name: 'Sale',
meta: {
title: '销售统计',
roles: ['data_sale']
}
}
]
},
{
path: '/icon',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/icons/index'),
name: 'Icons',
meta: { title: 'Icons', icon: 'icon', noCache: true }
}
]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router