1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| import Mock from 'mockjs2'
| import { builder, getQueryParameters } from '../util'
|
| const titles = [
| 'Alipay',
| 'Angular',
| 'Ant Design',
| 'XiaoNuo',
| 'Bootstrap',
| 'React',
| 'Vue',
| 'Webpack'
| ]
|
| const avatar = ['https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png'
| ]
|
| const covers = [
| 'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png',
| 'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png'
| ]
|
| const owner = [
| '付小小',
| '吴加好',
| '周星星',
| '林东东',
| '曲丽丽'
| ]
|
| const content = '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。'
| const description = '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
| const href = 'https://ant.design'
|
| const article = (options) => {
| const queryParameters = getQueryParameters(options)
| console.log('queryParameters', queryParameters)
| if (queryParameters && !queryParameters.count) {
| queryParameters.count = 5
| }
| const data = []
| for (let i = 0; i < queryParameters.count; i++) {
| const tmpKey = i + 1
| const num = parseInt(Math.random() * (4 + 1), 10)
| data.push({
| id: tmpKey,
| avatar: avatar[num],
| owner: owner[num],
| content: content,
| star: Mock.mock('@integer(1, 999)'),
| percent: Mock.mock('@integer(1, 999)'),
| like: Mock.mock('@integer(1, 999)'),
| message: Mock.mock('@integer(1, 999)'),
| description: description,
| href: href,
| title: titles[ i % 8 ],
| updatedAt: Mock.mock('@datetime'),
| members: [
| {
| avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
| name: '曲丽丽',
| id: 'member1'
| },
| {
| avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
| name: '王昭君',
| id: 'member2'
| },
| {
| avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
| name: '董娜娜',
| id: 'member3'
| }
| ],
| activeUser: Math.ceil(Math.random() * 100000) + 100000,
| newUser: Math.ceil(Math.random() * 1000) + 1000,
| cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)]
| })
| }
| return builder(data)
| }
|
| Mock.mock(/\/list\/article/, 'get', article)
|
|