-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy patharticle.ts
106 lines (106 loc) · 1.97 KB
/
article.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { Random } from "mockjs";
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/api/article",
method: "get",
response: () => {
return {
code: 200,
message: "请示成功",
status: "success",
total: 20,
data: new Array(10).fill("").map((article, index) => {
return {
id: index + 1,
title: Random.ctitle(),
content: Random.cparagraph(),
type: Random.pick(["history", "literature", "technology"])
};
})
};
}
},
{
url: "/api/article/type",
method: "get",
response: () => {
return {
code: 200,
message: "请示成功",
status: "success",
total: 3,
data: [
{
label: "历史",
value: "history"
},
{
label: "文学",
value: "literature"
},
{
label: "科技",
value: "technology"
}
]
};
}
},
{
url: "/api/article/:id",
method: "delete",
response: () => {
return {
code: 200,
message: "删除成功",
status: "success",
data: {
count: 1
}
};
}
},
{
url: "/api/article",
method: "delete",
response: () => {
return {
code: 200,
message: "批量删除成功",
status: "success",
data: {
count: 1
}
};
}
},
{
url: "/api/article",
method: "put",
response: () => {
return {
code: 200,
message: "编辑成功",
status: "success",
data: {
count: 1
}
};
}
},
{
url: "/api/article",
method: "post",
response: () => {
return {
code: 200,
message: "添加成功",
status: "success",
data: {
count: 1
}
};
}
}
] as MockMethod[];