| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 | 
							
-  
 
- import { MockRequest } from '@delon/mock';
 
- const list: any[] = [];
 
- const total = 50;
 
- for (let i = 0; i < total; i += 1) {
 
-   list.push({
 
-     id: i + 1,
 
-     disabled: i % 6 === 0,
 
-     href: 'https://ant.design',
 
-     avatar: [
 
-       'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
 
-       'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
 
-     ][i % 2],
 
-     no: `TradeCode ${i}`,
 
-     title: `一个任务名称 ${i}`,
 
-     owner: '曲丽丽',
 
-     description: '这是一段描述',
 
-     callNo: Math.floor(Math.random() * 1000),
 
-     status: Math.floor(Math.random() * 10) % 4,
 
-     updatedAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
 
-     createdAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
 
-     progress: Math.ceil(Math.random() * 100),
 
-   });
 
- }
 
- function genData(params: any): { total: number; list: any[] } {
 
-   let ret = [...list];
 
-   const pi = +params.pi;
 
-   const ps = +params.ps;
 
-   const start = (pi - 1) * ps;
 
-   if (params.no) {
 
-     ret = ret.filter((data) => data.no.indexOf(params.no) > -1);
 
-   }
 
-   return { total: ret.length, list: ret.slice(start, ps * pi) };
 
- }
 
- function saveData(id: number, value: any): { msg: string } {
 
-   const item = list.find((w) => w.id === id);
 
-   if (!item) {
 
-     return { msg: '无效用户信息' };
 
-   }
 
-   Object.assign(item, value);
 
-   return { msg: 'ok' };
 
- }
 
- export const USERS = {
 
-   '/user': (req: MockRequest) => genData(req.queryString),
 
-   '/user/:id': (req: MockRequest) => list.find((w) => w.id === +req.params.id),
 
-   'POST /user/:id': (req: MockRequest) => saveData(+req.params.id, req.body),
 
-   '/user/current': {
 
-     name: 'Cipchk',
 
-     avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
 
-     userid: '00000001',
 
-     email: 'cipchk@qq.com',
 
-     signature: '海纳百川,有容乃大',
 
-     title: '交互专家',
 
-     group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
 
-     tags: [
 
-       {
 
-         key: '0',
 
-         label: '很有想法的',
 
-       },
 
-       {
 
-         key: '1',
 
-         label: '专注撩妹',
 
-       },
 
-       {
 
-         key: '2',
 
-         label: '帅~',
 
-       },
 
-       {
 
-         key: '3',
 
-         label: '通吃',
 
-       },
 
-       {
 
-         key: '4',
 
-         label: '专职后端',
 
-       },
 
-       {
 
-         key: '5',
 
-         label: '海纳百川',
 
-       },
 
-     ],
 
-     notifyCount: 12,
 
-     country: 'China',
 
-     geographic: {
 
-       province: {
 
-         label: '上海',
 
-         key: '330000',
 
-       },
 
-       city: {
 
-         label: '市辖区',
 
-         key: '330100',
 
-       },
 
-     },
 
-     address: 'XX区XXX路 XX 号',
 
-     phone: '你猜-你猜你猜猜猜',
 
-   },
 
-   'POST /user/avatar': 'ok',
 
-   'POST /login/account': (req: MockRequest) => {
 
-     const data = req.body;
 
-     if (!(data.userName === 'admin' || data.userName === 'user') || data.password !== 'ng-alain.com') {
 
-       return { msg: `Invalid username or password(admin/ng-alain.com)` };
 
-     }
 
-     return {
 
-       msg: 'ok',
 
-       user: {
 
-         token: '123456789',
 
-         name: data.userName,
 
-         email: `${data.userName}@qq.com`,
 
-         id: 10000,
 
-         time: +new Date(),
 
-       },
 
-     };
 
-   },
 
-   'POST /register': {
 
-     msg: 'ok',
 
-   },
 
- };
 
 
  |