Some checks failed
Lint Code / Lint Code (push) Failing after 10m12s
- 删除 mock 中系统管理路由冗余数据,前端统一路由管理 - 飞书登录接口响应数据结构重构,新增登录状态及用户信息查询方法 - 重构系统接口模块,新增权限、角色、用户、部门、菜单等完整类型及API实现 - 新增项目初始化相关接口及数据类型支持 - 调整登录页及相关调用,适配飞书登录新接口返回 - 统一接口响应状态码判定,修正多处 code === 0 为 code === 200 - 新增系统管理路由模块,包含用户、角色、权限、菜单、部门页面 - 账号设置页面新增角色与权限展示,丰富用户信息显示 - 权限管理页面新增增删改查功能,提供表单校验与列表操作 - 优化权限表格展示和操作体验,支持批量删除及树形结构显示 - 兼容性优化,调整部门与菜单管理hook中code判断,避免误判 - 新增菜单和部门管理相关接口及类型定义 - 更新 OpenAPI 配置,规范角色菜单权限相关接口定义 - 新增权限管理表单组件及校验规则,支持增删改权限项 - 规范权限管理模块代码结构及变量命名,提高维护性
288 lines
6.6 KiB
TypeScript
288 lines
6.6 KiB
TypeScript
// 模拟后端动态生成路由
|
||
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||
import { monitor, permission, frame, tabs } from "@/router/enums";
|
||
|
||
/**
|
||
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
||
* admin:管理员角色
|
||
* common:普通角色
|
||
*/
|
||
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",
|
||
title: "menus.pureOnlineUser",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/monitor/login-logs",
|
||
component: "monitor/logs/login/index",
|
||
name: "LoginLog",
|
||
meta: {
|
||
icon: "ri:window-line",
|
||
title: "menus.pureLoginLog",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/monitor/operation-logs",
|
||
component: "monitor/logs/operation/index",
|
||
name: "OperationLog",
|
||
meta: {
|
||
icon: "ri:history-fill",
|
||
title: "menus.pureOperationLog",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/monitor/system-logs",
|
||
component: "monitor/logs/system/index",
|
||
name: "SystemLog",
|
||
meta: {
|
||
icon: "ri:file-search-line",
|
||
title: "menus.pureSystemLog",
|
||
roles: ["admin"]
|
||
}
|
||
}
|
||
]
|
||
};
|
||
|
||
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.cn/",
|
||
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"]
|
||
}
|
||
}
|
||
]
|
||
};
|
||
|
||
export default defineFakeRoute([
|
||
{
|
||
url: "/get-async-routes",
|
||
method: "get",
|
||
response: () => {
|
||
return {
|
||
code: 0,
|
||
message: "操作成功",
|
||
data: [systemMonitorRouter, permissionRouter, frameRouter, tabsRouter]
|
||
};
|
||
}
|
||
}
|
||
]);
|