|
@@ -2,412 +2,51 @@ const app = getApp();
|
2
|
2
|
Page({
|
3
|
3
|
|
4
|
4
|
data: {
|
5
|
|
- //身份证手持页
|
6
|
|
- // 上传的案例图片集合
|
7
|
|
- scsfzImages: [],
|
8
|
|
- // 案例图片数目是否达到了最大数目
|
9
|
|
- scsfzImagesNum: false, //加号图标 显示
|
10
|
|
- scsfzimg: true, //上传图片 隐藏
|
11
|
|
- scsfzinitial: true, //初始图片 隐藏
|
12
|
|
-
|
13
|
|
- // 身份证头像页
|
14
|
|
- sfztxyImages: [],
|
15
|
|
- sfztxyImagesNum: false, //加号图标 显示
|
16
|
|
- sfztxyimg: true, //上传图片隐藏
|
17
|
|
- // sfztxyinitial: true, //初始图片 隐藏
|
18
|
|
-
|
19
|
|
- // 身份证反面页
|
20
|
|
- sfzfmImages: [],
|
21
|
|
- sfzfmImagesNum: false, //加号图标 显示
|
22
|
|
- sfzfmimg: true, //上传图片 隐藏
|
23
|
|
- // sfzfminitial: true, //初始图片 隐藏
|
24
|
|
-
|
25
|
|
- // 设置上传案例图片的最大数目
|
26
|
|
- maxImages: 1,
|
27
|
|
-
|
28
|
|
-
|
29
|
|
- loadingHidden: false, //加载中
|
30
|
|
-
|
31
|
|
- name: '', //姓名
|
32
|
|
- number: '', //证件号码
|
33
|
|
- hold: '', //手持身份证
|
34
|
|
- positive: '', //身份证正面
|
35
|
|
- opposite: '', //身份证反面
|
36
|
|
-
|
37
|
|
- initial: [], //头部信息
|
38
|
|
-
|
39
|
|
-
|
40
|
|
- SubmissionHidden: true, //提交隐藏显示
|
41
|
|
-
|
42
|
|
-
|
43
|
|
- isShow: false,
|
|
5
|
+ initial:'',
|
44
|
6
|
},
|
45
|
7
|
|
46
|
8
|
/**
|
47
|
9
|
* 生命周期函数--监听页面加载
|
48
|
10
|
*/
|
49
|
11
|
onLoad: function (options) {
|
50
|
|
- var that = this;
|
51
|
|
-
|
52
|
|
- // 获取信息
|
53
|
|
- let initial_url = 'my/authentication/ididentitychange';
|
54
|
|
- let initial_data = {
|
55
|
|
- };
|
56
|
|
- app.postRequest(initial_url, initial_data, function (res) {
|
57
|
|
- if (res.code == 201) {
|
58
|
|
- console.log(res.data.hold);
|
59
|
|
- that.setData({
|
60
|
|
- initial: res.data, // 初始数据
|
61
|
|
- initialcode: res, //获取未上传状态
|
62
|
|
-
|
63
|
|
- name: res.data.name, //姓名
|
64
|
|
- number: res.data.number, //证件号码
|
65
|
|
-
|
66
|
|
- })
|
67
|
|
- }
|
|
12
|
+ var that = this;
|
68
|
13
|
|
69
|
|
- if (res.data.status == 2){ //如果审核通过 隐藏掉提交按钮
|
|
14
|
+ // 获取信息
|
|
15
|
+ let initial_url = 'my/authentication/ididentitychange';
|
|
16
|
+ let initial_data = {
|
|
17
|
+ };
|
|
18
|
+ app.postRequest(initial_url, initial_data, function (res) {
|
|
19
|
+ if (res.code == 201) {
|
|
20
|
+ console.log(res.data);
|
|
21
|
+ console.log(res.data.hold);
|
70
|
22
|
that.setData({
|
71
|
|
- SubmissionHidden: false
|
72
|
|
- })
|
73
|
|
- } else if (res.code != 201) {
|
74
|
|
- that.setData({
|
75
|
|
- SubmissionHidden: false
|
76
|
|
- })
|
77
|
|
- }else{
|
78
|
|
- that.setData({
|
79
|
|
- SubmissionHidden: true
|
80
|
|
- })
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
-
|
84
|
|
-
|
85
|
|
- })
|
86
|
|
-
|
87
|
|
-
|
88
|
|
- },
|
89
|
|
-
|
90
|
|
-
|
91
|
|
- //获取姓名
|
92
|
|
- ObtainName: function (e) {
|
93
|
|
- var name = e.detail.value;
|
94
|
|
- console.log(name);
|
95
|
|
- this.setData({
|
96
|
|
- name: name
|
97
|
|
- });
|
98
|
|
- },
|
99
|
|
-
|
100
|
|
- //获取身份证
|
101
|
|
- Obtainsfz: function (e) {
|
102
|
|
- var number = e.detail.value;
|
103
|
|
- console.log(number);
|
104
|
|
- this.setData({
|
105
|
|
- number: number
|
106
|
|
- });
|
107
|
|
- },
|
108
|
|
-
|
109
|
|
-
|
110
|
|
- // 上传手持身份证
|
111
|
|
- scsfzclick: function (e) {
|
112
|
|
- var _this = this;
|
113
|
|
- wx.chooseImage({
|
114
|
|
- count: 1,
|
115
|
|
- sizeType: ['original', 'compressed'],
|
116
|
|
- sourceType: ['album', 'camera'],
|
117
|
|
- success(res) {
|
118
|
|
-
|
119
|
|
- let tempFilesSize = res.tempFiles[0].size;
|
120
|
|
-
|
121
|
|
- if (tempFilesSize > 1024 * 1024 * 3){
|
122
|
|
-
|
123
|
|
- wx.showModal({
|
124
|
|
- title: '提示',
|
125
|
|
- content: '图片不得超过3MB',
|
126
|
|
- showCancel: false,
|
127
|
|
- })
|
128
|
|
-
|
129
|
|
- return;
|
130
|
|
- }
|
131
|
|
-
|
132
|
|
- wx.showToast({
|
133
|
|
-
|
134
|
|
- title: '上传中...',
|
135
|
|
-
|
136
|
|
- icon: 'loading'
|
137
|
|
-
|
138
|
|
- });
|
139
|
|
-
|
140
|
|
-
|
141
|
|
-
|
142
|
|
-
|
143
|
|
- // 头部信息
|
144
|
|
- let dt_url = 'my/images/tempimages';
|
145
|
|
- let dt_filePath = res.tempFilePaths[0];
|
146
|
|
-
|
147
|
|
- app.Multigraph(dt_url, dt_filePath,function(res){
|
148
|
|
-
|
149
|
|
- if (res.code==201){
|
150
|
|
- // console.log(res.data.img_name);
|
151
|
|
-
|
152
|
|
-
|
153
|
|
- _this.setData({
|
154
|
|
- scsfzImages: dt_filePath,
|
155
|
|
- scsfzImagesNum: true,
|
156
|
|
- scsfzimg: false,
|
157
|
|
- hold:res.data.img_name, //手持身份证
|
158
|
|
- });
|
159
|
|
-
|
160
|
|
- wx.showToast({
|
161
|
|
- title: '上传成功',
|
162
|
|
- icon: 'none', // 不显示图标
|
163
|
|
- duration: 2000
|
164
|
|
- })
|
165
|
|
-
|
166
|
|
- return;
|
167
|
|
- }
|
168
|
|
-
|
169
|
|
- app.Tips(res.msg);
|
|
23
|
+ initial: res.data, // 初始数据
|
170
|
24
|
|
171
|
|
- });
|
172
|
|
-
|
173
|
|
- }
|
174
|
|
- })
|
175
|
|
- },
|
176
|
|
-
|
177
|
|
- // 正面页
|
178
|
|
- sfztxyclick: function (e) {
|
179
|
|
- var _this = this;
|
180
|
|
- wx.chooseImage({
|
181
|
|
- count: 1,
|
182
|
|
- sizeType: ['original', 'compressed'],
|
183
|
|
- sourceType: ['album', 'camera'],
|
184
|
|
- success(res) {
|
185
|
|
-
|
186
|
|
-
|
187
|
|
- let tempFilesSize = res.tempFiles[0].size;
|
188
|
|
-
|
189
|
|
- if (tempFilesSize > 1024 * 1024 * 3) {
|
190
|
|
-
|
191
|
|
- wx.showModal({
|
192
|
|
- title: '提示',
|
193
|
|
- content: '图片不得超过3MB',
|
194
|
|
- showCancel: false,
|
195
|
|
- })
|
196
|
|
-
|
197
|
|
- return;
|
198
|
|
- }
|
199
|
|
-
|
200
|
|
-
|
201
|
|
- wx.showToast({
|
202
|
|
-
|
203
|
|
- title: '上传中...',
|
204
|
|
-
|
205
|
|
- icon: 'loading'
|
|
25
|
+ name: res.data.name, //姓名
|
|
26
|
+ number: res.data.number, //证件号码
|
206
|
27
|
|
207
|
|
- });
|
208
|
|
-
|
209
|
|
- // 头部信息
|
210
|
|
- let dt_url = 'my/images/tempimages';
|
211
|
|
- let dt_filePath = res.tempFilePaths[0];
|
212
|
|
-
|
213
|
|
- app.Multigraph(dt_url, dt_filePath, function (res) {
|
214
|
|
-
|
215
|
|
- if (res.code == 201) {
|
216
|
|
- // console.log(res.data.img_name);
|
217
|
|
- _this.setData({
|
218
|
|
- sfztxyImages: dt_filePath,
|
219
|
|
- sfztxyImagesNum: true,
|
220
|
|
- sfztxyimg: false,
|
221
|
|
- positive: res.data.img_name,
|
222
|
|
- });
|
223
|
|
-
|
224
|
|
- wx.showToast({
|
225
|
|
- title: '上传成功',
|
226
|
|
- icon: 'none', // 不显示图标
|
227
|
|
- duration: 2000
|
228
|
|
- })
|
229
|
|
-
|
230
|
|
- return;
|
231
|
|
- }
|
232
|
|
-
|
233
|
|
- app.Tips(res.msg);
|
234
|
|
-
|
235
|
|
- });
|
236
|
|
-
|
237
|
|
-
|
238
|
|
-
|
239
|
|
- }
|
240
|
|
-
|
241
|
|
- })
|
242
|
|
- },
|
243
|
|
-
|
244
|
|
- // 反面页
|
245
|
|
- sfzfmclick: function (e) {
|
246
|
|
- var _this = this;
|
247
|
|
- wx.chooseImage({
|
248
|
|
- count: 1,
|
249
|
|
- sizeType: ['original', 'compressed'],
|
250
|
|
- sourceType: ['album', 'camera'],
|
251
|
|
- success(res) {
|
252
|
|
- // console.log(res.tempFilePaths[0]);
|
253
|
|
- // tempFilePath可以作为img标签的src属性显示图片
|
254
|
|
-
|
255
|
|
-
|
256
|
|
- let tempFilesSize = res.tempFiles[0].size;
|
257
|
|
-
|
258
|
|
- if (tempFilesSize > 1024 * 1024 * 3) {
|
259
|
|
-
|
260
|
|
- wx.showModal({
|
261
|
|
- title: '提示',
|
262
|
|
- content: '图片不得超过3MB',
|
263
|
|
- showCancel: false,
|
264
|
|
- })
|
265
|
|
-
|
266
|
|
- return;
|
267
|
|
- }
|
268
|
|
-
|
269
|
|
- wx.showToast({
|
270
|
|
-
|
271
|
|
- title: '上传中...',
|
272
|
|
-
|
273
|
|
- icon: 'loading'
|
274
|
|
-
|
275
|
|
- });
|
276
|
|
-
|
277
|
|
-
|
278
|
|
- // 头部信息
|
279
|
|
- let dt_url = 'my/images/tempimages';
|
280
|
|
- let dt_filePath = res.tempFilePaths[0];
|
281
|
|
-
|
282
|
|
- app.Multigraph(dt_url, dt_filePath, function (res) {
|
283
|
|
-
|
284
|
|
- if (res.code == 201) {
|
285
|
|
- // console.log(res.data.img_name);
|
286
|
|
- _this.setData({
|
287
|
|
- sfzfmImages:dt_filePath,
|
288
|
|
- sfzfmImagesNum: true,
|
289
|
|
- sfzfmimg: false,
|
290
|
|
- opposite:res.data.img_name,
|
291
|
|
- });
|
292
|
|
-
|
293
|
|
- wx.showToast({
|
294
|
|
- title: '上传成功',
|
295
|
|
- icon: 'none', // 不显示图标
|
296
|
|
- duration: 2000
|
297
|
|
- })
|
298
|
|
-
|
299
|
|
- return;
|
300
|
|
- }
|
301
|
|
-
|
302
|
|
-
|
303
|
|
- app.Tips(res.msg);
|
304
|
|
-
|
305
|
|
- });
|
306
|
|
-
|
307
|
|
-
|
308
|
|
-
|
309
|
|
- }
|
310
|
|
-
|
311
|
|
- })
|
312
|
|
- },
|
313
|
|
-
|
314
|
|
-
|
315
|
|
- //最后提交认证
|
316
|
|
-Submission: function (e) {
|
317
|
|
- var _this =this;
|
318
|
|
-
|
319
|
|
- console.log(this.data.name)
|
320
|
|
- console.log(this.data.number)
|
321
|
|
- console.log(this.data.hold)
|
322
|
|
- console.log(this.data.positive)
|
323
|
|
- console.log(this.data.opposite)
|
324
|
|
-
|
325
|
|
-
|
326
|
|
- if (this.data.name == '') {
|
327
|
|
- var _name = '请填写您的真实姓名'
|
328
|
|
- Tips(_name)
|
329
|
|
- } else if (this.data.number == '') {
|
330
|
|
- var _number = '请填写本人身份证号码'
|
331
|
|
- Tips(_number)
|
332
|
|
- } else if (this.data.hold == '') {
|
333
|
|
- var _hold = '请上传手持身份证'
|
334
|
|
- Tips(_hold)
|
335
|
|
- } else if (this.data.positive == '') {
|
336
|
|
- var _positive = '请上传身份证头像页'
|
337
|
|
- Tips(_positive)
|
338
|
|
- } else if (this.data.opposite == '') {
|
339
|
|
- var _opposite = '请上传身份证反面页'
|
340
|
|
- Tips(_opposite)
|
341
|
|
- } else {
|
342
|
|
-
|
343
|
|
- let income_url = 'my/authentication/ididentity';
|
344
|
|
- let income_data = {
|
345
|
|
- name: this.data.name, //姓名
|
346
|
|
- number: this.data.number, //证件号码
|
347
|
|
- hold: this.data.hold, //手持身份证
|
348
|
|
- positive: this.data.positive, //身份证正面
|
349
|
|
- opposite: this.data.opposite, //身份证反面
|
350
|
|
- };
|
351
|
|
- app.postRequest(income_url, income_data, function (res) {
|
352
|
|
- console.log(res)
|
353
|
|
- if (res.code == 201) {
|
354
|
|
- wx.showToast({
|
355
|
|
- title: '提交成功',
|
356
|
|
- icon: 'success',
|
357
|
|
- duration: 2000
|
358
|
28
|
})
|
359
|
|
- _this.onLoad();
|
360
|
|
- return
|
361
|
29
|
}
|
362
|
30
|
|
363
|
|
- // console.log(res.data.name)
|
364
|
|
- // console.log(res.data.number)
|
365
|
|
- if (res.data.name){
|
366
|
|
- _this.setData({
|
367
|
|
- text1: res.data.name,
|
368
|
|
- isShow: true,
|
369
|
|
- });
|
370
|
31
|
|
371
|
|
- }
|
372
|
|
-
|
373
|
|
- if (res.data.number) {
|
374
|
|
- _this.setData({
|
375
|
|
- text2: res.data.number,
|
376
|
|
- isShow: true,
|
377
|
|
- });
|
378
|
|
-
|
379
|
|
- }
|
380
|
|
-
|
381
|
|
- setTimeout(function () {
|
382
|
|
- _this.setData({
|
383
|
|
- text1: '',
|
384
|
|
- text2: '',
|
385
|
|
- isShow: false,
|
386
|
|
- });
|
387
|
|
- }, 2000)
|
388
|
|
-
|
389
|
32
|
|
390
|
33
|
})
|
|
34
|
+ },
|
|
35
|
+
|
|
36
|
+ // 相册点击放大
|
|
37
|
+ enlarge: function (e) {
|
|
38
|
+ var that = this;
|
|
39
|
+ // console.log(that.data.uploadImages)
|
|
40
|
+ // console.log(e.currentTarget.dataset.src)
|
|
41
|
+ wx.previewImage({
|
|
42
|
+ current: e.currentTarget.dataset.src,
|
|
43
|
+ urls: [e.currentTarget.dataset.src],
|
|
44
|
+ })
|
391
|
45
|
|
392
|
|
- }
|
393
|
|
-
|
394
|
|
-
|
395
|
|
-
|
396
|
|
-
|
397
|
|
-},
|
398
|
46
|
|
|
47
|
+ },
|
399
|
48
|
|
400
|
49
|
|
401
|
50
|
|
402
|
51
|
})
|
403
|
52
|
|
404
|
|
-// 提示框
|
405
|
|
-function Tips(text) {
|
406
|
|
-
|
407
|
|
- wx.showToast({
|
408
|
|
- title: text,
|
409
|
|
- icon: 'none', // 不显示图标
|
410
|
|
- duration: 2500
|
411
|
|
- })
|
412
|
|
-
|
413
|
|
-}
|