travel/admin/src/router/index.js

437 lines
9.7 KiB
JavaScript
Raw Normal View History

2024-10-21 19:21:39 +08:00
import Vue from "vue";
import Router from "vue-router";
2024-06-24 11:52:30 +08:00
2024-10-21 19:21:39 +08:00
Vue.use(Router);
2024-06-24 11:52:30 +08:00
/* Layout */
2024-10-21 19:21:39 +08:00
import Layout from "@/layout";
2024-06-24 11:52:30 +08:00
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
2024-10-21 19:21:39 +08:00
path: "/redirect",
2024-06-24 11:52:30 +08:00
component: Layout,
hidden: true,
children: [
{
2024-10-21 19:21:39 +08:00
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect/index"),
},
],
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/login",
component: () => import("@/views/login/index"),
hidden: true,
2024-06-24 11:52:30 +08:00
},
2024-07-15 15:18:47 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/home",
component: () => import("@/views/home/index"),
hidden: true,
2024-07-15 15:18:47 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/line_on_sale",
component: () => import("@/views/home/line_on_sale"),
hidden: true,
2024-07-15 15:18:47 +08:00
},
2024-06-24 11:52:30 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/auth-redirect",
component: () => import("@/views/login/auth-redirect"),
hidden: true,
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/404",
component: () => import("@/views/error-page/404"),
hidden: true,
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/401",
component: () => import("@/views/error-page/401"),
hidden: true,
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/",
2024-06-24 11:52:30 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/dashboard",
2024-06-24 11:52:30 +08:00
children: [
{
2024-10-21 19:21:39 +08:00
path: "dashboard",
component: () => import("@/views/dashboard/index"),
name: "Dashboard",
meta: { title: "系统面板", icon: "dashboard", affix: true },
},
],
},
];
2024-06-24 11:52:30 +08:00
/**
* asyncRoutes
* the routes that need to be dynamically loaded based on user roles
*/
export const asyncRoutes = [
{
2024-10-21 19:21:39 +08:00
path: "/system",
2024-06-24 11:52:30 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/system",
2024-06-24 11:52:30 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "System",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "系统管理",
icon: "el-icon-s-home",
2024-12-03 18:25:46 +08:00
roles: ["admin", "franchisee"],
2024-06-24 11:52:30 +08:00
},
children: [
{
2024-10-21 19:21:39 +08:00
path: "admin",
component: () => import("@/views/admin/index"),
name: "Admin",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "管理员",
2024-12-03 18:25:46 +08:00
roles: ["admin", "franchisee"],
2024-10-21 19:21:39 +08:00
},
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "works",
component: () => import("@/views/admin/works"),
name: "Works",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "排班表",
roles: ["admin"],
},
2024-06-24 11:52:30 +08:00
},
2024-09-19 18:16:35 +08:00
{
2024-10-21 19:21:39 +08:00
path: "scheduling",
component: () => import("@/views/scheduling/index"),
name: "scheduling",
2024-09-19 18:16:35 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "直播排班",
roles: ["admin"],
},
2024-09-19 18:16:35 +08:00
},
2024-06-24 11:52:30 +08:00
{
2024-10-21 19:21:39 +08:00
path: "onlines",
component: () => import("@/views/onlines/online.vue"),
name: "onlines",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "在线客服",
roles: ["admin"],
},
},
{
path: "proManagement",
component: () => import("@/views/proManagement/index"),
name: "ProManagement",
meta: {
title: "商品管理",
roles: ["admin"],
},
},
{
path: "contract",
component: () => import("@/views/proManagement/contract"),
name: "ProManagementContract",
meta: {
title: "合同管理",
roles: ["admin"],
},
},
{
path: "proScheduling",
component: () => import("@/views/proManagement/scheduling"),
name: "ProScheduling",
meta: {
2024-10-22 17:42:17 +08:00
title: "班期管理",
2024-10-21 19:21:39 +08:00
roles: ["admin"],
hidden: true,
},
},
/*,
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']
}
}*/
2024-10-21 19:21:39 +08:00
],
2024-06-24 11:52:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "/order",
2024-06-24 11:52:30 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/order/index",
2024-06-24 11:52:30 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "Orders",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "订单管理",
icon: "money",
2024-12-03 18:25:46 +08:00
roles: ["order_index", "editor", "franchisee"],
2024-06-24 11:52:30 +08:00
},
children: [
{
2024-10-21 19:21:39 +08:00
path: "index",
component: () => import("@/views/order/index"),
name: "OrderList",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "订单列表",
2024-12-03 18:25:46 +08:00
roles: ["order_pub", "editor", "franchisee"],
2024-10-21 19:21:39 +08:00
},
2024-06-24 11:52:30 +08:00
},
/* {
path: 'pub',
component: () => import('@/views/order/pub'),
name: 'OrderPub',
meta: {
title: '公海订单',
roles: ['order_pub','editor']
}
},*/
{
2024-10-21 19:21:39 +08:00
path: "back",
component: () => import("@/views/order/back"),
name: "OrderBack",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "流转订单",
roles: ["order_back", "editor"],
},
2024-06-25 14:40:30 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "abandoned",
component: () => import("@/views/order/abandoned"),
name: "OrderBack",
2024-06-25 14:40:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "已放弃订单",
roles: ["order_back", "editor"],
},
2024-06-28 17:30:56 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "used",
component: () => import("@/views/order/used"),
name: "OrderBack",
2024-06-28 17:30:56 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "已使用订单",
roles: ["order_back", "editor"],
},
2024-06-25 14:40:30 +08:00
},
2024-10-13 17:01:24 +08:00
{
2024-10-21 19:21:39 +08:00
path: "refunded",
component: () => import("@/views/order/refunded"),
name: "OrderBack",
2024-10-13 17:01:24 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "已退款订单",
2024-12-03 18:25:46 +08:00
roles: ["order_back", "editor", "franchisee"],
2024-10-21 19:21:39 +08:00
},
2024-10-13 17:01:24 +08:00
},
2024-10-21 11:07:09 +08:00
{
2024-10-21 19:21:39 +08:00
path: "appointment",
component: () => import("@/views/order/appointment"),
name: "appointment",
2024-10-21 11:07:09 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "预约记录",
roles: ["order_back", "editor"],
},
2024-10-21 11:07:09 +08:00
},
2024-10-21 19:21:39 +08:00
],
2024-06-24 11:52:30 +08:00
},
2024-06-27 17:34:53 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/qa",
2024-06-27 17:34:53 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/qa/qa",
2024-06-27 17:34:53 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "Qa",
2024-06-27 17:34:53 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "QA管理",
icon: "el-icon-question",
roles: ["order_index", "editor", "franchisee"],
2024-06-27 17:34:53 +08:00
},
children: [
2024-06-27 18:57:13 +08:00
{
2024-10-21 19:21:39 +08:00
path: "problem",
component: () => import("@/views/qa/problem.vue"),
name: "problem",
2024-06-27 18:57:13 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "QA常见问题",
roles: ["order_pub", "editor", "franchisee"],
},
2024-06-27 18:57:13 +08:00
},
2024-06-27 17:34:53 +08:00
{
2024-10-21 19:21:39 +08:00
path: "qa",
component: () => import("@/views/qa/qa.vue"),
name: "qa",
2024-06-27 17:34:53 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "QA管理列表",
roles: ["admin"],
},
2024-06-27 17:34:53 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "city",
component: () => import("@/views/qa/city.vue"),
name: "city",
2024-06-27 17:34:53 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "城市管理列表",
roles: ["admin"],
},
},
],
2024-06-27 17:34:53 +08:00
},
2024-06-24 11:52:30 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/data",
2024-06-24 11:52:30 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/data/index",
2024-06-24 11:52:30 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "Data",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "数据统计",
icon: "chart",
roles: ["data_index"],
2024-06-24 11:52:30 +08:00
},
children: [
2024-06-28 17:30:56 +08:00
{
2024-10-21 19:21:39 +08:00
path: "product",
component: () => import("@/views/order/product"),
name: "productNameList",
2024-06-28 17:30:56 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "产品统计",
roles: ["order_pub", "editor"],
},
2024-06-28 17:30:56 +08:00
},
2024-06-24 11:52:30 +08:00
{
2024-10-21 19:21:39 +08:00
path: "index",
component: () => import("@/views/data/index"),
name: "Index",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "跟进统计",
roles: ["data_index"],
},
2024-06-24 11:52:30 +08:00
},
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
{
2024-10-21 19:21:39 +08:00
path: "sale",
component: () => import("@/views/data/sale"),
name: "Sale",
2024-06-24 11:52:30 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "销售统计",
roles: ["data_sale"],
},
},
],
},
{
path: "/log",
2024-06-28 17:30:56 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/log/index",
2024-06-28 17:30:56 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "Log",
2024-06-28 17:30:56 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "日志记录",
icon: "nested",
roles: ["follow_index", "log_index", "editor", "franchisee"],
2024-06-28 17:30:56 +08:00
},
children: [
{
2024-10-21 19:21:39 +08:00
path: "follow",
component: () => import("@/views/log/follow"),
name: "Follow",
2024-06-28 17:30:56 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "跟进记录",
roles: ["follow_index", "editor", "franchisee"],
},
2024-06-28 17:30:56 +08:00
},
{
2024-10-21 19:21:39 +08:00
path: "index",
component: () => import("@/views/log/index"),
name: "LogIndex",
2024-06-28 17:30:56 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "日志记录",
roles: ["log_index"],
},
},
],
2024-06-24 11:52:30 +08:00
},
2024-07-29 14:00:55 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/announcements",
2024-07-29 14:00:55 +08:00
component: Layout,
2024-10-21 19:21:39 +08:00
redirect: "/announcements/index",
2024-07-29 14:00:55 +08:00
alwaysShow: true,
2024-10-21 19:21:39 +08:00
name: "announcements",
2024-07-29 14:00:55 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "公告管理",
icon: "el-icon-s-promotion",
roles: ["admin"],
2024-07-29 14:00:55 +08:00
},
children: [
{
2024-10-21 19:21:39 +08:00
path: "list",
component: () => import("@/views/announcements/list"),
name: "list",
2024-07-29 14:00:55 +08:00
meta: {
2024-10-21 19:21:39 +08:00
title: "公告列表",
roles: ["admin"],
},
},
],
2024-07-29 14:00:55 +08:00
},
2024-06-24 11:52:30 +08:00
{
2024-10-21 19:21:39 +08:00
path: "/icon",
2024-06-24 11:52:30 +08:00
component: Layout,
children: [
{
2024-10-21 19:21:39 +08:00
path: "index",
component: () => import("@/views/icons/index"),
name: "Icons",
meta: { title: "Icons", icon: "icon", noCache: true },
},
],
2024-06-24 11:52:30 +08:00
},
// 404 page must be placed at the end !!!
2024-10-21 19:21:39 +08:00
{ path: "*", redirect: "/404", hidden: true },
];
2024-06-24 11:52:30 +08:00
2024-10-21 19:21:39 +08:00
const createRouter = () =>
new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes,
});
2024-06-24 11:52:30 +08:00
2024-10-21 19:21:39 +08:00
const router = createRouter();
2024-06-24 11:52:30 +08:00
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
2024-10-21 19:21:39 +08:00
const newRouter = createRouter();
router.matcher = newRouter.matcher; // reset router
2024-06-24 11:52:30 +08:00
}
2024-10-21 19:21:39 +08:00
export default router;