Files
ApiServer-Web-admin_dashboa…/src/router/index.js
T
lin f6dcec75d7
Build and Deploy Vue3 / build (push) Successful in 1m6s
Build and Deploy Vue3 / deploy (push) Successful in 10m44s
feate:添加拼单类型接口
2025-12-31 13:07:05 +08:00

566 lines
15 KiB
JavaScript

import { createRouter, createWebHistory } from 'vue-router'
import AdminLayout from '../components/layout/AdminLayout.vue'
import OperationLog from '@/views/system/OperationLog.vue'
const routes = [
{
path: '/',
redirect: '/dashboard'
},
{
path: '/redirect',
component: AdminLayout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: () => import('../views/Redirect.vue'),
meta: { title: '重定向' }
}
]
},
{
path: '/',
component: AdminLayout,
children: [
{
path: 'dashboard',
name: 'Dashboard',
component: () => import('../views/dashboard/Dashboard.vue'),
meta: {
title: '仪表盘',
icon: 'DataBoard'
}
},
{
path: 'ticket',
name: 'Ticket',
meta: {
title: '工单管理',
icon: 'Tickets'
},
redirect: '/ticket/list',
children: [
{
path: 'list',
name: 'TicketList',
component: () => import('../views/ticket/TicketList.vue'),
meta: {
title: '工单列表'
}
},
{
path: 'detail',
name: 'TicketDetail',
component: () => import('../views/ticket/TicketDetail.vue'),
meta: {
title: '工单详情',
hidden: true,
activeMenu: '/ticket/list'
}
}
]
},
// ACS管理路由
{
path: 'acs',
name: 'ACS',
meta: {
title: 'ACS管理',
icon: 'Monitor'
},
redirect: '/acs/messages/announcements',
children: [
// 消息管理路由
{
path: 'messages',
name: 'Messages',
meta: {
title: '消息管理'
},
redirect: '/acs/messages/announcements',
children: [
{
path: 'announcements',
name: 'Announcements',
component: () => import('../views/acs/messages/Announcements.vue'),
meta: {
title: '官方公告'
}
},
{
path: 'policies',
name: 'Policies',
component: () => import('../views/acs/messages/Policies.vue'),
meta: {
title: '官方政策'
}
},
{
path: 'news',
name: 'News',
component: () => import('../views/acs/messages/News.vue'),
meta: {
title: '新闻咨询'
}
}
]
},
// 镜像管理路由
{
path: 'images',
name: 'Images',
meta: {
title: '镜像管理'
},
redirect: '/acs/images/vm',
children: [
{
path: 'vm',
name: 'VmImages',
component: () => import('../views/acs/images/VmImages.vue'),
meta: {
title: '虚拟机镜像'
}
},
{
path: 'container',
name: 'ContainerImages',
component: () => import('../views/acs/images/ContainerImages.vue'),
meta: {
title: '容器镜像'
}
},
{
path: 'categories',
name: 'ImageCategories',
component: () => import('../views/acs/images/ImageCategories.vue'),
meta: {
title: '镜像分类'
}
}
]
},
// 节点管理路由
{
path: 'nodes',
name: 'Nodes',
component: () => import('../views/acs/nodes/Nodes.vue'),
meta: {
title: '节点管理'
}
},
{
path: 'nodes/form',
name: 'ServerForm',
component: () => import('@/views/acs/nodes/ServerForm.vue'),
meta: { title: '服务器表单', activeMenu: '/acs/nodes', hidden: true }
},
{
path: 'images/form',
name: 'ImageForm',
component: () => import('@/views/acs/images/ImageForm.vue'),
meta: { title: '镜像表单', activeMenu: '/acs/images/vm', hidden: true }
}, {
path: 'guacamole',
name: 'Guacamole',
component: () => import('../views/acs/guacamole/Guacamole.vue'),
meta: {
title: 'Guacamole管理'
}
}
]
},
// 用户管理路由
{
path: 'user',
name: 'User',
meta: {
title: '用户管理',
icon: 'User'
},
redirect: '/user/list',
children: [
{
path: 'list',
name: 'UserList',
component: () => import('../views/user/UserList.vue'),
meta: {
title: '用户列表'
}
},
{
path: 'detail',
name: 'UserDetail',
component: () => import('../views/user/UserDetail.vue'),
meta: {
title: '用户详情'
}
},
{
path: 'balance',
name: 'UserBalance',
component: () => import('../views/user/UserBalance.vue'),
meta: {
title: '用户余额管理'
}
},
{
path: 'group',
name: 'UserGroup',
component: () => import('../views/user/UserGroup.vue'),
meta: {
title: '用户组管理'
}
},
{
path: 'admin-group',
name: 'AdminGroup',
component: () => import('../views/user/AdminGroup.vue'),
meta: {
title: '管理员组管理'
}
}
]
},
// 商品管理路由
{
path: 'product',
name: 'Product',
meta: {
title: '商品管理',
icon: 'Goods'
},
redirect: '/product/list',
children: [
{
path: 'list',
name: 'ProductList',
component: () => import('../views/product/ProductList.vue'),
meta: {
title: '商品列表'
}
},
{
path: 'group',
name: 'ProductGroup',
component: () => import('../views/product/ProductGroup.vue'),
meta: {
title: '商品分组'
}
},
]
},
// 订单管理路由
{
path: 'order',
name: 'Order',
meta: {
title: '订单管理',
icon: 'Document'
},
redirect: '/order/list',
children: [
{
path: 'list',
name: 'OrderList',
component: () => import('../views/order/OrderList.vue'),
meta: {
title: '订单列表'
}
}
]
},
// 优惠营销路由
{
path: 'marketing',
name: 'Marketing',
meta: {
title: '优惠营销',
icon: 'Present'
},
redirect: '/marketing/discount',
children: [
{
path: 'discount',
name: 'DiscountCode',
component: () => import('../views/marketing/DiscountCode.vue'),
meta: {
title: '优惠码管理'
}
},
{
path: 'voucher',
name: 'Voucher',
component: () => import('../views/marketing/Voucher.vue'),
meta: {
title: '代金券管理'
}
},
{
path: 'voucher/:id/manage',
name: 'VoucherManagement',
component: () => import('../views/marketing/VoucherManagement.vue'),
meta: {
title: '代金券详情管理',
hidden: true,
activeMenu: '/marketing/voucher'
}
},
]
},
// 活动管理路由
{
path: 'activity',
name: 'Activity',
meta: {
title: '活动管理',
icon: 'TrophyBase'
},
redirect: '/activity/signin',
children: [
{
path: 'signin',
name: 'SigninActivity',
component: () => import('../views/activity/SigninActivity.vue'),
meta: {
title: '签到活动'
}
},
{
path: '/activity/groupbuy',
name: 'GroupBuyActivity',
component: () => import('../views/activity/GroupBuyActivity.vue'),
meta: {
title: '拼团活动'
}
},
{
path: '/activity/groupbuy-type',
name: 'GroupBuyType',
component: () => import('../views/activity/GroupBuyType.vue'),
meta: {
title: '拼团类型'
}
}
]
},
{
path: 'system',
name: 'System',
meta: {
title: '系统管理',
icon: 'Setting'
},
redirect: '/system/permission/route',
children: [
{
path: 'permission/route',
name: 'PermissionRoute',
component: () => import('../views/system/PermissionRoute.vue'),
meta: {
title: '路由权限'
}
},
{
path: 'permission/admin',
name: 'PermissionAdmin',
component: () => import('../views/system/PermissionAdmin.vue'),
meta: {
title: '管理员权限'
}
},
{
path: 'file',
name: 'SystemFile',
component: () => import('../views/system/SystemFile.vue'),
meta: {
title: '文件管理'
}
},
{
path: 'domain-whitelist',
name: 'DomainWhitelist',
component: () => import('../views/system/DomainWhitelist.vue'),
meta: { title: '域名白名单' }
},
{
path: 'setting-group',
name: 'SettingGroup',
component: () => import('../views/system/SettingGroup.vue'),
meta: { title: '配置组管理' }
},
{
path: 'setting-list',
name: 'SettingList',
component: () => import('../views/system/Setting.vue'),
meta: { title: '配置管理' }
}
]
},
// 站点审计路由
{
path: 'audit',
name: 'Audit',
meta: {
title: '站点审计',
icon: 'Monitor'
},
redirect: '/audit/all',
children: [
{
path: 'all',
name: 'AuditAll',
component: () => import('../views/audit/AllSites.vue'),
meta: {
title: '所有站点'
}
},
{
path: 'violation',
name: 'AuditViolation',
component: () => import('../views/audit/ViolationSites.vue'),
meta: {
title: '违规站点'
}
}
]
},
// 全局设置管理路由
{
path: 'setting',
name: 'Setting',
meta: {
title: '全局设置管理',
icon: 'Setting'
},
redirect: '/setting/global',
children: [
{
path: 'global',
name: 'GlobalSetting',
component: () => import('../views/setting/GlobalSetting.vue'),
meta: {
title: '全局设置'
}
}
]
},
// 个人中心路由
{
path: 'profile',
name: 'Profile',
component: () => import('../views/profile/UserInfo.vue'),
meta: {
title: '个人信息',
hidden: true
}
},
// 修改密码路由
{
path: 'change-password',
name: 'ChangePassword',
component: () => import('../views/profile/ChangePassword.vue'),
meta: {
title: '修改密码',
hidden: true
}
},
// 服务器详情页面路由
{
path: 'servers/server',
name: 'ServerDetail',
component: () => import('../views/acs/nodes/server.vue'),
meta: {
title: '服务器详情',
hidden: true
}
},
// 虚拟机详情页面路由
{
path: 'servers/vm',
name: 'VmDetail',
component: () => import('../views/acs/nodes/VmDetail.vue'),
meta: {
title: '虚拟机详情',
hidden: true
}
},
// 容器详情页面路由
{
path: 'servers/container',
name: 'ContainerDetail',
component: () => import('../views/acs/nodes/containDetail.vue'),
meta: {
title: '容器详情',
hidden: true
}
}, {
path: 'servers/container/console',
name: 'ContainerConsole',
component: () => import('../views/acs/nodes/containerConsole.vue'),
meta: {
title: '终端容器',
hidden: true
}
}, {
path: 'servers/container/files',
name: 'ContainerFiles',
component: () => import('../views/acs/nodes/containFile.vue'),
meta: {
title: '容器文件管理',
hidden: true
}
}
]
},
// 登录页
{
path: '/login',
name: 'Login',
component: () => import('../views/Login.vue'),
meta: {
title: '登录'
}
},
// 404 页面
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
component: () => import('../views/NotFound.vue'),
meta: {
title: '页面不存在'
}
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
// 全局前置守卫
router.beforeEach((to, from, next) => {
// 设置页面标题
document.title = to.meta.title ? `${to.meta.title} - 007UI管理系统` : '007UI管理系统'
// 这里可以添加登录验证逻辑
const isAuthenticated = localStorage.getItem('token')
if (to.path !== '/login' && !isAuthenticated) {
next({ path: '/login' })
} else {
next()
}
})
// 全局后置钩子
router.afterEach(() => {
window.scrollTo(0, 0)
})
export default router