123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568 |
- import { defineMock } from "./base";
- export default defineMock([
- {
- url: "menus/routes",
- method: ["GET"],
- body: {
- code: "00000",
- data: [
- {
- path: "/system",
- component: "Layout",
- redirect: "/system/user",
- name: "/system",
- meta: {
- title: "系统管理",
- icon: "system",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- children: [
- {
- path: "user",
- component: "system/user/index",
- name: "User",
- meta: {
- title: "用户管理",
- icon: "el-icon-User",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "role",
- component: "system/role/index",
- name: "Role",
- meta: {
- title: "角色管理",
- icon: "role",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "menu",
- component: "system/menu/index",
- name: "Menu",
- meta: {
- title: "菜单管理",
- icon: "menu",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "dept",
- component: "system/dept/index",
- name: "Dept",
- meta: {
- title: "部门管理",
- icon: "tree",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "dict",
- component: "system/dict/index",
- name: "Dict",
- meta: {
- title: "字典管理",
- icon: "dict",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- {
- path: "/api",
- component: "Layout",
- name: "/api",
- meta: {
- title: "接口文档",
- icon: "api",
- hidden: false,
- alwaysShow: true,
- params: null,
- },
- children: [
- {
- path: "apifox",
- component: "demo/api/apifox",
- name: "Apifox",
- meta: {
- title: "Apifox",
- icon: "api",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- {
- path: "/doc",
- component: "Layout",
- redirect: "https://juejin.cn/post/7228990409909108793",
- name: "/doc",
- meta: {
- title: "平台文档",
- icon: "document",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- children: [
- {
- path: "internal-doc",
- component: "demo/internal-doc",
- name: "InternalDoc",
- meta: {
- title: "平台文档(内嵌)",
- icon: "document",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "https://juejin.cn/post/7228990409909108793",
- name: "Https://juejin.cn/post/7228990409909108793",
- meta: {
- title: "平台文档(外链)",
- icon: "el-icon-Link",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- {
- path: "/multi-level",
- component: "Layout",
- name: "/multiLevel",
- meta: {
- title: "多级菜单",
- icon: "cascader",
- hidden: false,
- alwaysShow: true,
- params: null,
- },
- children: [
- {
- path: "multi-level1",
- component: "demo/multi-level/level1",
- name: "MultiLevel1",
- meta: {
- title: "菜单一级",
- icon: "",
- hidden: false,
- alwaysShow: true,
- params: null,
- },
- children: [
- {
- path: "multi-level2",
- component: "demo/multi-level/children/level2",
- name: "MultiLevel2",
- meta: {
- title: "菜单二级",
- icon: "",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- children: [
- {
- path: "multi-level3-1",
- component: "demo/multi-level/children/children/level3-1",
- name: "MultiLevel31",
- meta: {
- title: "菜单三级-1",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "multi-level3-2",
- component: "demo/multi-level/children/children/level3-2",
- name: "MultiLevel32",
- meta: {
- title: "菜单三级-2",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- ],
- },
- ],
- },
- {
- path: "/component",
- component: "Layout",
- name: "/component",
- meta: {
- title: "组件封装",
- icon: "menu",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- children: [
- {
- path: "curd",
- component: "demo/curd/index",
- name: "Curd",
- meta: {
- title: "增删改查",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "table-select",
- component: "demo/table-select/index",
- name: "TableSelect",
- meta: {
- title: "列表选择器",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "wang-editor",
- component: "demo/wang-editor",
- name: "WangEditor",
- meta: {
- title: "富文本编辑器",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "upload",
- component: "demo/upload",
- name: "Upload",
- meta: {
- title: "图片上传",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "icon-selector",
- component: "demo/icon-selector",
- name: "IconSelector",
- meta: {
- title: "图标选择器",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "dict-demo",
- component: "demo/dict",
- name: "DictDemo",
- meta: {
- title: "字典组件",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- {
- path: "/route-param",
- component: "Layout",
- name: "/routeParam",
- meta: {
- title: "路由参数",
- icon: "el-icon-ElementPlus",
- hidden: false,
- alwaysShow: true,
- params: null,
- },
- children: [
- {
- path: "route-param-type1",
- component: "demo/route-param",
- name: "RouteParamType1",
- meta: {
- title: "参数(type=1)",
- icon: "el-icon-Star",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: {
- type: "1",
- },
- },
- },
- {
- path: "route-param-type2",
- component: "demo/route-param",
- name: "RouteParamType2",
- meta: {
- title: "参数(type=2)",
- icon: "el-icon-StarFilled",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: {
- type: "2",
- },
- },
- },
- ],
- },
- {
- path: "/function",
- component: "Layout",
- name: "/function",
- meta: {
- title: "功能演示",
- icon: "menu",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- children: [
- {
- path: "icon-demo",
- component: "demo/icons",
- name: "IconDemo",
- meta: {
- title: "Icons",
- icon: "el-icon-Notification",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "/function/websocket",
- component: "demo/websocket",
- name: "/function/websocket",
- meta: {
- title: "Websocket",
- icon: "",
- hidden: false,
- keepAlive: true,
- alwaysShow: false,
- params: null,
- },
- },
- {
- path: "other/:id",
- component: "demo/other",
- name: "Other/:id",
- meta: {
- title: "敬请期待...",
- icon: "",
- hidden: false,
- alwaysShow: false,
- params: null,
- },
- },
- ],
- },
- ],
- msg: "一切ok",
- },
- },
- // 新增菜单
- {
- url: "menus",
- method: ["POST"],
- body({ body }) {
- return {
- code: "00000",
- data: null,
- msg: "新增菜单" + body.name + "成功",
- };
- },
- },
- // 获取菜单表单数据
- {
- url: "menus/:id/form",
- method: ["GET"],
- body: ({ params }) => {
- return {
- code: "00000",
- data: menuMap[params.id],
- msg: "一切ok",
- };
- },
- },
- // 修改菜单
- {
- url: "menus/:id",
- method: ["PUT"],
- body({ body }) {
- return {
- code: "00000",
- data: null,
- msg: "修改菜单" + body.name + "成功",
- };
- },
- },
- // 删除菜单
- {
- url: "menus/:id",
- method: ["DELETE"],
- body({ params }) {
- return {
- code: "00000",
- data: null,
- msg: "删除菜单" + params.id + "成功",
- };
- },
- },
- ]);
- // 菜单映射表数据
- const menuMap: Record<string, any> = {
- 1: {
- id: 1,
- parentId: 0,
- name: "系统管理",
- type: "CATALOG",
- routeName: "",
- routePath: "/system",
- component: "Layout",
- perm: null,
- visible: 1,
- sort: 1,
- icon: "system",
- redirect: "/system/user",
- keepAlive: null,
- alwaysShow: null,
- params: null,
- },
- 2: {
- id: 2,
- parentId: 1,
- name: "用户管理",
- type: "MENU",
- routeName: "User",
- routePath: "user",
- component: "system/user/index",
- perm: null,
- visible: 1,
- sort: 1,
- icon: "user",
- redirect: null,
- keepAlive: 1,
- alwaysShow: null,
- },
- 3: {
- id: 3,
- parentId: 1,
- name: "角色管理",
- type: "MENU",
- routeName: "Role",
- routePath: "role",
- component: "system/role/index",
- perm: null,
- visible: 1,
- sort: 2,
- icon: "role",
- redirect: null,
- keepAlive: 1,
- alwaysShow: null,
- },
- 4: {
- id: 4,
- parentId: 1,
- name: "菜单管理",
- type: "MENU",
- routeName: "Menu",
- routePath: "menu",
- component: "system/menu/index",
- perm: null,
- visible: 1,
- sort: 3,
- icon: "menu",
- redirect: null,
- keepAlive: 1,
- alwaysShow: null,
- },
- 5: {
- id: 5,
- parentId: 1,
- name: "部门管理",
- type: "MENU",
- routeName: "Dept",
- routePath: "dept",
- component: "system/dept/index",
- perm: null,
- visible: 1,
- sort: 4,
- icon: "tree",
- redirect: null,
- keepAlive: 1,
- alwaysShow: null,
- },
- 6: {
- id: 6,
- parentId: 1,
- name: "字典管理",
- type: "MENU",
- routeName: "Dict",
- routePath: "dict",
- component: "system/dict/index",
- perm: null,
- visible: 1,
- sort: 5,
- icon: "dict",
- redirect: null,
- keepAlive: 1,
- alwaysShow: null,
- },
- };
|