util.js
4.2 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
function formatLocation(longitude, latitude) {
if (typeof longitude === 'string' && typeof latitude === 'string') {
longitude = parseFloat(longitude)
latitude = parseFloat(latitude)
}
longitude = longitude.toFixed(2)
latitude = latitude.toFixed(2)
return {
longitude: longitude.toString().split('.'),
latitude: latitude.toString().split('.')
}
}
const formatPosition = function(res) {
let postChildren = function(params) {
if (params.length == 0) return [];
let child = []
params.map((item, index) => {
child.push({
label: item,
value: item,
})
})
return child
}
if (res && res.categories && res.categories.length > 0) {
const {
categories = []
} = res;
let result = []
categories.map((item, index) => {
result.push({
label: item.name,
value: item.name,
children: postChildren(item.sub_categories || [])
})
})
return result
} else {
return []
}
}
const getLabel = function(options, initValue, i, result) {
if (i > initValue.length - 1) {
console.log(result)
return result
}
if (initValue && initValue.length > 0) {
let tempOption = options.filter(item => {
return item.value == initValue[i]
})
let tempObject = tempOption[0]
result.push({
label: tempObject.label,
value: tempObject.value,
})
i++
return getLabel(tempObject.children, initValue, i, result)
}
}
const genderOptions = [{
label: '男',
value: "0",
},
{
label: '女',
value: "1",
}
];
const commonOptions = [{
label: '是',
value: "yes",
},
{
label: '否',
value: "no",
}
];
const marriedOptions = [{
label: '已婚',
value: "1",
},
{
label: '未婚',
value: "2",
},
];
const degreeOptions = [{
label: '不限',
value: '1'
},
{
label: '初中',
value: '2'
},
{
label: '高中',
value: '3'
},
{
label: '中专/技校',
value: '8'
},
{
label: '大专',
value: '4'
},
{
label: '本科',
value: '5'
},
{
label: '硕士',
value: '6'
},
{
label: '博士',
value: '7'
},
{
label: 'MBA/EMBA',
value: '9'
},
];
//岗位类别
const positionTypeOptions = [{
value: '',
label: "全部",
},
{
value: 'manufacture',
label: "智能制造",
},
{
value: 'preschool',
label: "学前教育",
}, {
value: 'healthy',
label: "智慧康养",
}, {
value: 'software',
label: "大数据与软件",
}, {
value: 'other',
label: "其他",
},
];
//岗位性质
const positionPropOptions = [{
value: 'part_time',
label: "兼职",
},
{
value: 'internship',
label: "实习",
}, {
value: 'full_time',
label: "全职",
}, {
value: 'other',
label: "其他",
},
];
//薪资类型
const salaryTypeOptions = [{
value: 'negotiable',
label: "薪资面议",
}, {
// value: 'annual',
// label: "年薪",
// },{
value: 'monthly',
label: "月薪",
}, {
value: 'daily',
label: "日薪",
}, {
label: "时薪",
value: 'hourly',
}, ];
const schoolTypeOptions = [{
label: '高职(高专)院校',
value: 'vocational'
}, {
label: '中等职业技术学院',
value: "secondary_vocational",
}, {
label: '技工学校(技校)',
value: "technical",
}, {
label: '全日制大学',
value: "full_time",
}, {
label: '民办独立学院',
value: "civilian_run",
}, {
label: '其他',
value: "other",
}]
const unitOptions = [{ //计费单位
label: '时',
value: "hourly",
},
{
label: '月',
value: "monthly",
},
];
const unitTypeOptions = [{ //委托招聘计费类型
label: '打包服务费',
value: "packing",
},
{
label: '招聘服务费',
value: "recruiting",
},
];
const ageTypeOptions = [{ //年龄类型
label: '年满16周岁',
value: "16years",
},
{
label: '年满18周岁',
value: "18years",
},
];
module.exports = {
formatLocation,
formatPosition,
getLabel,
genderOptions,
marriedOptions,
degreeOptions,
positionTypeOptions,
positionPropOptions,
salaryTypeOptions,
schoolTypeOptions,
unitOptions,
ageTypeOptions,
commonOptions,
unitTypeOptions
}