forked from snakeYu/xinke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.js
72 lines (70 loc) · 1.78 KB
/
db.js
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
module.exports = function() {
// 使用 Mock
const Mock = require('mockjs');
// console.log(Mock.Random.county(true));
let data = {
store: [],
options: [
{
value: '上海',
label: '上海',
children: [
{
value: '上海市',
label: '上海市',
children: [
{
value: '浦东新区',
label: '浦东新区'
},
{
value: '嘉定区',
label: '嘉定区'
}
]
}
]
},
{
value: '云南省',
label: '云南省',
children: [
{
value: '昭通市',
label: '昭通市',
children: [
{
value: '彝良县',
label: '彝良县'
}
]
},
{
value: '德宏傣族景颇族自治州',
label: '德宏傣族景颇族自治州',
children: [
{
value: '芒市',
label: '芒市'
}
]
}
]
}
]
};
for (let i = 0; i < 30; i++) {
data.store.push({
// 属性 id 是一个自增数,起始值为 1,每次增 1
id: i + 1,
name: Mock.Random.csentence(1, 3) + '人力资源有限公司',
img: Mock.Random.image('200x100', '#02adea', 'Hello'),
star: Math.floor(Math.random() * 4 + 1),
address: data.options[Math.ceil(Math.random() * 0 + 1)].value,
userNum: Math.floor(Math.random() * 20 + 30),
praiseRate: Math.floor(Math.random() * 50 + 50) + '%',
mack: ['公司注册', '财务审计', '财务报告', '个人社保']
});
}
return data;
};