feat: 更新mock数据和用户store逻辑

重构用户模块的异步函数,添加租户和租户计划的mock接口,优化字典表单和请求拦截器的实现。
This commit is contained in:
Ray.Hao
2026-03-06 22:47:09 +08:00
parent 92db6b1c0a
commit ff6f68c0ce
11 changed files with 631 additions and 297 deletions

125
mock/tenant-plan.mock.ts Normal file
View File

@@ -0,0 +1,125 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "tenant-plans",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 1,
name: "基础版",
code: "BASIC",
status: 1,
sort: 1,
remark: "",
createTime: "2026-03-01 10:00:00",
updateTime: "2026-03-01 10:00:00",
},
{
id: 2,
name: "专业版",
code: "PRO",
status: 1,
sort: 2,
remark: "",
createTime: "2026-03-02 10:00:00",
updateTime: "2026-03-02 10:00:00",
},
],
total: 2,
},
msg: "一切ok",
},
},
{
url: "tenant-plans/options",
method: ["GET"],
body: {
code: "00000",
data: [
{ value: 1, label: "基础版" },
{ value: 2, label: "专业版" },
],
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/form",
method: ["GET"],
body: ({ params }) => {
const planId = Number(params.planId);
const form =
planId === 2
? {
id: 2,
name: "专业版",
code: "PRO",
status: 1,
sort: 2,
remark: "",
}
: {
id: 1,
name: "基础版",
code: "BASIC",
status: 1,
sort: 1,
remark: "",
};
return {
code: "00000",
data: form,
msg: "一切ok",
};
},
},
{
url: "tenant-plans",
method: ["POST"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId",
method: ["PUT"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:ids",
method: ["DELETE"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/menuIds",
method: ["GET"],
body: {
code: "00000",
data: [1, 2, 3, 4, 5, 6],
msg: "一切ok",
},
},
{
url: "tenant-plans/:planId/menus",
method: ["PUT"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
]);