enroll.js
9.8 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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
enroll_arr: ['线上', '线下', '线上及线下'],
check_arr: [
"摄影(设备自带",
"摄像(设备自带",
"爱心车队",
"现场服务(签到、指引、礼仪等",
"线上答疑",
"门诊服务"
],
time_arr: [
"上午", "下午"
],
eat_arr: [
'午餐', '晚餐'
],
date_arr: [
"2019-07-21",
"2019-07-22",
"2019-07-23",
"2019-07-24"
],
t_arr: [{ //选择日期数组
date: '',
time: ''
}],
z_arr: [ //申请入住数组
{
date: '',
idcard: ''
}
],
e_arr: [ //申请用餐数组
{
date: '',
time: ''
}
],
t_type: false,
z_type: false,
e_type: false,
cover_type: false
},
// 审核用户信息是否通过
examine(e){
let that = this
let id = e.currentTarget.dataset.id
let url = 'index/member_center/adminApprove';
let head = {
'XX-Token': wx.getStorageSync('token')
}
let params = {
id: that.data.user_id,
status: id
}
app.post(url, params, head).then((res) => {
wx.showToast({
title: '操作成功',
icon: 'success',
duration: 1000,
success: () => {
that.setData({
two_type: true
})
}
})
}).catch((err) => { })
},
//查看工作汇报
look_word(){
if (this.data.info.is_complete !=1){
wx.showToast({
title: '该用户还未提交工作汇报',
icon: 'none'
})
return
}
wx.navigateTo({
url: '/pages/word_report/word_report?id=' + this.data.id + '&user_id=' + this.data.user_id,
})
},
//查看注册信息
look_register(){
wx.navigateTo({
url: '/pages/apply/apply?id=' + this.data.user_id + '&is_submit=' + 1 + '&type=1',
})
},
// 输入信息
get_word(e) {
this.setData({
word: e.detail.value
})
},
// 改变弹窗状态
change_cover(e) {
this.setData({
cover_type: !this.data.cover_type
})
},
// 添加时间
add_time() {
let that = this
if (!that.data.word) {
wx.showToast({
title: '请输入工时',
icon: 'none',
duration: 1000
})
return
}
let url = 'index/member_center/addTime';
let head = {
'XX-Token': wx.getStorageSync('token')
}
let params = {
user_id: that.data.user_id,
add_time: that.data.word
}
app.post(url, params, head).then((res) => {
wx.showToast({
title: '操作成功',
icon: 'success',
duration: 1000,
success: () => {
that.setData({
word: null,
cover_type: false
})
}
})
}).catch((err) => { })
},
// 选择参加日期,入住日期,用餐日期
change_date(e) {
let that = this
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let zindex = Number(e.detail.value)
if (id == 1) {
that.setData({
[`t_arr[${index}].date`]: that.data.date_arr[zindex]
})
} else if (id == 2) {
that.setData({
[`z_arr[${index}].date`]: that.data.date_arr[zindex]
})
} else if (id == 3) {
that.setData({
[`e_arr[${index}].date`]: that.data.date_arr[zindex]
})
}
that.judge_status(id, index)
},
// 信息状态判断
judge_status(type, index) {
let that = this
if (type == 1) {
if (that.data.t_arr[index].date != "" && that.data.t_arr[index].time != "") {
that.setData({
t_type: true
})
}
} else if (type == 2) {
if (that.data.z_arr[index].date != "" && that.data.z_arr[index].idcard != "") {
that.setData({
z_type: true
})
}
} else if (type == 3) {
if (that.data.e_arr[index].date != "" && that.data.e_arr[index].time != "") {
that.setData({
e_type: true
})
}
}
},
// 选择参加时间
change_time(e) {
let index = Number(e.currentTarget.dataset.index)
let zindex = Number(e.detail.value)
this.setData({
[`t_arr[${index}].time`]: this.data.time_arr[zindex]
})
this.judge_status(1,index)
},
// 选择用餐时间
eat_time(e) {
let index = Number(e.currentTarget.dataset.index)
let zindex = Number(e.detail.value)
this.setData({
[`e_arr[${index}].time`]: this.data.eat_arr[zindex]
})
this.judge_status(3, index)
},
//输入身份证号
get_card(e) {
let index = Number(e.currentTarget.dataset.index)
this.setData({
[`z_arr[${index}].idcard`]: e.detail.value
})
this.judge_status(2, index)
},
// 添加日期,入住,用餐
add_item(e) {
let id = e.currentTarget.dataset.id
let arr
if (id == 1) {
if (this.data.t_type == false){
wx.showToast({
title: '请先完善选择日期信息',
icon: 'none'
})
return
}
arr = this.data.t_arr
arr.push({
date: '',
time: ''
})
this.setData({
t_arr: arr,
t_type: false
})
} else if (id == 2) {
if (this.data.z_type == false) {
wx.showToast({
title: '请先完善申请入住信息',
icon: 'none'
})
return
}
arr = this.data.z_arr
arr.push({
date: '',
idcard: ''
})
this.setData({
z_arr: arr,
z_type: false
})
} else if (id == 3) {
if (this.data.e_type == false) {
wx.showToast({
title: '请先完善申请用餐信息',
icon: 'none'
})
return
}
arr = this.data.e_arr
arr.push({
date: '',
time: ''
})
this.setData({
e_arr: arr,
e_type: false
})
}
},
// 获取工作类型
change_enroll(e) {
let index = Number(e.detail.value)
this.setData({
type: this.data.enroll_arr[index],
type_id: index + 1
})
},
// 获取工作内容
change_check(e) {
let index = Number(e.detail.value)
this.setData({
check: this.data.check_arr[index],
check_id: index + 1
})
},
//获取信息
get_info(id) {
let url = 'index/index/getApplyInfo'
let params = {
id: id
}
let header = {
'XX-Token': wx.getStorageSync('token')
}
app.post(url, params, header).then((res) => {
this.setData({
info: res,
type_id: res.work_type ? res.work_type: null,
type: res.work_type ? this.data.enroll_arr[Number(res.work_type) - 1]:null,
check_id: res.work_content ? res.work_content : null,
check: res.work_content ? this.data.check_arr[Number(res.work_content) - 1] : null,
t_arr: res.select_time ? res.select_time : this.data.t_arr,
z_arr: res.apply_stay ? res.apply_stay : this.data.z_arr,
e_arr: res.apply_food ? res.apply_food : this.data.e_arr,
t_type: res.select_time?true:false,
z_type: res.apply_stay ? true : false,
e_type: res.apply_food ? true : false
})
})
},
//信息判断过滤
submit() {
let that = this
if (!that.data.type_id) {
wx.showToast({
title: '请选择工作类型',
icon: 'none'
})
return
}
if (!that.data.check_id) {
wx.showToast({
title: '请选择工作内容',
icon: 'none'
})
return
}
if (that.data.t_type == false) {
wx.showToast({
title: '请先完善选择日期信息',
icon: 'none'
})
return
}
if (that.data.z_type == false) {
wx.showToast({
title: '请先完善申请入住信息',
icon: 'none'
})
return
}
if (that.data.e_type == false) {
wx.showToast({
title: '请先完善申请用餐信息',
icon: 'none'
})
return
}
that.push()
},
//提交
push() {
let that = this
let url = that.data.page_type ?'index/index/editApply ':'index/index/applyJoin'
let params = {
id: that.data.id,
type: that.data.type_id,
work_content: that.data.check_id,
select_time: JSON.stringify(that.data.t_arr),
apply_stay: JSON.stringify(that.data.z_arr),
apply_food: JSON.stringify(that.data.e_arr)
}
let header = {
'XX-Token': wx.getStorageSync('token')
}
app.post(url, params, header).then((res) => {
wx.showToast({
title: '报名成功,请等待审核',
duration: 1000,
success: ()=>{
setTimeout(()=>{
wx.setStorageSync('page_type', true)
wx.navigateBack({
delta: 1
})
},1000)
}
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.type){
this.setData({
t_type: true,
z_type: true,
e_type: true,
page_type: options.type
})
}
this.setData({
id: options.id,
status: options.status ? options.status : null,
user_id: options.user_id ? options.user_id : null
})
this.get_info(options.id)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})