Files
api-client/src/router/index.js

416 lines
10 KiB
Vue
Raw Normal View History

2025-03-28 18:28:06 +08:00
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layouts'
import EmptyLayout from '@/layouts/EmptyLayout'
import { publicPath, routerMode } from '@/config'
Vue.use(VueRouter)
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true,
},
{
path: '/register',
component: () => import('@/views/register/index'),
hidden: true,
},
{
path: '/401',
name: '401',
component: () => import('@/views/401'),
hidden: true,
},
{
path: '/404',
name: '404',
component: () => import('@/views/404'),
hidden: true,
},
]
export const asyncRoutes = [
{
path: '/',
component: Layout,
redirect: '/index',
children: [
{
path: 'index',
name: 'Index',
component: () => import('@/views/index/index'),
meta: {
title: '首页',
icon: 'home',
affix: true,
},
},
],
},
{
path: '/cxshMini',
component: Layout,
redirect: 'noRedirect',
name: 'CxshMini',
2025-04-30 23:34:59 +08:00
meta: { title: '小程序', icon: 'comment', permissions: ['admin', 'csxh_admin', 'csxh_user'] },
2025-03-28 18:28:06 +08:00
children: [
{
path: 'home',
component: EmptyLayout,
alwaysShow: true,
redirect: 'noRedirect',
name: 'Home',
meta: {
title: '首页',
icon: 'home',
2025-04-30 23:34:59 +08:00
permissions: ['admin', 'csxh_admin', 'csxh_user'],
2025-03-28 18:28:06 +08:00
},
children: [
{
path: 'banner',
name: 'Banner',
component: () => import('@/views/cxshMini/home/banner/index'),
meta: { title: '轮播图' },
},
],
},
{
path: 'anli',
component: EmptyLayout,
alwaysShow: true,
redirect: 'noRedirect',
name: 'Anli',
meta: {
title: '精彩案例',
icon: 'handshake',
2025-04-30 23:34:59 +08:00
permissions: ['admin', 'csxh_admin', 'csxh_user'],
2025-03-28 18:28:06 +08:00
},
children: [
{
path: 'article',
name: 'Article',
component: () => import('@/views/cxshMini/anli/article/index'),
2025-04-30 23:34:59 +08:00
meta: { title: '新建案例' },
},
{
path: 'list',
name: 'List',
component: () => import('@/views/cxshMini/anli/list/index'),
meta: { title: '案例列表' },
2025-03-28 18:28:06 +08:00
},
{
path: 'category',
name: 'Category',
component: () => import('@/views/cxshMini/anli/category/index'),
meta: { title: '案例分类' },
},
],
},
{
path: 'lianxi',
component: EmptyLayout,
alwaysShow: true,
redirect: 'noRedirect',
name: 'Lianxi',
meta: {
title: '联系我们',
icon: 'user-friends',
2025-04-30 23:34:59 +08:00
permissions: ['admin', 'csxh_admin', 'csxh_user'],
2025-03-28 18:28:06 +08:00
},
children: [
{
path: 'member',
name: 'Member',
component: () => import('@/views/cxshMini/lianxi/member/index'),
meta: { title: '成员' },
},
],
},
],
},
/* {
path: "/test",
component: Layout,
redirect: "noRedirect",
children: [
{
path: "test",
name: "Test",
component: () => import("@/views/test/index"),
meta: {
title: "test",
icon: "marker",
permissions: ["admin"],
},
},
],
}, */
{
path: '/vab',
component: Layout,
redirect: 'noRedirect',
name: 'Vab',
alwaysShow: true,
2025-04-30 23:34:59 +08:00
meta: { title: '组件', icon: 'box-open', permissions: ['admin'] },
2025-03-28 18:28:06 +08:00
children: [
{
path: 'permissions',
name: 'Permission',
component: () => import('@/views/vab/permissions/index'),
meta: {
title: '角色权限',
permissions: ['admin', 'editor'],
},
},
{
path: 'icon',
component: EmptyLayout,
redirect: 'noRedirect',
name: 'Icon',
meta: {
title: '图标',
permissions: ['admin'],
},
children: [
{
path: 'awesomeIcon',
name: 'AwesomeIcon',
component: () => import('@/views/vab/icon/index'),
meta: { title: '常规图标' },
},
{
path: 'colorfulIcon',
name: 'ColorfulIcon',
component: () => import('@/views/vab/icon/colorfulIcon'),
meta: { title: '多彩图标' },
},
],
},
{
path: 'table',
component: () => import('@/views/vab/table/index'),
name: 'Table',
meta: {
title: '表格',
permissions: ['admin'],
},
},
{
path: 'webSocket',
name: 'WebSocket',
component: () => import('@/views/vab/webSocket/index'),
meta: { title: 'webSocket', permissions: ['admin'] },
},
{
path: 'form',
name: 'Form',
component: () => import('@/views/vab/form/index'),
meta: { title: '表单', permissions: ['admin'] },
},
{
path: 'element',
name: 'Element',
component: () => import('@/views/vab/element/index'),
meta: { title: '常用组件', permissions: ['admin'] },
},
{
path: 'tree',
name: 'Tree',
component: () => import('@/views/vab/tree/index'),
meta: { title: '树', permissions: ['admin'] },
},
{
path: 'menu1',
component: () => import('@/views/vab/nested/menu1/index'),
name: 'Menu1',
alwaysShow: true,
meta: {
title: '嵌套路由 1',
permissions: ['admin'],
},
children: [
{
path: 'menu1-1',
name: 'Menu1-1',
alwaysShow: true,
meta: { title: '嵌套路由 1-1' },
component: () => import('@/views/vab/nested/menu1/menu1-1/index'),
children: [
{
path: 'menu1-1-1',
name: 'Menu1-1-1',
meta: { title: '嵌套路由 1-1-1' },
component: () => import('@/views/vab/nested/menu1/menu1-1/menu1-1-1/index'),
},
],
},
],
},
{
path: 'loading',
name: 'Loading',
component: () => import('@/views/vab/loading/index'),
meta: { title: 'loading', permissions: ['admin'] },
},
{
path: 'backToTop',
name: 'BackToTop',
component: () => import('@/views/vab/backToTop/index'),
meta: { title: '返回顶部', permissions: ['admin'] },
},
{
path: 'lodash',
name: 'Lodash',
component: () => import('@/views/vab/lodash/index'),
meta: { title: 'lodash', permissions: ['admin'] },
},
{
path: 'upload',
name: 'Upload',
component: () => import('@/views/vab/upload/index'),
meta: { title: '上传', permissions: ['admin'] },
},
{
path: 'log',
name: 'Log',
component: () => import('@/views/vab/errorLog/index'),
meta: { title: '错误日志模拟', permissions: ['admin'] },
},
{
path: 'https://github.com/zxwk1998/vue-admin-better/',
name: 'ExternalLink',
meta: {
title: '外链',
target: '_blank',
permissions: ['admin', 'editor'],
badge: 'New',
},
},
{
path: 'more',
name: 'More',
component: () => import('@/views/vab/more/index'),
meta: { title: '关于', permissions: ['admin'] },
},
],
},
{
path: '/personnelManagement',
component: Layout,
redirect: 'noRedirect',
name: 'PersonnelManagement',
meta: { title: '配置', icon: 'users-cog', permissions: ['admin'] },
children: [
{
path: 'userManagement',
name: 'UserManagement',
component: () => import('@/views/personnelManagement/userManagement/index'),
meta: { title: '用户管理' },
},
{
path: 'appManagement',
name: 'AppManagement',
component: () => import('@/views/personnelManagement/appManagement/index'),
meta: { title: '应用管理' },
},
{
path: 'roleManagement',
name: 'RoleManagement',
component: () => import('@/views/personnelManagement/roleManagement/index'),
meta: { title: '角色管理' },
},
2025-05-07 20:35:49 +08:00
{
path: 'accessLogManagement',
name: 'AccessLogManagement',
component: () => import('@/views/personnelManagement/accessLogManagement/index'),
meta: { title: '访问日志' },
},
2025-04-30 23:34:59 +08:00
// {
// path: 'menuManagement',
// name: 'MenuManagement',
// component: () => import('@/views/personnelManagement/menuManagement/index'),
// meta: { title: '菜单管理', badge: 'New' },
// },
2025-03-28 18:28:06 +08:00
],
},
2025-04-30 23:34:59 +08:00
// {
// path: '/mall',
// component: Layout,
// redirect: 'noRedirect',
// name: 'Mall',
// meta: {
// title: '商城',
// icon: 'shopping-cart',
// permissions: ['admin'],
// },
2025-03-28 18:28:06 +08:00
2025-04-30 23:34:59 +08:00
// children: [
// {
// path: 'pay',
// name: 'Pay',
// component: () => import('@/views/mall/pay/index'),
// meta: {
// title: '支付',
// noKeepAlive: true,
// },
// children: null,
// },
// {
// path: 'goodsList',
// name: 'GoodsList',
// component: () => import('@/views/mall/goodsList/index'),
// meta: {
// title: '商品列表',
// },
// },
// ],
// },
2025-03-28 18:28:06 +08:00
{
path: '/error',
component: EmptyLayout,
redirect: 'noRedirect',
name: 'Error',
2025-04-30 23:34:59 +08:00
hidden: true,
2025-03-28 18:28:06 +08:00
meta: { title: '错误页', icon: 'bug' },
children: [
{
path: '401',
name: 'Error401',
component: () => import('@/views/401'),
meta: { title: '401' },
},
{
path: '404',
name: 'Error404',
component: () => import('@/views/404'),
meta: { title: '404' },
},
],
},
{
path: '*',
redirect: '/404',
hidden: true,
},
]
const router = new VueRouter({
base: publicPath,
mode: routerMode,
scrollBehavior: () => ({
y: 0,
}),
routes: constantRoutes,
})
export function resetRouter() {
location.reload()
}
export default router