{
"list": function({
_req,
Mock
}) {
let i = 0,
_data = [],
pageNumber = _req.query.pageNumber, //当前页数
pageSize = _req.query.pageSize, //每次返回的条数
len = (64 - pageSize * (pageNumber - 1)) < pageSize ? (64 - pageSize * (pageNumber - 1)) : pageSize;
for (i; i < len; i++) {
_data.push(
Mock.mock({
"id": "@id",
"dateTime": "@date(yyyy-MM-dd hh:mm:ss)",
'email': '@email',
"url": "@url",
"address": "@county(true) @integer(10, 30)号",
"name": "@cname()", // 汉字姓名
'title': '@ctitle(8,12)', //标题,8-12个汉字
"paragraph": "@cparagraph", // 段落
'text': '@string(5,8)', // 5-8个字符
'val': '@csentence(16,26)', // 句子,16-26个汉字
"avatar": "@image('50x50')", // 图片
"mobile": /^(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/, //生成手机11位号 可以使用正则表达式
"isCanLogin": "@boolean",
"adpartment|1": ["研发部", "市场部", "运营部"],
})
);
}
return _data;
},
"pages": 4
}
网友评论