123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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++) {
- const { phone } = mock({
- phone: '@phone',
- });
- result.push({
- id: `${index}`,
- activatedTime: '@datetime',
- address: '@city(true)',
- agentFrameworkId: null,
- agentFrameworkName: null,
- agentName: null,
- balance: 'THETAYP41136787.OSC',
- 'cameraType|1': [1, 4, 9, 10, 6],
- childName: 'THETAYP41136787.OSC',
- companyId: null,
- companyName: '@ctitle',
- cooperationUser: null,
- cooperationUserName: null,
- country: 0,
- createTime: null,
- goodsId: null,
- goodsName: null,
- imageUrl: null,
- inTime: null,
- isExpire: null,
- lastTime: null,
- nickName: null,
- orderSn: null,
- outTime: null,
- 'own|1': [0, 1, 2, 3],
- pic: null,
- recStatus: 'A',
- responseUserIncrement: null,
- sceneNum: null,
- 'snCode|8': '@integer(1,20)',
- space: null,
- spaceContent: null,
- spaceEndStr: null,
- spaceEndTime: null,
- spaceId: null,
- spaceStr: null,
- surplusDate: null,
- totalSpace: 0,
- totalSpaceStr: null,
- type: null,
- usedSpace: 0,
- usedSpaceStr: null,
- userId: '@integer(1,20)',
- userIncrementId: null,
- userName: phone,
- wifiName: 'THETAYP41136787.OSC',
- });
- }
- return result;
- })();
- export default [
- {
- url: '/zfb-api/zfb/camera/pageList',
- timeout: 1000,
- method: 'get',
- response: ({ query }) => {
- const { page = 1, pageSize = 20 } = query;
- return resultPageSuccess(page, pageSize, demoList);
- },
- },
- ] as MockMethod[];
|