123456789101112131415161718192021222324252627282930313233343536373839 |
- import { MockMethod } from 'vite-plugin-mock';
- import { mock, Random } from 'mockjs';
- import { resultPageSuccess } from '../_util';
- Random.extend({
- phone: function () {
- const phonePrefixs = ['132', '135', '189']; // 自己写前缀哈
- return this.pick(phonePrefixs) + mock(/\d{8}/); //Number()
- },
- });
- // console.log(Random.phone());
- // 生成 1 - 10 个 随机手机号码
- const demoList = (() => {
- const result: any[] = [];
- for (let index = 0; index < 1200; index++) {
- result.push({
- id: `${index}`,
- content: '@cparagraph(1, 3)',
- createTime: '@datetime',
- image: `@image('313x200', '@color', '示例slider')`,
- orderNum: '@integer(0,10)',
- title: '@ctitle(0,15)',
- link: '@url',
- });
- }
- return result;
- })();
- export default [
- {
- url: '/zfb-api/zfb/rotation/selectAll',
- timeout: 1000,
- method: 'get',
- response: ({ query }) => {
- const { page = 1, pageSize = 20 } = query;
- return resultPageSuccess(page, pageSize, demoList);
- },
- },
- ] as MockMethod[];
|