123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // 模拟后端动态生成路由
- import { defineFakeRoute } from "vite-plugin-fake-server/client";
- /**
- * roles:页面级别权限,这里模拟二种 "admin"、"common"
- * admin:管理员角色
- * common:普通角色
- */
- const permissionRouter = {
- path: "/permission",
- meta: {
- title: "权限管理",
- icon: "ep:lollipop",
- rank: 10
- },
- children: [
- {
- path: "/permission/page/index",
- name: "PermissionPage",
- meta: {
- title: "页面权限",
- roles: ["admin", "common"]
- }
- },
- {
- path: "/permission/button",
- meta: {
- title: "按钮权限",
- roles: ["admin", "common"]
- },
- children: [
- {
- path: "/permission/button/router",
- component: "permission/button/index",
- name: "PermissionButtonRouter",
- meta: {
- title: "路由返回按钮权限",
- auths: [
- "permission:btn:add",
- "permission:btn:edit",
- "permission:btn:delete"
- ]
- }
- },
- {
- path: "/permission/button/login",
- component: "permission/button/perms",
- name: "PermissionButtonLogin",
- meta: {
- title: "登录接口返回按钮权限"
- }
- }
- ]
- }
- ]
- };
- const messagePlatform = {
- path: "/messagePlatform",
- meta: {
- title: "消息平台",
- icon: "ep:lollipop",
- rank: 10
- },
- children: [
- {
- path: "/messagePlatform/gateways",
- component: "messageGateways/index",
- name: "messageGatewaysRouter",
- meta: {
- title: "消息网关管理",
- roles: ["admin", "common"]
- }
- },
- {
- path: "/messagePlatform/textMessage",
- component: "textMessage/index",
- name: "textMessageRouter",
- meta: {
- title: "短信模板管理",
- roles: ["admin", "common"]
- }
- },
- {
- path: "/messagePlatform/applicationMange",
- component: "applicationMange/index",
- name: "applicationRouter",
- meta: {
- title: "应用管理",
- roles: ["admin", "common"]
- }
- },
- {
- path: "/messagePlatform/dynamicAttribute",
- component: "dynamicAttribute/index",
- name: "dynamicAttributeRouter",
- meta: {
- title: "动态属性管理",
- roles: ["admin", "common"]
- }
- },
- {
- path: "/messagePlatform/system",
- component: "system/index",
- name: "systemRouter",
- meta: {
- title: "系统设置",
- roles: ["admin", "common"]
- }
- }
- ]
- };
- export default defineFakeRoute([
- {
- url: "/get-async-routes",
- method: "get",
- response: () => {
- return {
- success: true,
- data: [messagePlatform]
- };
- }
- }
- ]);
|