mirror of
https://gitee.com/chu1204505056/vue-admin-beautiful.git
synced 2025-04-06 03:58:00 +08:00
1. 更新dependencies:日常小版本更新 2. 统一mutations命名规范:将setusername修改setUsername,与setPermissions/setAvatar风格一致 3. 整体格式化代码,无内容修改: > - 删除未引用的import > - 删除多余空行 > - function间隔添加空行 > - import与逻辑代码间添加空行 > - 优化导入 > - 内联变量
89 lines
2.1 KiB
JavaScript
89 lines
2.1 KiB
JavaScript
import { mock } from "mockjs";
|
|
import { handleRandomImage } from "../utils";
|
|
|
|
const List = [];
|
|
const count = 999;
|
|
for (let i = 0; i < count; i++) {
|
|
List.push(
|
|
mock({
|
|
uuid: "@uuid",
|
|
id: "@id",
|
|
title: "@csentence(1, 2)",
|
|
"status|1": ["published", "draft", "deleted"],
|
|
author: "@cname",
|
|
datetime: "@datetime",
|
|
pageViews: "@integer(300, 5000)",
|
|
img: handleRandomImage(200, 200),
|
|
smallImg: handleRandomImage(40, 40),
|
|
switch: "@boolean",
|
|
percent: "@integer(80,99)",
|
|
})
|
|
);
|
|
}
|
|
|
|
export default [
|
|
{
|
|
url: "/table/getList",
|
|
type: "post",
|
|
response(config) {
|
|
if (!config.body) {
|
|
return {
|
|
code: 200,
|
|
msg: "success",
|
|
totalCount: count,
|
|
data: mock({
|
|
"data|50": [
|
|
{
|
|
id: "@id",
|
|
title: "@csentence(1, 2)",
|
|
"status|1": ["published", "draft", "deleted"],
|
|
author: "@cname",
|
|
datetime: "@datetime",
|
|
pageViews: "@integer(300, 5000)",
|
|
img: handleRandomImage(200, 200),
|
|
smallImg: handleRandomImage(40, 40),
|
|
switch: "@boolean",
|
|
percent: "@integer(80,99)",
|
|
},
|
|
],
|
|
}).data,
|
|
};
|
|
}
|
|
const { title = "", pageNo = 1, pageSize = 20 } = config.body;
|
|
let mockList = List.filter((item) => {
|
|
return !(title && item.title.indexOf(title) < 0);
|
|
});
|
|
const pageList = mockList.filter(
|
|
(item, index) =>
|
|
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
|
|
);
|
|
return {
|
|
code: 200,
|
|
msg: "success",
|
|
totalCount: count,
|
|
data: pageList,
|
|
};
|
|
},
|
|
},
|
|
{
|
|
url: "/table/doEdit",
|
|
type: "post",
|
|
response() {
|
|
return {
|
|
code: 200,
|
|
msg: "模拟保存成功",
|
|
};
|
|
},
|
|
},
|
|
{
|
|
url: "/table/doDelete",
|
|
type: "post",
|
|
response() {
|
|
return {
|
|
code: 200,
|
|
msg: "模拟删除成功",
|
|
};
|
|
},
|
|
},
|
|
];
|