feat: 补充mock接口

Former-commit-id: 9e1a5128d6ac9d8161240d224324b79c5e4f3dcc
This commit is contained in:
hxr
2023-08-09 07:22:34 +08:00
parent 8c60fb2a23
commit 7725bd0792
4 changed files with 318 additions and 0 deletions

View File

@@ -92,4 +92,91 @@ export default [
};
},
},
{
url: "/api/v1/users/page",
method: "get",
response: () => {
return {
code: "00000",
data: {
list: [
{
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
genderLabel: "男",
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: null,
status: 1,
deptName: "有来技术",
roleNames: "系统管理员",
createTime: "2019-10-10",
},
{
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
genderLabel: "男",
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: null,
status: 1,
deptName: "测试部门",
roleNames: "访问游客",
createTime: "2021-06-04",
},
],
total: 2,
},
msg: "一切ok",
};
},
},
{
url: "/api/v1/users/:id/form",
method: "get",
response: ({ url }) => {
const id = url.match(/\/api\/v1\/users\/(\d+)\/form/)[1];
let formData = null;
if (id == 2) {
formData = {
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
gender: 1,
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: "",
status: 1,
deptId: 1,
roleIds: [2],
};
} else if (id == 3) {
formData = {
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
gender: 1,
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: "youlaitech@163.com",
status: 1,
deptId: 3,
roleIds: [3],
};
}
return {
code: "00000",
data: formData,
msg: "一切ok",
};
},
},
] as MockMethod[];