2024-08-23 14:31:00 +08:00
|
|
|
|
// 模拟后端动态生成路由
|
|
|
|
|
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
2024-09-05 23:10:40 +08:00
|
|
|
|
import { system, monitor } from "@/router/enums";
|
2024-08-23 14:31:00 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
|
|
|
|
|
* admin:管理员角色
|
|
|
|
|
|
* common:普通角色
|
|
|
|
|
|
*/
|
2024-09-07 02:17:07 +08:00
|
|
|
|
const testRouter = [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
|
|
|
|
|
parentId: "00000000-0000-0000-0000-000000000000",
|
|
|
|
|
|
path: "/monitor",
|
|
|
|
|
|
name: null,
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "menus.pureSysMonitor",
|
|
|
|
|
|
title: "系统监控",
|
|
|
|
|
|
component: null,
|
|
|
|
|
|
roles: null,
|
|
|
|
|
|
auths: [null],
|
|
|
|
|
|
frameSrc: null,
|
|
|
|
|
|
frameLoading: null,
|
|
|
|
|
|
keepAlive: null,
|
|
|
|
|
|
showLink: true
|
|
|
|
|
|
},
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "c765691a-32e4-4e88-6e8a-3a14dab3cadb",
|
|
|
|
|
|
parentId: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
|
|
|
|
|
path: "/monitor/online-user",
|
|
|
|
|
|
name: "OnlineUser",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:user-voice-line",
|
|
|
|
|
|
title: "在线用户",
|
|
|
|
|
|
component: null,
|
|
|
|
|
|
roles: null,
|
|
|
|
|
|
auths: ["monitor:online:list"],
|
|
|
|
|
|
frameSrc: null,
|
|
|
|
|
|
frameLoading: null,
|
|
|
|
|
|
keepAlive: null,
|
|
|
|
|
|
showLink: true
|
2024-09-07 13:43:00 +08:00
|
|
|
|
}
|
2024-09-07 02:17:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/monitor/operation-logs",
|
|
|
|
|
|
name: "OperationLog",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:history-fill",
|
|
|
|
|
|
title: "操作日志",
|
|
|
|
|
|
component: "monitor/logs/operation/index",
|
|
|
|
|
|
showLink: true
|
2024-09-07 13:43:00 +08:00
|
|
|
|
}
|
2024-09-07 02:17:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "580a7b97-15ab-6d43-d011-3a14dab3cadc",
|
|
|
|
|
|
parentId: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
|
|
|
|
|
path: "/monitor/login-logs",
|
|
|
|
|
|
name: "LoginLog",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:window-line",
|
|
|
|
|
|
title: "登录日志",
|
|
|
|
|
|
component: "monitor/logs/login/index",
|
|
|
|
|
|
roles: null,
|
|
|
|
|
|
auths: ["monitor:logininfor:list"],
|
|
|
|
|
|
frameSrc: null,
|
|
|
|
|
|
frameLoading: null,
|
|
|
|
|
|
keepAlive: null,
|
|
|
|
|
|
showLink: true
|
|
|
|
|
|
},
|
|
|
|
|
|
children: null
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
2024-08-23 14:31:00 +08:00
|
|
|
|
|
|
|
|
|
|
const systemManagementRouter = {
|
|
|
|
|
|
path: "/system",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:settings-3-line",
|
|
|
|
|
|
title: "menus.pureSysManagement",
|
|
|
|
|
|
rank: system
|
|
|
|
|
|
},
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/system/user/index",
|
|
|
|
|
|
name: "SystemUser",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:admin-line",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureUser"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/system/role/index",
|
|
|
|
|
|
name: "SystemRole",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:admin-fill",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureRole"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/system/menu/index",
|
|
|
|
|
|
name: "SystemMenu",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ep:menu",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureSystemMenu"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/system/dept/index",
|
|
|
|
|
|
name: "SystemDept",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:git-branch-line",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureDept"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
2024-09-04 16:24:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/system/post/index",
|
|
|
|
|
|
name: "SystemPost",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ant-design:deployment-unit-outlined",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.purePost"
|
2024-09-04 16:24:26 +08:00
|
|
|
|
//roles: ["admin"]
|
|
|
|
|
|
}
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const systemMonitorRouter = {
|
|
|
|
|
|
path: "/monitor",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ep:monitor",
|
|
|
|
|
|
title: "menus.pureSysMonitor",
|
|
|
|
|
|
rank: monitor
|
|
|
|
|
|
},
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/monitor/online-user",
|
|
|
|
|
|
component: "monitor/online/index",
|
|
|
|
|
|
name: "OnlineUser",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:user-voice-line",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureOnlineUser"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/monitor/login-logs",
|
|
|
|
|
|
component: "monitor/logs/login/index",
|
|
|
|
|
|
name: "LoginLog",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:window-line",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureLoginLog"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path: "/monitor/operation-logs",
|
|
|
|
|
|
component: "monitor/logs/operation/index",
|
|
|
|
|
|
name: "OperationLog",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
icon: "ri:history-fill",
|
2024-09-05 23:10:40 +08:00
|
|
|
|
title: "menus.pureOperationLog"
|
2024-08-30 16:08:20 +08:00
|
|
|
|
//roles: ["admin"]
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-09-04 23:31:42 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// path: "/monitor/system-logs",
|
|
|
|
|
|
// component: "monitor/logs/system/index",
|
|
|
|
|
|
// name: "SystemLog",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// icon: "ri:file-search-line",
|
|
|
|
|
|
// title: "menus.pureSystemLog",
|
|
|
|
|
|
// //roles: ["admin"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2024-08-23 14:31:00 +08:00
|
|
|
|
]
|
|
|
|
|
|
};
|
2024-09-05 23:10:40 +08:00
|
|
|
|
//
|
|
|
|
|
|
// const permissionRouter = {
|
|
|
|
|
|
// path: "/permission",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePermission",
|
|
|
|
|
|
// icon: "ep:lollipop",
|
|
|
|
|
|
// rank: permission
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/permission/page/index",
|
|
|
|
|
|
// name: "PermissionPage",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePermissionPage"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/permission/button",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePermissionButton"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/permission/button/router",
|
|
|
|
|
|
// component: "permission/button/index",
|
|
|
|
|
|
// name: "PermissionButtonRouter",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePermissionButtonRouter",
|
|
|
|
|
|
// auths: [
|
|
|
|
|
|
// "permission:btn:add",
|
|
|
|
|
|
// "permission:btn:edit",
|
|
|
|
|
|
// "permission:btn:delete"
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/permission/button/login",
|
|
|
|
|
|
// component: "permission/button/perms",
|
|
|
|
|
|
// name: "PermissionButtonLogin",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePermissionButtonLogin"
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// };
|
|
|
|
|
|
//
|
|
|
|
|
|
// const frameRouter = {
|
|
|
|
|
|
// path: "/iframe",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// icon: "ri:links-fill",
|
|
|
|
|
|
// title: "menus.pureExternalPage",
|
|
|
|
|
|
// rank: frame
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/embedded",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureEmbeddedDoc"
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/colorhunt",
|
|
|
|
|
|
// name: "FrameColorHunt",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureColorHuntDoc",
|
|
|
|
|
|
// frameSrc: "https://colorhunt.co/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/uigradients",
|
|
|
|
|
|
// name: "FrameUiGradients",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureUiGradients",
|
|
|
|
|
|
// frameSrc: "https://uigradients.com/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/ep",
|
|
|
|
|
|
// name: "FrameEp",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureEpDoc",
|
|
|
|
|
|
// frameSrc: "https://element-plus.org/zh-CN/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/tailwindcss",
|
|
|
|
|
|
// name: "FrameTailwindcss",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureTailwindcssDoc",
|
|
|
|
|
|
// frameSrc: "https://tailwindcss.com/docs/installation",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/vue3",
|
|
|
|
|
|
// name: "FrameVue",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureVueDoc",
|
|
|
|
|
|
// frameSrc: "https://cn.vuejs.org/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/vite",
|
|
|
|
|
|
// name: "FrameVite",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureViteDoc",
|
|
|
|
|
|
// frameSrc: "https://cn.vitejs.dev/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/pinia",
|
|
|
|
|
|
// name: "FramePinia",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.purePiniaDoc",
|
|
|
|
|
|
// frameSrc: "https://pinia.vuejs.org/zh/index.html",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/vue-router",
|
|
|
|
|
|
// name: "FrameRouter",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureRouterDoc",
|
|
|
|
|
|
// frameSrc: "https://router.vuejs.org/zh/",
|
|
|
|
|
|
// keepAlive: true
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/iframe/external",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureExternalDoc"
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/external",
|
|
|
|
|
|
// name: "https://pure-admin.github.io/pure-admin-doc",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureExternalLink"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/pureUtilsLink",
|
|
|
|
|
|
// name: "https://pure-admin-utils.netlify.app/",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureUtilsLink"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// };
|
|
|
|
|
|
//
|
|
|
|
|
|
// const tabsRouter = {
|
|
|
|
|
|
// path: "/tabs",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// icon: "ri:bookmark-2-line",
|
|
|
|
|
|
// title: "menus.pureTabs",
|
|
|
|
|
|
// rank: tabs
|
|
|
|
|
|
// },
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/tabs/index",
|
|
|
|
|
|
// name: "Tabs",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// title: "menus.pureTabs"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// // query 传参模式
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/tabs/query-detail",
|
|
|
|
|
|
// name: "TabQueryDetail",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// // 不在menu菜单中显示
|
|
|
|
|
|
// showLink: false,
|
|
|
|
|
|
// activePath: "/tabs/index"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
|
|
|
// // params 传参模式
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: "/tabs/params-detail/:id",
|
|
|
|
|
|
// component: "params-detail",
|
|
|
|
|
|
// name: "TabParamsDetail",
|
|
|
|
|
|
// meta: {
|
|
|
|
|
|
// // 不在menu菜单中显示
|
|
|
|
|
|
// showLink: false,
|
|
|
|
|
|
// activePath: "/tabs/index"
|
|
|
|
|
|
// //roles: ["admin", "common"]
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// };
|
2024-08-23 14:31:00 +08:00
|
|
|
|
|
|
|
|
|
|
export default defineFakeRoute([
|
|
|
|
|
|
{
|
2024-08-23 18:26:26 +08:00
|
|
|
|
url: `/dev-api/get-async-routes`,
|
2024-08-23 14:31:00 +08:00
|
|
|
|
method: "get",
|
|
|
|
|
|
response: () => {
|
2024-09-07 02:17:07 +08:00
|
|
|
|
return testRouter;
|
2024-08-29 22:59:16 +08:00
|
|
|
|
return [
|
|
|
|
|
|
systemManagementRouter,
|
2024-09-05 23:10:40 +08:00
|
|
|
|
systemMonitorRouter
|
2024-09-04 16:24:26 +08:00
|
|
|
|
//permissionRouter,
|
2024-08-30 16:08:20 +08:00
|
|
|
|
// frameRouter,
|
|
|
|
|
|
// tabsRouter
|
2024-08-29 22:59:16 +08:00
|
|
|
|
];
|
2024-08-23 14:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
]);
|