myResume.js
7.1 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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
// pages/myResume/myResume.js
const app=getApp()
Page({
/**
* 页面的初始数据
*/
data: {
images: '',
date: '',
educationArray: [],
// objectArray: [
// {
// id: 0,
// name: '美国'
// },
// {
// id: 1,
// name: '中国'
// },
// {
// id: 2,
// name: '巴西'
// },
// {
// id: 3,
// name: '日本'
// }
// ],
educationIndex: 0,
workYearArray: ['1年', '2年', '3年', '4年', '5年'],
// objectArray: [
// {
// id: 0,
// name: '美国'
// },
// {
// id: 1,
// name: '中国'
// },
// {
// id: 2,
// name: '巴西'
// },
// {
// id: 3,
// name: '日本'
// }
// ],
workYearIndex: 0,
resume:'',
//头像
avatar:'',
//学历名称
educationtitle:'请选择',
workexp:'请选择工作年限',
resume_brief:"",
contentlen:0,
resume_sex:1,
//在职离职
resume_is_bejob:1,
resume_name:'',
//家乡
resume_home:'',
educationid:25,
user_nickname:''
},
//性别
man(){
this.setData({
resume_sex:1
})
},
woman(){
this.setData({
resume_sex:2
})
},
// 出生日期
bindDateChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
date: e.detail.value
})
},
//家乡
resume_home(){
this.setData({
resume_home:e.detail.value
})
},
//获取学历
geteducation(){
let that = this;
var url = 'index/category/education';
var params = {
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
educationArray:res.data
})
}).catch((err) => {
})
},
// 学历
education: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
educationIndex: e.detail.value,
educationtitle: this.data.educationArray[e.detail.value].education_name,
educationid: this.data.educationArray[e.detail.value].id
})
},
// 工作年限
workYear: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
workYearIndex: e.detail.value,
workexp: this.data.workYearArray[e.detail.value]
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
date: app.newnowDate()
})
this.geteducation()
this.getResume2();
},
//姓名
entername(e){
this.setData({
resume_name:e.detail.value
})
},
//手机号
entermobile(e){
this.setData({
resume_mobile:e.detail.value
})
},
// 选择图片
chooseImage: function () {
// 选择图片
wx.chooseImage({
count: 3, // 默认9
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
// 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
console.log(res)
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
var tempFilePaths = res.tempFilePaths;
that.setData({
images: that.data.image.concat(tempFilePaths)
})
console.log(images)
// if (that.data.companyortrue == true) {
// that.setData({
// companyimages: that.data.companyimages.concat(tempFilePaths)
// });
// } else {
// that.setData({
// images: that.data.images.concat(tempFilePaths)
// });
// }
}
})
},
//家乡
enterhome(e){
this.setData({
resume_home:e.detail.value
})
},
//输入简介
enterword(e){
this.setData({
contentlen:e.detail.value.length,
resume_brief:e.detail.value
})
},
//在职离职
atjob(){
this.setData({
resume_is_bejob:1
})
},
noatjob(){
this.setData({
resume_is_bejob:2
})
},
//获取
getResume2() {
let that = this;
let url = 'index/user/me_resume';
let params = {
}
let header = {
"XX-Token": wx.getStorageSync('token'),
"XX-Device-Type": 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res);
that.setData({
avatar: res.data.avatar,
user_nickname: res.data.user_nickname
})
if (res.data.resume_brief!=null){
that.setData({
})
}
if (res.data.resume_name!=null){
console.log(12345678)
// 获取值
that.setData({
resume: res.data,
date: res.data.resume_birthday,
avatar: res.data.avatar,
educationtitle: res.data.education_name,
workexp: res.data.resume_exp,
resume_brief: res.data.resume_brief,
// contentlen: res.data.resume_brief.length,
resume_sex: res.data.resume_sex,
resume_is_bejob: res.data.resume_is_bejob,
resume_name: res.data.resume_name,
resume_mobile: res.data.resume_mobile,
resume_home: res.data.resume_home,
educationid: res.data.resume_education_id
})
}
console.log(that.data.resume);
console.log(that.data.avatar)
}).catch((err) => {
})
},
//更新简历
changeresume(){
let that = this;
let reg = reg = /^[1][3,4,5,7,8][0-9]{9}$/
if (!reg.test(that.data.resume_mobile)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none'
})
return false
}
var url = 'index/user/save_resume';
var params = {
resume_name: that.data.resume_name,
resume_sex: that.data.resume_sex,
resume_mobile: that.data.resume_mobile,
resume_birthday:that.data.date,
resume_education_id:that.data.educationid,
resume_exp: that.data.workexp,
resume_is_bejob: that.data.resume_is_bejob,
resume_brief: that.data.resume_brief,
resume_home: that.data.resume_home
}
var header={
'XX-Token': wx.getStorageSync('token'),
}
app.post(url, params,header).then((res) => {
console.log(res);
if(res.data==''){
wx.showToast({
title: '发布成功',
icon:'none'
})
setTimeout(function(){
wx.navigateBack({
checked:true
})
},1500)
}
}).catch((err) => {
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})