choose-my-job.vue
9.9 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<template>
<view style=" width: 100%;height: 100%; display: flex;background-color: #F7F7F7;" :style="vuex_theme">
<view class="wrap_box">
<view style="padding: 0 20rpx;">
<u-form :model="form" :error-type="errorType" ref="uForm">
<view class="" style="margin: 50rpx 0;display: flex;align-items: center;">
<view class="event_box" @click="choosePosition">
<text class="text1">期望职位</text>
<text v-if='expectJob_category' class="text2">{{expectJob_category}}</text>
<text v-else class="text3">请选择</text>
</view>
<image src="/static/img/common/arrow_right.png"
style="width: 20rpx;height: 32rpx;float: right;margin-top: 20rpx;"></image>
</view>
<view style="width: 100%;height: 1rpx;background-color: #e4e7ed;"></view>
<view class="" style="margin: 50rpx 0;display: flex;align-items: center;">
<view class="event_box" @click="selectShow = true">
<text class="text1">期望薪资</text>
<text v-if='expect_lower_salary != ""' class="text2">{{`${expect_lower_salary} - ${expect_upper_salary}`}}</text>
<text v-else class="text3">请选择</text>
</view>
<image src="/static/img/common/arrow_right.png"
style="width: 20rpx;height: 32rpx;float: right;margin-top: 20rpx;"></image>
</view>
<view style="width: 100%;height: 1rpx;background-color: #e4e7ed;"></view>
<!-- <c-input-item label="期望薪资" type="select1" name="salary" v-model="form.salary"
:options="selectOptions" :rightIcon="true">
</c-input-item> -->
<c-input-item label="工作区域" type="area1" name="expect_workplace" v-model="form.expect_workplace"
:options="area" :rightIcon="true">
</c-input-item>
</u-form>
</view>
</view>
<view class="footer">
<view style="width: 100%;height: 1rpx;border: 1rpx solid #f7f7f7;"></view>
<view style="padding: 20rpx 40rpx 70rpx 40rpx;" >
<view class="confirm" @click="confirm">确认</view>
</view>
</view>
<u-select v-model="selectShow" :mode="selectMode" :list="selectOptions" confirm-color='var(--primary-color)'
@confirm="selectConfirm"></u-select>
</view>
</template>
<script>
import area from '@/common/area';
import {
salaryOptions
} from '@/common/util.js'
import {
parseInt
} from 'lodash';
export default {
data() {
return {
area,
salaryOptions,
expect_lower_salary: "",
expect_upper_salary: "",
expect_workplaces: [],
form: {
expect_job: "",
salary: "",
expect_workplace: {},
},
fromType: "",
selectMode: "",
selectShow: false,
selectOptions: [],
position_category: '',
sub_category: '',
expectJob_category: '',
}
},
onLoad(option) {
console.log(option)
this.fromType = option ? option.type : ""
if (option.position_category && option.expect_lower_salary) {
this.position_category = option.position_category;
this.sub_category = option.sub_category;
this.expectJob_category = option.expectJob_category;
this.expect_lower_salary = option.expect_lower_salary
this.expect_upper_salary = option.expect_upper_salary
this.expect_workplaces = option.expect_workplaces ? JSON.parse(option.expect_workplaces) : {},
console.log("--", this.expect_workplaces)
this.form.expect_workplace = this.expect_workplaces[0]
}
// if(this.salaryOptions&&this.salaryOptions[0].label.indexOf('不限')!=-1){
// this.salaryOptions.splice(0, 1)
// }
this.selectMode = "mutil-column-auto"
this.xzload()
},
onShow() {
console.log('job_category',this.position_category)
},
// onUnload() {
// if(this.salaryOptions&&this.salaryOptions[0].label.indexOf('不限')==-1){
// this.salaryOptions.splice(0,0,{
// label: '薪酬不限',
// value: '0'
// })
// }
// console.log('onUnload--', this.salaryOptions)
// },
methods: {
choosePosition() {
this.$u.route({
url: '/pages/common/filters-hy/filters-hy',
params: {
firstCategoryName: this.position_category,
secondCategoryName: this.sub_category,
expectJobName: this.expectJob_category,
fromType: '1'
}
})
},
handleSalary() {
return new Promise((resolve, reject) => {
console.log(this.form.salary)
if (this.form.salary == 0) {
this.expect_lower_salary = null
this.expect_upper_salary = null
} else if (this.form.salary == 1) {
this.expect_lower_salary = 0
this.expect_upper_salary = 2000
} else if (this.form.salary == 2) {
this.expect_lower_salary = 2000
this.expect_upper_salary = 5000
} else if (this.form.salary == 3) {
this.expect_lower_salary = 5000
this.expect_upper_salary = 8000
} else if (this.form.salary == 4) {
this.expect_lower_salary = 8000
this.expect_upper_salary = 12000
} else if (this.form.salary == 5) {
this.expect_lower_salary = 12000
this.expect_upper_salary = null
} else {
this.showToast("请选择期望薪资!")
}
console.log("salary--", this.expect_lower_salary, this.expect_upper_salary)
resolve()
})
},
getSalary(){
},
handleArea() {
return new Promise((resolve, reject) => {
if (this.form.expect_workplace) {
this.expect_workplaces = []
this.expect_workplaces.push(this.form.expect_workplace)
} else {
this.showToast("请选择工作区域!")
}
console.log("area--", this.form.expect_workplace, this.expect_workplaces)
resolve()
})
},
async confirm() {
// if (this.form.salary) {
// await this.handleSalary()
// } else {
// this.showToast("请完善信息!")
// }
// if (this.expect_upper_salary == '' && this.expect_lower_salary == '') {
// this.showToast("请完善信息!")
// }
await this.handleArea()
console.log("confirm--", this.expectJob_category, this.expect_upper_salary,this.expect_workplaces)
if (this.expectJob_category && this.expect_upper_salary && this.expect_lower_salary && this.expect_workplaces && this.expect_workplaces.length >0) {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
let cateObj = {
first_category: this.position_category,
second_category: this.sub_category,
expect_job: this.expectJob_category
}
if (this.fromType == "from_edit") {
// prevPage.$vm.detailObj.first_category = this.position_category
// prevPage.$vm.detailObj.second_category = this.sub_category
// prevPage.$vm.detailObj.expectJob_category = this.expectJob_category
// prevPage.$vm.detailObj.salary = this.form.salary + ""
prevPage.$vm.detailObj.expect_job = [cateObj]
prevPage.$vm.detailObj.expect_lower_salary = Number(this.expect_lower_salary)
prevPage.$vm.detailObj.expect_upper_salary = Number(this.expect_upper_salary)
prevPage.$vm.detailObj.expect_workplaces = this.expect_workplaces
prevPage.$vm.expectJob_category = this.expectJob_category
} else {
let salaryIdx = parseInt(this.form.salary) -1
console.log("sallary--",salaryIdx,this.salaryOptions[salaryIdx].label)
prevPage.$vm.form.expect_job = this.sub_category
prevPage.$vm.my_expect = this.sub_category + "," + this.salaryOptions[salaryIdx].label +
"," + this.form.expect_workplace.province +'/'+ this.form.expect_workplace.city +'/'+
this.form.expect_workplace.district;
prevPage.$vm.form.salary = this.form.salary + ""
prevPage.$vm.form.expect_lower_salary = this.expect_lower_salary
prevPage.$vm.form.expect_upper_salary = this.expect_upper_salary
prevPage.$vm.form.expect_workplaces = this.expect_workplaces
prevPage.$vm.form.job_category = this.position_category?this.position_category:""
}
uni.navigateBack({
delta: 1
})
} else {
this.showToast("请完善信息!")
}
},
showToast(msg){
uni.showToast({
title:msg,
icon:'none'
})
},
xzload() {
let list1 = []
for (var i = 1; i < 50; i++) {
let list2 = []
for (var j = 1; j < 10; j++) {
list2.push({
label: (i + j) + '000',
value: (i + j) + '000',
})
}
list1.push({
label: i + '000',
value: i + '000',
children: list2
});
}
this.selectOptions = list1
},
selectConfirm(e) {
this.expect_lower_salary = e[0].value
this.expect_upper_salary = e[1].value
},
}
}
</script>
<style lang="scss" scoped>
.wrap_box {
padding: 40rpx;
background-color: #fff;
margin: 20rpx 20rpx 0 20rpx;
width: 100%;
.text_black_30 {
font-size: 30rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.text_gray_26 {
font-size: 26rpx;
font-family: PingFangSC-Light, PingFang SC;
font-weight: 300;
color: rgba(0, 0, 0, 0.65);
margin-top: 16rpx;
}
.text_gray_30 {
font-size: 30rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0, 0, 0, 0.45);
}
}
.event_box {
display: flex;
flex-direction: column;
width: 100%;
.text1 {
font-size: 26rpx;
font-weight: 400;
line-height: 26rpx;
color: #000000;
}
.text2 {
font-size: 30rpx;
font-family:' PingFangSC-Regular, PingFang SC';
font-weight: 500;
color: #000000;
line-height: 30rpx;
margin-top: 40rpx;
}
.text3{
font-size: 30rpx;
color:rgba(0,0,0,0.45);
line-height: 30rpx;
margin-top: 40rpx;
}
}
.footer {
width: 100%;
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
z-index: 99;
.confirm {
background: linear-gradient(180deg, var(--primary-color000) 0%, var(--primary-color) 100%);
box-shadow: 0px 2px 20px 0px var(--primary-color03);
border-radius: 24px;
padding: 24rpx;
text-align: center;
font-size: 34rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
</style>