|
@@ -3,6 +3,8 @@ var format = require('../../../utils/util.js'); |
|
@@ -3,6 +3,8 @@ var format = require('../../../utils/util.js'); |
3
|
const reg_18_Number = /^[0-9]{18}$/;
|
3
|
const reg_18_Number = /^[0-9]{18}$/;
|
4
|
const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/;
|
4
|
const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/;
|
5
|
const reg_15_n_a = /^([a-zA-z]|[0-9]){15}$/;
|
5
|
const reg_15_n_a = /^([a-zA-z]|[0-9]){15}$/;
|
|
|
6
|
+var baseUrl = getApp().globalData.baseUrl;
|
|
|
7
|
+let Authorization = '';
|
6
|
Page({
|
8
|
Page({
|
7
|
/**
|
9
|
/**
|
8
|
* Page initial data
|
10
|
* Page initial data
|
|
@@ -10,25 +12,23 @@ Page({ |
|
@@ -10,25 +12,23 @@ Page({ |
10
|
data: {
|
12
|
data: {
|
11
|
is_foreigner: false,
|
13
|
is_foreigner: false,
|
12
|
btn_text: "下一步",
|
14
|
btn_text: "下一步",
|
13
|
- info_steps: [
|
|
|
14
|
- {
|
|
|
15
|
- label: '身份信息',
|
|
|
16
|
- status: 'success'
|
|
|
17
|
- }, {
|
|
|
18
|
- label: '上传证件照',
|
|
|
19
|
- status: 'circle'
|
|
|
20
|
- }
|
|
|
21
|
- ],
|
15
|
+ info_steps: [{
|
|
|
16
|
+ label: '身份信息',
|
|
|
17
|
+ status: 'success'
|
|
|
18
|
+ }, {
|
|
|
19
|
+ label: '上传证件照',
|
|
|
20
|
+ status: 'circle'
|
|
|
21
|
+ }],
|
22
|
cardTypeArray: ['中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'],
|
22
|
cardTypeArray: ['中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'],
|
23
|
cardtype: "",
|
23
|
cardtype: "",
|
24
|
- card_number:"",
|
|
|
25
|
- name:"",
|
24
|
+ card_number: "",
|
|
|
25
|
+ name: "",
|
26
|
},
|
26
|
},
|
27
|
|
27
|
|
28
|
/**
|
28
|
/**
|
29
|
* Lifecycle function--Called when page load
|
29
|
* Lifecycle function--Called when page load
|
30
|
*/
|
30
|
*/
|
31
|
- onLoad: function (options) {
|
31
|
+ onLoad: function(options) {
|
32
|
console.log("options", options);
|
32
|
console.log("options", options);
|
33
|
this.setData({
|
33
|
this.setData({
|
34
|
is_foreigner: options.foreigner,
|
34
|
is_foreigner: options.foreigner,
|
|
@@ -39,18 +39,18 @@ Page({ |
|
@@ -39,18 +39,18 @@ Page({ |
39
|
/**
|
39
|
/**
|
40
|
* Lifecycle function--Called when page is initially rendered
|
40
|
* Lifecycle function--Called when page is initially rendered
|
41
|
*/
|
41
|
*/
|
42
|
- onReady: function () {
|
42
|
+ onReady: function() {
|
43
|
|
43
|
|
44
|
},
|
44
|
},
|
45
|
|
45
|
|
46
|
/**
|
46
|
/**
|
47
|
* Lifecycle function--Called when page show
|
47
|
* Lifecycle function--Called when page show
|
48
|
*/
|
48
|
*/
|
49
|
- onShow: function () {
|
49
|
+ onShow: function() {
|
50
|
|
50
|
|
51
|
},
|
51
|
},
|
52
|
|
52
|
|
53
|
- bindCardtypeChange: function (e) {
|
53
|
+ bindCardtypeChange: function(e) {
|
54
|
console.log("bindCardtypeChange", e)
|
54
|
console.log("bindCardtypeChange", e)
|
55
|
var cardTypeArray = this.data.cardTypeArray
|
55
|
var cardTypeArray = this.data.cardTypeArray
|
56
|
var new_type = cardTypeArray[e.detail.value] //['name']
|
56
|
var new_type = cardTypeArray[e.detail.value] //['name']
|
|
@@ -59,32 +59,33 @@ Page({ |
|
@@ -59,32 +59,33 @@ Page({ |
59
|
})
|
59
|
})
|
60
|
},
|
60
|
},
|
61
|
|
61
|
|
62
|
- bindinputcardnum: function (e) {
|
62
|
+ bindinputcardnum: function(e) {
|
63
|
var idCardNo = e.detail.value
|
63
|
var idCardNo = e.detail.value
|
64
|
this.setData({
|
64
|
this.setData({
|
65
|
card_number: idCardNo
|
65
|
card_number: idCardNo
|
66
|
})
|
66
|
})
|
67
|
},
|
67
|
},
|
68
|
|
68
|
|
69
|
- nameInput: function (e) {
|
69
|
+ nameInput: function(e) {
|
70
|
this.setData({
|
70
|
this.setData({
|
71
|
name: e.detail.value
|
71
|
name: e.detail.value
|
72
|
})
|
72
|
})
|
73
|
},
|
73
|
},
|
74
|
|
74
|
|
75
|
- dealCardType: function () {//提交前验证输入的内容规则
|
|
|
76
|
-
|
75
|
+ dealCardType: function() { //提交前验证输入的内容规则
|
|
|
76
|
+
|
77
|
},
|
77
|
},
|
78
|
|
78
|
|
79
|
- gonext: function () {
|
|
|
80
|
- //校验证照类型,证照号码,姓名
|
79
|
+ gonext: function() {
|
|
|
80
|
+ var that = this
|
|
|
81
|
+ //校验证照类型,证照号码,姓名
|
81
|
var type = this.data.cardtype;
|
82
|
var type = this.data.cardtype;
|
82
|
var idCardNo = this.data.card_number;
|
83
|
var idCardNo = this.data.card_number;
|
83
|
var name = this.data.name.replace(/(^\s*)|(\s*$)/g, "");
|
84
|
var name = this.data.name.replace(/(^\s*)|(\s*$)/g, "");
|
84
|
- var regname_c = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,30}$/; //中文
|
|
|
85
|
- var regname_e = /^[A-Za-z][A-Za-z\s]*[A-Za-z]$/; //英文
|
85
|
+ var regname_c = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,30}$/; //中文
|
|
|
86
|
+ var regname_e = /^[A-Za-z][A-Za-z\s]*[A-Za-z]$/; //英文
|
86
|
console.log('cardtype', type)
|
87
|
console.log('cardtype', type)
|
87
|
- if (this.data.is_foreigner == 'true') {//非身份证
|
88
|
+ if (this.data.is_foreigner == 'true') { //非身份证
|
88
|
if (type.length < 1) {
|
89
|
if (type.length < 1) {
|
89
|
this.showtoast('请选择证照类型');
|
90
|
this.showtoast('请选择证照类型');
|
90
|
return
|
91
|
return
|
|
@@ -121,13 +122,34 @@ Page({ |
|
@@ -121,13 +122,34 @@ Page({ |
121
|
return
|
122
|
return
|
122
|
}
|
123
|
}
|
123
|
//TODO 请求数据,上传用户身份信息
|
124
|
//TODO 请求数据,上传用户身份信息
|
124
|
- wx.showToast({
|
|
|
125
|
- title: '提交成功',
|
|
|
126
|
- icon: "none",
|
|
|
127
|
- duration: 2000
|
125
|
+ Authorization = getApp().globalData.Authorization;
|
|
|
126
|
+ wx.request({
|
|
|
127
|
+ url: baseUrl + 'uaa/v1/users/auth-extend',
|
|
|
128
|
+ method: 'POST',
|
|
|
129
|
+ data: {
|
|
|
130
|
+ name: name,
|
|
|
131
|
+ id_card_type: type,
|
|
|
132
|
+ id_card_no: idCardNo
|
|
|
133
|
+ },
|
|
|
134
|
+ header: {
|
|
|
135
|
+ 'content-type': 'application/json',
|
|
|
136
|
+ "Authorization": Authorization
|
|
|
137
|
+ },
|
|
|
138
|
+ success: function (res) {
|
|
|
139
|
+ console.log("SUCC",res.data)
|
|
|
140
|
+ if (res.data.code && res.data.code >= 300) {
|
|
|
141
|
+ wx.navigateTo({
|
|
|
142
|
+ url: 'verify_result/verify_result?result=fail',
|
|
|
143
|
+ })
|
|
|
144
|
+ that.showtoast(res.data.message);
|
|
|
145
|
+ } else {
|
|
|
146
|
+ wx.navigateTo({
|
|
|
147
|
+ url: 'verify_result/verify_result?result=succ',
|
|
|
148
|
+ })
|
|
|
149
|
+ }
|
|
|
150
|
+ }
|
128
|
})
|
151
|
})
|
129
|
- wx.navigateBack({})
|
|
|
130
|
- } else {//身份证
|
152
|
+ } else { //身份证
|
131
|
if (name.length < 1) {
|
153
|
if (name.length < 1) {
|
132
|
this.showtoast('请输入姓名');
|
154
|
this.showtoast('请输入姓名');
|
133
|
return
|
155
|
return
|
|
@@ -150,7 +172,7 @@ Page({ |
|
@@ -150,7 +172,7 @@ Page({ |
150
|
}
|
172
|
}
|
151
|
},
|
173
|
},
|
152
|
|
174
|
|
153
|
- showtoast: function (title) {
|
175
|
+ showtoast: function(title) {
|
154
|
wx.showToast({
|
176
|
wx.showToast({
|
155
|
title: title,
|
177
|
title: title,
|
156
|
duration: 2000,
|
178
|
duration: 2000,
|
|
@@ -162,35 +184,35 @@ Page({ |
|
@@ -162,35 +184,35 @@ Page({ |
162
|
/**
|
184
|
/**
|
163
|
* Lifecycle function--Called when page hide
|
185
|
* Lifecycle function--Called when page hide
|
164
|
*/
|
186
|
*/
|
165
|
- onHide: function () {
|
187
|
+ onHide: function() {
|
166
|
|
188
|
|
167
|
},
|
189
|
},
|
168
|
|
190
|
|
169
|
/**
|
191
|
/**
|
170
|
* Lifecycle function--Called when page unload
|
192
|
* Lifecycle function--Called when page unload
|
171
|
*/
|
193
|
*/
|
172
|
- onUnload: function () {
|
194
|
+ onUnload: function() {
|
173
|
|
195
|
|
174
|
},
|
196
|
},
|
175
|
|
197
|
|
176
|
/**
|
198
|
/**
|
177
|
* Page event handler function--Called when user drop down
|
199
|
* Page event handler function--Called when user drop down
|
178
|
*/
|
200
|
*/
|
179
|
- onPullDownRefresh: function () {
|
201
|
+ onPullDownRefresh: function() {
|
180
|
|
202
|
|
181
|
},
|
203
|
},
|
182
|
|
204
|
|
183
|
/**
|
205
|
/**
|
184
|
* Called when page reach bottom
|
206
|
* Called when page reach bottom
|
185
|
*/
|
207
|
*/
|
186
|
- onReachBottom: function () {
|
208
|
+ onReachBottom: function() {
|
187
|
|
209
|
|
188
|
},
|
210
|
},
|
189
|
|
211
|
|
190
|
/**
|
212
|
/**
|
191
|
* Called when user click on the top right corner to share
|
213
|
* Called when user click on the top right corner to share
|
192
|
*/
|
214
|
*/
|
193
|
- onShareAppMessage: function () {
|
215
|
+ onShareAppMessage: function() {
|
194
|
|
216
|
|
195
|
}
|
217
|
}
|
196
|
}) |
218
|
}) |