mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-02 10:57:24 +08:00
* feat: 添加系统管理-菜单管理 * chore: update * chore: add Copyright in login page * chore: 将页脚放在一屏可视区 * chore: 依赖更新 * chore: update * chore: update * chore: 更新依赖 * chore: update `husky v9` * style: 适配`el-dialog`样式的更新 * style: update `src/layout/components/search/components/SearchResult.vue` * chore: update * style: update * fix: 修复`ReDialog`中点击取消和确定按钮会触发两次关闭回调 * chore: update * chore: update src/views/system/menu/README.md * chore: update * chore: update * chore: done * chore: update
247 lines
5.4 KiB
TypeScript
247 lines
5.4 KiB
TypeScript
// 模拟后端动态生成路由
|
||
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||
import { system, permission, frame, tabs } from "@/router/enums";
|
||
|
||
/**
|
||
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
||
* admin:管理员角色
|
||
* common:普通角色
|
||
*/
|
||
|
||
const systemRouter = {
|
||
path: "/system",
|
||
meta: {
|
||
icon: "ri:settings-3-line",
|
||
title: "menus.hssysManagement",
|
||
rank: system
|
||
},
|
||
children: [
|
||
{
|
||
path: "/system/user/index",
|
||
name: "SystemUser",
|
||
meta: {
|
||
icon: "ri:admin-line",
|
||
title: "menus.hsUser",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/system/role/index",
|
||
name: "SystemRole",
|
||
meta: {
|
||
icon: "ri:admin-fill",
|
||
title: "menus.hsRole",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/system/menu/index",
|
||
name: "SystemMenu",
|
||
meta: {
|
||
icon: "ep:menu",
|
||
title: "menus.hsSystemMenu",
|
||
roles: ["admin"]
|
||
}
|
||
},
|
||
{
|
||
path: "/system/dept/index",
|
||
name: "SystemDept",
|
||
meta: {
|
||
icon: "ri:git-branch-line",
|
||
title: "menus.hsDept",
|
||
roles: ["admin"]
|
||
}
|
||
}
|
||
]
|
||
};
|
||
|
||
const permissionRouter = {
|
||
path: "/permission",
|
||
meta: {
|
||
title: "menus.permission",
|
||
icon: "ep:lollipop",
|
||
rank: permission
|
||
},
|
||
children: [
|
||
{
|
||
path: "/permission/page/index",
|
||
name: "PermissionPage",
|
||
meta: {
|
||
title: "menus.permissionPage",
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/permission/button/index",
|
||
name: "PermissionButton",
|
||
meta: {
|
||
title: "menus.permissionButton",
|
||
roles: ["admin", "common"],
|
||
auths: [
|
||
"permission:btn:add",
|
||
"permission:btn:edit",
|
||
"permission:btn:delete"
|
||
]
|
||
}
|
||
}
|
||
]
|
||
};
|
||
|
||
const frameRouter = {
|
||
path: "/iframe",
|
||
meta: {
|
||
icon: "ep:monitor",
|
||
title: "menus.hsExternalPage",
|
||
rank: frame
|
||
},
|
||
children: [
|
||
{
|
||
path: "/iframe/external",
|
||
meta: {
|
||
title: "menus.hsExternalDoc"
|
||
},
|
||
children: [
|
||
{
|
||
path: "/external",
|
||
name: "https://yiming_chang.gitee.io/pure-admin-doc",
|
||
meta: {
|
||
title: "menus.externalLink",
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/pureutilsLink",
|
||
name: "https://pure-admin-utils.netlify.app/",
|
||
meta: {
|
||
title: "menus.pureutilsLink",
|
||
roles: ["admin", "common"]
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
path: "/iframe/embedded",
|
||
meta: {
|
||
title: "menus.hsEmbeddedDoc"
|
||
},
|
||
children: [
|
||
{
|
||
path: "/iframe/ep",
|
||
name: "FrameEp",
|
||
meta: {
|
||
title: "menus.hsEpDocument",
|
||
frameSrc: "https://element-plus.org/zh-CN/",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/iframe/tailwindcss",
|
||
name: "FrameTailwindcss",
|
||
meta: {
|
||
title: "menus.hsTailwindcssDocument",
|
||
frameSrc: "https://tailwindcss.com/docs/installation",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/iframe/vue3",
|
||
name: "FrameVue",
|
||
meta: {
|
||
title: "menus.hsVueDocument",
|
||
frameSrc: "https://cn.vuejs.org/",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/iframe/vite",
|
||
name: "FrameVite",
|
||
meta: {
|
||
title: "menus.hsViteDocument",
|
||
frameSrc: "https://cn.vitejs.dev/",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/iframe/pinia",
|
||
name: "FramePinia",
|
||
meta: {
|
||
title: "menus.hsPiniaDocument",
|
||
frameSrc: "https://pinia.vuejs.org/zh/index.html",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
},
|
||
{
|
||
path: "/iframe/vue-router",
|
||
name: "FrameRouter",
|
||
meta: {
|
||
title: "menus.hsRouterDocument",
|
||
frameSrc: "https://router.vuejs.org/zh/",
|
||
keepAlive: true,
|
||
roles: ["admin", "common"]
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
};
|
||
|
||
const tabsRouter = {
|
||
path: "/tabs",
|
||
meta: {
|
||
icon: "ri:bookmark-2-line",
|
||
title: "menus.hstabs",
|
||
rank: tabs
|
||
},
|
||
children: [
|
||
{
|
||
path: "/tabs/index",
|
||
name: "Tabs",
|
||
meta: {
|
||
title: "menus.hstabs",
|
||
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 {
|
||
success: true,
|
||
data: [systemRouter, permissionRouter, frameRouter, tabsRouter]
|
||
};
|
||
}
|
||
}
|
||
]);
|