weapps-plugin-jingtong-verify 1.5.9 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/app.json +3 -11
- package/package.json +2 -2
- package/sdk.js +1 -32
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +0 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +0 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +1 -9
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +0 -8
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +0 -2
- package/weapps-plugin-jingtong-verify/i18n/rules.js +5 -146
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +12 -276
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +1 -19
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +1 -53
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +12 -2
- package/weapps-plugin-jingtong-verify/pages/setting/setting.js +7 -10
- package/weapps-plugin-jingtong-verify/utils/request.js +1 -670
- package/weapps-plugin-jingtong-verify/utils/rules.js +1 -105
- package/weapps-plugin-jingtong-verify/utils/validate.js +1 -139
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.js +0 -41
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.json +0 -4
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxml +0 -20
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxss +0 -112
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.js +0 -73
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.json +0 -4
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxml +0 -19
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxss +0 -72
- package/weapps-plugin-jingtong-verify/images/bank-card-verify.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chek_right.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chevron-down.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chevron-up.png +0 -0
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.js +0 -506
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.json +0 -8
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxml +0 -79
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxss +0 -212
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.js +0 -1373
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.json +0 -10
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxml +0 -247
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxss +0 -397
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.js +0 -66
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.wxml +0 -2
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.js +0 -463
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.json +0 -8
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxml +0 -69
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxss +0 -232
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.js +0 -892
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.json +0 -12
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxml +0 -157
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxss +0 -258
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.js +0 -147
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.json +0 -4
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxml +0 -48
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxss +0 -166
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.js +0 -189
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.json +0 -4
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxml +0 -19
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxss +0 -69
- package/weapps-plugin-jingtong-verify/utils/constantVal.js +0 -75
- package/weapps-plugin-jingtong-verify/utils/md5.js +0 -184
|
@@ -1,1373 +0,0 @@
|
|
|
1
|
-
const jingtongVerifyRequest = require('../../utils/request')
|
|
2
|
-
const constantVals = require('../../utils/constantVal')
|
|
3
|
-
const rulesConfig = require("../../utils/rules")
|
|
4
|
-
const utils = require("../../utils/index")
|
|
5
|
-
const MD5 = require("../../utils/md5")
|
|
6
|
-
const { flow } = require("@wecity/weda-plugin-utils");
|
|
7
|
-
import { SDKTrack, setAccountInfo } from '../../utils/QDTrackerNew/QDTrackerMain'
|
|
8
|
-
let cidType = '111'
|
|
9
|
-
let Nation = 'CHN'
|
|
10
|
-
Page({
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 页面的初始数据
|
|
14
|
-
*/
|
|
15
|
-
data: {
|
|
16
|
-
language: 'zh_CN', // 语言环境:默认中文
|
|
17
|
-
formData: {
|
|
18
|
-
cid_type: '111', // 证件类型
|
|
19
|
-
name: '', // 姓名
|
|
20
|
-
strCid: '', // 身份证号码(脱敏)
|
|
21
|
-
id_card_number: '', // 证件号码
|
|
22
|
-
verify_type: '101', // 身份证 固定值101
|
|
23
|
-
verify_expire_time: '', // 登录有效期
|
|
24
|
-
support_type: '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
|
|
25
|
-
},
|
|
26
|
-
showTipModal: false,
|
|
27
|
-
rules: rulesConfig.setNewPwdInfoRules('zh_CN'),
|
|
28
|
-
validateType: {
|
|
29
|
-
id_card_number(value) {
|
|
30
|
-
return utils.validate.checkCid(value, cidType, Nation).data
|
|
31
|
-
},
|
|
32
|
-
name(value) {
|
|
33
|
-
return utils.validate.checkName(value, cidType).data
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
formSafeData: {
|
|
37
|
-
cid_type: '111', // 证件类型
|
|
38
|
-
strCid: '', // 身份证号码(脱敏)
|
|
39
|
-
id_card_number: '', // 证件号码
|
|
40
|
-
phone_number: '', // 手机号
|
|
41
|
-
verification_code: '' //验证码
|
|
42
|
-
},
|
|
43
|
-
formSafeDataCodeMobile: '', // 根据证件号码获取的手机号尾号
|
|
44
|
-
formSafeDataCode: '', // 接口返回的验证码
|
|
45
|
-
getFormSafeDataCodeTime: '', // 调接口返回的验证码时间
|
|
46
|
-
formSafeDataCodeTimeOut: 60, // 接口返回的验证码过期时间(秒)默认1分钟
|
|
47
|
-
phoneNumberEndTitle: '', // 手机号尾号提示
|
|
48
|
-
safeRules: rulesConfig.safeVerificationInfoRules('zh_CN'),
|
|
49
|
-
validateSafeType: {
|
|
50
|
-
id_card_number(value) {
|
|
51
|
-
return utils.validate.checkCid(value, cidType, Nation).data
|
|
52
|
-
},
|
|
53
|
-
phone_number(value) {
|
|
54
|
-
return utils.validate.checkPhone(value).data
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
formPwdData: {
|
|
58
|
-
bank_card_password: '',
|
|
59
|
-
bank_card_pwd_password: ''
|
|
60
|
-
},
|
|
61
|
-
pwdRules: rulesConfig.bankCardSetNewPwdRules('zh_CN'),
|
|
62
|
-
validatePwdType: {
|
|
63
|
-
bank_card_password(value) {
|
|
64
|
-
return utils.validate.checkBankCardLoginPwd(value).data
|
|
65
|
-
},
|
|
66
|
-
bank_card_pwd_password(value, formPwdData) {
|
|
67
|
-
console.log(formPwdData)
|
|
68
|
-
console.log(formPwdData.bank_card_password)
|
|
69
|
-
return utils.validate.checkBankCardLoginPwd(value).data && utils.validate.checkConfirmPwd(value, formPwdData.bank_card_password).data
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
passwordStrength: 0, // 密码强度等级 0-3
|
|
73
|
-
passwordStrengthText: '弱',
|
|
74
|
-
currentStep: 0, // 当前步骤,从0开始
|
|
75
|
-
steps: [
|
|
76
|
-
{ title: '信息确认' },
|
|
77
|
-
{ title: '安全验证' },
|
|
78
|
-
{ title: '重置密码' }
|
|
79
|
-
],
|
|
80
|
-
// 是否显示自定义校验提示
|
|
81
|
-
showCustomTips: false,
|
|
82
|
-
// 自定义校验提示文本
|
|
83
|
-
customTipsMsg: '',
|
|
84
|
-
// 获取验证参数
|
|
85
|
-
verificationText: '发送验证码',
|
|
86
|
-
countdown: 0,
|
|
87
|
-
isCountingDown: false,
|
|
88
|
-
isSendSms: true, // 是否发送验证码
|
|
89
|
-
maxRetryCount: 3, // 最大重试次数
|
|
90
|
-
retryCount: 0, // 当前重试次数
|
|
91
|
-
// 收不到验证码提示框
|
|
92
|
-
showNotGetVerificationCodeTipModal: false,
|
|
93
|
-
// 人脸识别认证弹窗
|
|
94
|
-
showToOtherModal: false,
|
|
95
|
-
submitMode: '',
|
|
96
|
-
idCardType: {
|
|
97
|
-
'111': '1',// 大陆
|
|
98
|
-
'414': '2',// 护照
|
|
99
|
-
'516': '3',// 港澳台通行证
|
|
100
|
-
'511': '4',// 台胞证
|
|
101
|
-
'5': '5' // 其他未指定类型
|
|
102
|
-
},
|
|
103
|
-
showTipFaceModal: false,
|
|
104
|
-
set_type: 3, // 1:人脸认证,2:银行卡,3:短信
|
|
105
|
-
isIdCardSuccess: false, //第二步安全验证,验证身份证号是否当前本人的身份证号
|
|
106
|
-
isShowPasswordStrength: false,// 是否显示密码强度
|
|
107
|
-
submitSafeMode:'',
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* 生命周期函数--监听页面加载
|
|
111
|
-
*/
|
|
112
|
-
onLoad(options) {
|
|
113
|
-
const that = this
|
|
114
|
-
this.setData({
|
|
115
|
-
validatePwdType: {
|
|
116
|
-
// 单字段复杂度校验:仅依赖 value
|
|
117
|
-
bank_card_password(value) {
|
|
118
|
-
return utils.validate.checkBankCardLoginPwd(value).data
|
|
119
|
-
},
|
|
120
|
-
// 确认密码:通过闭包读取最新的整表单数据(尤其是主密码)
|
|
121
|
-
bank_card_pwd_password(value) {
|
|
122
|
-
console.log('检测')
|
|
123
|
-
console.log(that.data.formPwdData)
|
|
124
|
-
const mainPwd = (that.data && that.data.formPwdData && that.data.formPwdData.bank_card_password) || ''
|
|
125
|
-
return utils.validate.checkConfirmPwd(value, mainPwd).data
|
|
126
|
-
},
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
if(options.idCardNumber) {
|
|
130
|
-
let { formData, formSafeData } = this.data
|
|
131
|
-
formData.id_card_number = options.idCardNumber
|
|
132
|
-
formData.strCid = options.strCid
|
|
133
|
-
formData.name = options.name
|
|
134
|
-
formData.cid_type = options.cid_type
|
|
135
|
-
formData.verify_expire_time = options.verify_expire_time
|
|
136
|
-
formSafeData.cid_type = options.cid_type
|
|
137
|
-
// formSafeData.id_card_number = options.idCardNumber
|
|
138
|
-
// formSafeData.strCid = options.strCid
|
|
139
|
-
this.setData({
|
|
140
|
-
formData: formData,
|
|
141
|
-
formSafeData: formSafeData
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
if(options.source_type){
|
|
145
|
-
if(options.isSuccess){
|
|
146
|
-
this.setData({
|
|
147
|
-
currentStep: 0,
|
|
148
|
-
set_type: 2
|
|
149
|
-
})
|
|
150
|
-
} else {
|
|
151
|
-
this.setData({
|
|
152
|
-
currentStep: 2,
|
|
153
|
-
set_type: 2
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
// 下一步
|
|
159
|
-
nextStep() {
|
|
160
|
-
if (this.data.currentStep < this.data.steps.length - 1) {
|
|
161
|
-
this.setData({
|
|
162
|
-
currentStep: this.data.currentStep + 1
|
|
163
|
-
});
|
|
164
|
-
// if(this.data.currentStep == 1){
|
|
165
|
-
// this.getTailNumber()
|
|
166
|
-
// }
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
/**
|
|
170
|
-
* 获取手机号尾号并设置证件号码
|
|
171
|
-
*/
|
|
172
|
-
getTailNumber () {
|
|
173
|
-
// let value = e.detail.value
|
|
174
|
-
let value = this.data.formSafeData.id_card_number
|
|
175
|
-
if(value === '' || value === null){
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
const { formData, formSafeData } = this.data
|
|
179
|
-
let params = {
|
|
180
|
-
"cid_type": formData.cid_type, // 证件类型
|
|
181
|
-
"name": formData.name, // 姓名
|
|
182
|
-
"strCid": formData.strCid, // 身份证号码(脱敏)
|
|
183
|
-
"id_card_number": formSafeData.id_card_number, // 证件号码
|
|
184
|
-
"verify_type": '101', // 身份证 固定值101
|
|
185
|
-
"verify_expire_time": formData.verify_expire_time, // 登录有效期
|
|
186
|
-
"support_type": '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
|
|
187
|
-
}
|
|
188
|
-
console.log('结果')
|
|
189
|
-
// console.log(this.toOtherWay(params, 2, value))
|
|
190
|
-
|
|
191
|
-
// this.toOtherWay(params, 2, value)
|
|
192
|
-
setTimeout(() => {
|
|
193
|
-
// console.log(this.data.isIdCardSuccess)
|
|
194
|
-
this.toGetTailNumber(value)
|
|
195
|
-
}, 100)
|
|
196
|
-
},
|
|
197
|
-
toGetTailNumber (value) {
|
|
198
|
-
// const { isIdCardSuccess } = this.data
|
|
199
|
-
// if(!isIdCardSuccess){
|
|
200
|
-
// return
|
|
201
|
-
// }
|
|
202
|
-
// let value = e.detail.value
|
|
203
|
-
// const { id_card_number, strCid } = this.data.formSafeData
|
|
204
|
-
// let { formSafeData } = this.data
|
|
205
|
-
// formSafeData.id_card_number = id_card_number
|
|
206
|
-
// formSafeData.strCid = strCid
|
|
207
|
-
// this.setData({
|
|
208
|
-
// formSafeData: formSafeData
|
|
209
|
-
// })
|
|
210
|
-
jingtongVerifyRequest.getTailNumber(value).then(res => {
|
|
211
|
-
console.log('获取手机号尾号')
|
|
212
|
-
console.log(res)
|
|
213
|
-
if(res.errcode !== 0){
|
|
214
|
-
this.setData({
|
|
215
|
-
formSafeDataCodeMobile: '',
|
|
216
|
-
phoneNumberEndTitle: ''
|
|
217
|
-
})
|
|
218
|
-
} else {
|
|
219
|
-
if(res.errcode === 0) {
|
|
220
|
-
if(res.data.phone !== ''){
|
|
221
|
-
this.setData({
|
|
222
|
-
formSafeDataCodeMobile: res.data.phone,
|
|
223
|
-
phoneNumberEndTitle: '(尾号' + res.data.phone + ')'
|
|
224
|
-
})
|
|
225
|
-
} else {
|
|
226
|
-
this.setData({
|
|
227
|
-
formSafeDataCodeMobile: '',
|
|
228
|
-
phoneNumberEndTitle: ''
|
|
229
|
-
})
|
|
230
|
-
}
|
|
231
|
-
} else {
|
|
232
|
-
wx.showToast({
|
|
233
|
-
title: data.errmsg,
|
|
234
|
-
icon: 'none',
|
|
235
|
-
duration: 2000
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
// 上一步(可选)
|
|
242
|
-
prevStep() {
|
|
243
|
-
if (this.data.currentStep > 0) {
|
|
244
|
-
this.setData({
|
|
245
|
-
currentStep: this.data.currentStep - 1
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
// 跳转到指定步骤(可选)
|
|
251
|
-
goToStep(stepIndex) {
|
|
252
|
-
this.setData({
|
|
253
|
-
currentStep: stepIndex
|
|
254
|
-
});
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
// 步骤点击事件(可选)
|
|
258
|
-
onStepTap(e) {
|
|
259
|
-
const { index } = e.detail;
|
|
260
|
-
console.log('点击了步骤:', index);
|
|
261
|
-
// 可以在这里添加跳转逻辑
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* 跳转到人脸识别
|
|
265
|
-
* @param {} e
|
|
266
|
-
*/
|
|
267
|
-
async handleFormSubmit (e) {
|
|
268
|
-
const isOther = this.data.submitMode === 'other'
|
|
269
|
-
const formValid = e.detail.validStatus
|
|
270
|
-
if(isOther){
|
|
271
|
-
// 自定义英文名校验(与现有一致)
|
|
272
|
-
const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
|
|
273
|
-
|
|
274
|
-
if (!formValid || !customValid.valid) {
|
|
275
|
-
// 与现有提示优先级一致
|
|
276
|
-
const formErrList = e.detail.value || []
|
|
277
|
-
if (!formValid && customValid.valid) {
|
|
278
|
-
} else if (formValid && !customValid.valid) {
|
|
279
|
-
} else {
|
|
280
|
-
const needPrior = formErrList.find(i => ["id_card_number", "nation"].includes(i.name))
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
this.setData({
|
|
284
|
-
submitMode: ''
|
|
285
|
-
})
|
|
286
|
-
return
|
|
287
|
-
}
|
|
288
|
-
// 通过后再跳“其他方式”业务(可按需补入参清洗,沿用 handleFormSubmit 的清洗逻辑)
|
|
289
|
-
this.toOtherWay(this.data.formData, 1)
|
|
290
|
-
return
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
|
|
294
|
-
if (!formValid || !customValid.valid) {
|
|
295
|
-
// 自定义校验字段有问题,获取表单错误列表
|
|
296
|
-
const formErrList = e.detail.value
|
|
297
|
-
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
298
|
-
if (!formValid && customValid.valid) {
|
|
299
|
-
return
|
|
300
|
-
}
|
|
301
|
-
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
302
|
-
if (formValid && !customValid.valid) {
|
|
303
|
-
return
|
|
304
|
-
}
|
|
305
|
-
return
|
|
306
|
-
}
|
|
307
|
-
// 去验证人脸
|
|
308
|
-
this.toFaceVerify()
|
|
309
|
-
},
|
|
310
|
-
/**
|
|
311
|
-
* 去验证人脸
|
|
312
|
-
*/
|
|
313
|
-
async toFaceVerify() {
|
|
314
|
-
console.log('验证能否人脸识别')
|
|
315
|
-
// 缓存人脸识别失败数据
|
|
316
|
-
let faceFailCount = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_count)
|
|
317
|
-
let faceFailTime = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_time)
|
|
318
|
-
// 存在首次人脸识别失败时间
|
|
319
|
-
if(faceFailTime) {
|
|
320
|
-
// 判断人脸识别失败次数是否大于或等于3次,是的话,就要判断是否在10分钟不能人脸识别限制内
|
|
321
|
-
if(faceFailCount >= 3){
|
|
322
|
-
console.log(faceFailCount)
|
|
323
|
-
// 当前时间
|
|
324
|
-
const now = Date.now()
|
|
325
|
-
|
|
326
|
-
// 判断是否在10分钟内(1小时 = 3600 * 1000 毫秒)
|
|
327
|
-
const isWithinOneHour = (now - faceFailTime) < (10 * 60 * 1000)
|
|
328
|
-
console.log('当前仍在10分钟限制内')
|
|
329
|
-
console.log(isWithinOneHour)
|
|
330
|
-
if(isWithinOneHour) {
|
|
331
|
-
// 判断银行卡核验是否在锁定期内,在的话,不能跳转,提示改为直接提示
|
|
332
|
-
const bankCardFailTime = constantVals.getStorageWithExpire(constantVals.bank_card_verify_fail_time)
|
|
333
|
-
if(bankCardFailTime){
|
|
334
|
-
// 当前时间
|
|
335
|
-
const now = Date.now()
|
|
336
|
-
|
|
337
|
-
// 判断是否在10分钟内(1小时 = 3600 * 1000 毫秒)
|
|
338
|
-
const isWithinOneHour = (now - bankCardFailTime) < (10 * 60 * 1000)
|
|
339
|
-
if(isWithinOneHour){
|
|
340
|
-
console.log('当前仍在10分钟限制内')
|
|
341
|
-
}
|
|
342
|
-
this.setData({
|
|
343
|
-
showTipFaceModal: true
|
|
344
|
-
})
|
|
345
|
-
} else {
|
|
346
|
-
console.log('当前仍在10分钟限制内')
|
|
347
|
-
this.setData({
|
|
348
|
-
showToOtherModal: true
|
|
349
|
-
})
|
|
350
|
-
}
|
|
351
|
-
return
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
// 判断是否是PC端登录
|
|
356
|
-
await this.getDevice()
|
|
357
|
-
wx.showLoading({
|
|
358
|
-
title: '验证中',
|
|
359
|
-
})
|
|
360
|
-
const params = {
|
|
361
|
-
'id_card_number': this.data.formData.id_card_number,
|
|
362
|
-
'type': 1,
|
|
363
|
-
'isCount': true
|
|
364
|
-
}
|
|
365
|
-
setTimeout(() => {
|
|
366
|
-
jingtongVerifyRequest.getVerifyLimit(params).then(res =>{
|
|
367
|
-
console.log('获取人脸识别失败次数结果')
|
|
368
|
-
console.log(res)
|
|
369
|
-
console.log(res.data)
|
|
370
|
-
if(res.errcode === 0 ) {
|
|
371
|
-
const { data } = res
|
|
372
|
-
if(data.times >= 3){
|
|
373
|
-
wx.hideLoading()
|
|
374
|
-
// 人脸错误次数大于3次,提示
|
|
375
|
-
this.setData({
|
|
376
|
-
showToOtherModal: true
|
|
377
|
-
})
|
|
378
|
-
return
|
|
379
|
-
}
|
|
380
|
-
jingtongVerifyRequest.verifyIdcard(this.data.formData).then(res => {
|
|
381
|
-
console.log('获取身份证二要素核验结果')
|
|
382
|
-
console.log(res)
|
|
383
|
-
if(res.errcode === 0){
|
|
384
|
-
wx.hideLoading()
|
|
385
|
-
// 可以进行人脸
|
|
386
|
-
this.faceVerifyIng()
|
|
387
|
-
} else {
|
|
388
|
-
wx.showToast({
|
|
389
|
-
title: res.errmsg,
|
|
390
|
-
icon: 'none',
|
|
391
|
-
duration: 2000
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
return
|
|
395
|
-
}).finally(() => {
|
|
396
|
-
wx.hideLoading()
|
|
397
|
-
})
|
|
398
|
-
} else {
|
|
399
|
-
wx.showToast({
|
|
400
|
-
title: res.errmsg,
|
|
401
|
-
icon: 'none',
|
|
402
|
-
duration: 2000
|
|
403
|
-
})
|
|
404
|
-
return
|
|
405
|
-
}
|
|
406
|
-
}).finally(() => {
|
|
407
|
-
wx.hideLoading()
|
|
408
|
-
})
|
|
409
|
-
}, 1000)
|
|
410
|
-
},
|
|
411
|
-
async faceVerifyIng() {
|
|
412
|
-
const { formData } = this.data
|
|
413
|
-
const params = {
|
|
414
|
-
"id_card_number": formData.id_card_number,
|
|
415
|
-
"name": formData.name,
|
|
416
|
-
"cid_type": formData.cid_type,
|
|
417
|
-
"verify_expire_time": formData.verify_expire_time,
|
|
418
|
-
"isbind": 1
|
|
419
|
-
}
|
|
420
|
-
const [err, session] = await utils.awaitTo(
|
|
421
|
-
jingtongVerifyRequest.setNewPwdToFaceVerifyWithIdCard(params))
|
|
422
|
-
console.log('设置新登录密码人脸认证')
|
|
423
|
-
console.log(err)
|
|
424
|
-
console.log(session)
|
|
425
|
-
|
|
426
|
-
if (err) {
|
|
427
|
-
const { errmsg, errMsg, errCode } = JSON.parse(err)
|
|
428
|
-
// 缓存人脸识别失败数据
|
|
429
|
-
let faceFailCount = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_count)
|
|
430
|
-
if(faceFailCount >= 3) {
|
|
431
|
-
faceFailCount = 0
|
|
432
|
-
}
|
|
433
|
-
faceFailCount = faceFailCount + 1
|
|
434
|
-
constantVals.setStorageWithExpire(constantVals.bank_card_forgot_face_fail_count, faceFailCount)
|
|
435
|
-
if(faceFailCount === 1){
|
|
436
|
-
constantVals.setStorageWithExpire(constantVals.bank_card_forgot_face_fail_time, Date.now(), 10 * 60)
|
|
437
|
-
}
|
|
438
|
-
// 此处应要有埋点上报
|
|
439
|
-
wx.showToast({
|
|
440
|
-
title: errMsg,
|
|
441
|
-
icon: 'none',
|
|
442
|
-
duration: 3000
|
|
443
|
-
})
|
|
444
|
-
if (errCode) {
|
|
445
|
-
let errCodeArr = [10002, 10003, 10004, 10005, 10012, 10057, 90002, 90003, 90004, 90005, 90006, 90100, 90023, 90024, 90025]
|
|
446
|
-
if (errCodeArr.indexOf(errCode) >= 0) {
|
|
447
|
-
console.log('在指定的错误码范围内,人脸失败次数+1')
|
|
448
|
-
// 设置人脸失败次数
|
|
449
|
-
// await this.fetchFaceFailCount(true, errCode)
|
|
450
|
-
}
|
|
451
|
-
// 人脸识别异常温馨提示弹窗
|
|
452
|
-
// this.handleFaceError(errCode)
|
|
453
|
-
}
|
|
454
|
-
} else {
|
|
455
|
-
// 此处需要埋点处理
|
|
456
|
-
|
|
457
|
-
console.log('认证成功返回页面数据:', session)
|
|
458
|
-
// 人脸识别成功清空失败缓存数据
|
|
459
|
-
constantVals.removeStorage(constantVals.bank_card_forgot_face_fail_count)
|
|
460
|
-
constantVals.removeStorage(constantVals.bank_card_forgot_face_fail_time)
|
|
461
|
-
// 保存刷脸成功时间戳
|
|
462
|
-
let timeStamp = new Date().getTime()
|
|
463
|
-
wx.setStorageSync('tif.faceTimeStamp', timeStamp)
|
|
464
|
-
this.setData({
|
|
465
|
-
currentStep: 2,
|
|
466
|
-
set_type: 1
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
// 判断是否是PC端登录
|
|
471
|
-
getDevice() {
|
|
472
|
-
return new Promise((resolve, reject) => {
|
|
473
|
-
const systemInfo = wx.getDeviceInfo();
|
|
474
|
-
console.log('systemInfo', systemInfo)
|
|
475
|
-
if (['windows', 'mac'].includes(systemInfo.platform)) {
|
|
476
|
-
console.log('当前为电脑端微信');
|
|
477
|
-
wx.showToast({
|
|
478
|
-
title: '请您使用移动端京通小程序',
|
|
479
|
-
icon: 'none',
|
|
480
|
-
duration: 3000
|
|
481
|
-
})
|
|
482
|
-
return
|
|
483
|
-
} else {
|
|
484
|
-
console.log('当前为手机端');
|
|
485
|
-
resolve()
|
|
486
|
-
}
|
|
487
|
-
})
|
|
488
|
-
},
|
|
489
|
-
// 输入框去空
|
|
490
|
-
handleChange(e) {
|
|
491
|
-
let value = e.detail.value
|
|
492
|
-
let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
|
|
493
|
-
|
|
494
|
-
// 删除前后空格
|
|
495
|
-
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
496
|
-
value = value.trim()
|
|
497
|
-
}
|
|
498
|
-
if (formId) {
|
|
499
|
-
this.setData({ [`formData.${formId}`]: value })
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
showQuestionTip() {
|
|
503
|
-
this.setData({
|
|
504
|
-
showTipModal: true
|
|
505
|
-
})
|
|
506
|
-
},
|
|
507
|
-
handleModalOk () {
|
|
508
|
-
this.setData({
|
|
509
|
-
showNotGetVerificationCodeTipModal: false,
|
|
510
|
-
showTipModal: false
|
|
511
|
-
})
|
|
512
|
-
},
|
|
513
|
-
// 输入框去空
|
|
514
|
-
handleSafeChange(e) {
|
|
515
|
-
let value = e.detail.value
|
|
516
|
-
let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
|
|
517
|
-
|
|
518
|
-
// 删除前后空格
|
|
519
|
-
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
520
|
-
value = value.trim()
|
|
521
|
-
}
|
|
522
|
-
if (formId) {
|
|
523
|
-
this.setData({ [`formSafeData.${formId}`]: value })
|
|
524
|
-
}
|
|
525
|
-
},
|
|
526
|
-
// 设置密码输入框变化处理
|
|
527
|
-
handlePwdChange(e) {
|
|
528
|
-
let value = e.detail.value
|
|
529
|
-
let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
|
|
530
|
-
|
|
531
|
-
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
532
|
-
value = value.trim()
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
if (formId) {
|
|
536
|
-
this.setData({ [`formPwdData.${formId}`]: value })
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
handlePwdStrongChange(e) {
|
|
540
|
-
let value = e.detail.value
|
|
541
|
-
let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
|
|
542
|
-
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
543
|
-
value = value.trim()
|
|
544
|
-
}
|
|
545
|
-
// 如果是密码字段,计算强度
|
|
546
|
-
if (formId === 'bank_card_password') {
|
|
547
|
-
this.calculatePasswordStrength(value)
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
// 计算密码强度
|
|
551
|
-
calculatePasswordStrength(password) {
|
|
552
|
-
let strength = 0
|
|
553
|
-
let strengthText = '弱'
|
|
554
|
-
|
|
555
|
-
if (!password) {
|
|
556
|
-
this.setData({
|
|
557
|
-
passwordStrength: 0,
|
|
558
|
-
passwordStrengthText: '弱'
|
|
559
|
-
})
|
|
560
|
-
return
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// 长度检查
|
|
564
|
-
if (password.length >= 8) {
|
|
565
|
-
strength++
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// 包含数字
|
|
569
|
-
if (/\d/.test(password)) {
|
|
570
|
-
strength++
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// 包含字母
|
|
574
|
-
if (/[a-zA-Z]/.test(password)) {
|
|
575
|
-
strength++
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// 包含特殊字符
|
|
579
|
-
if (/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
|
|
580
|
-
strength++
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// 根据强度设置文本
|
|
584
|
-
if (strength >= 4) {
|
|
585
|
-
strengthText = '强'
|
|
586
|
-
} else if (strength >= 2) {
|
|
587
|
-
strengthText = '中'
|
|
588
|
-
} else {
|
|
589
|
-
strengthText = '弱'
|
|
590
|
-
}
|
|
591
|
-
// 此处判断密码强度
|
|
592
|
-
jingtongVerifyRequest.verifyPwdStrength(password).then(res => {
|
|
593
|
-
console.log(res)
|
|
594
|
-
const { errcode, data } = res
|
|
595
|
-
if(errcode === 0){
|
|
596
|
-
console.log(strength)
|
|
597
|
-
// 根据强度设置文本
|
|
598
|
-
if (data.score >= 90) {
|
|
599
|
-
strength = 3
|
|
600
|
-
strengthText = '强'
|
|
601
|
-
} else if (data.score >= 75) {
|
|
602
|
-
strength = 3
|
|
603
|
-
strengthText = '强'
|
|
604
|
-
} else if (data.score >= 65) {
|
|
605
|
-
strength = 2
|
|
606
|
-
strengthText = '中'
|
|
607
|
-
} else if (data.score >= 50) {
|
|
608
|
-
strength = 2
|
|
609
|
-
strengthText = '中'
|
|
610
|
-
} else {
|
|
611
|
-
strength = 1
|
|
612
|
-
strengthText = '弱'
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
this.setData({
|
|
616
|
-
passwordStrength: Math.min(strength, 3), // 最多显示3个等级
|
|
617
|
-
passwordStrengthText: strengthText,
|
|
618
|
-
isShowPasswordStrength: true
|
|
619
|
-
})
|
|
620
|
-
}
|
|
621
|
-
})
|
|
622
|
-
},
|
|
623
|
-
// 其他方式
|
|
624
|
-
handletoOther () {
|
|
625
|
-
console.log('启用sms验证')
|
|
626
|
-
// 方案B
|
|
627
|
-
this.data.submitMode = 'other' // 设置来源标记
|
|
628
|
-
const form = this.selectComponent('#form')
|
|
629
|
-
if (form && typeof form.handleSubmit === 'function') {
|
|
630
|
-
// 触发表单的内置校验流程,结果会回调到 handleFormSubmit
|
|
631
|
-
form.handleSubmit()
|
|
632
|
-
} else {
|
|
633
|
-
wx.showToast({ title: '表单未就绪,请稍后再试', icon: 'none' })
|
|
634
|
-
}
|
|
635
|
-
// this.nextStep()
|
|
636
|
-
// wx.navigateTo({
|
|
637
|
-
// url: '/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting',
|
|
638
|
-
// })
|
|
639
|
-
},
|
|
640
|
-
/**
|
|
641
|
-
* 其他方式实际处理
|
|
642
|
-
*/
|
|
643
|
-
toOtherWay(params, type, value) {
|
|
644
|
-
wx.showLoading({
|
|
645
|
-
title: '验证中',
|
|
646
|
-
})
|
|
647
|
-
setTimeout(() => {
|
|
648
|
-
jingtongVerifyRequest.verifyIdcard(params).then(res =>{
|
|
649
|
-
console.log('点击其他方式-获取身份证二要素核验结果')
|
|
650
|
-
console.log(res)
|
|
651
|
-
const { errcode }= res
|
|
652
|
-
if(errcode === 0){
|
|
653
|
-
// 判断type,1为信息确认,2为信息确认并获取手机号尾号,目前业务不需要走type=2
|
|
654
|
-
if(type === 1) {
|
|
655
|
-
wx.hideLoading()
|
|
656
|
-
this.setData({
|
|
657
|
-
set_type: 3
|
|
658
|
-
})
|
|
659
|
-
// 先去根据身份证校验手机号,正确才能走下一步,不然只能走人脸识别
|
|
660
|
-
this.toCheckPhoneByIdCard()
|
|
661
|
-
} else {
|
|
662
|
-
this.setData({
|
|
663
|
-
isIdCardSuccess: true
|
|
664
|
-
})
|
|
665
|
-
this.sendVerificationCode()
|
|
666
|
-
wx.hideLoading()
|
|
667
|
-
// this.toGetTailNumber(value)
|
|
668
|
-
}
|
|
669
|
-
} else {
|
|
670
|
-
wx.hideLoading()
|
|
671
|
-
wx.showToast({
|
|
672
|
-
title: res.errmsg,
|
|
673
|
-
icon: 'none',
|
|
674
|
-
duration: 2000
|
|
675
|
-
})
|
|
676
|
-
this.setData({
|
|
677
|
-
isIdCardSuccess: false
|
|
678
|
-
})
|
|
679
|
-
}
|
|
680
|
-
}).finally(() => {
|
|
681
|
-
wx.hideLoading()
|
|
682
|
-
})
|
|
683
|
-
}, 1500)
|
|
684
|
-
},
|
|
685
|
-
/**
|
|
686
|
-
* 根据身份证校验手机号,正确才能走下一步,不然只能走人脸识别
|
|
687
|
-
*/
|
|
688
|
-
toCheckPhoneByIdCard() {
|
|
689
|
-
const { id_card_number } = this.data.formData
|
|
690
|
-
const checkPhoneByIdCardParam = {
|
|
691
|
-
"id_card_number": id_card_number,
|
|
692
|
-
"phone_number": ''
|
|
693
|
-
}
|
|
694
|
-
jingtongVerifyRequest.getInfoCheck(checkPhoneByIdCardParam).then(res => {
|
|
695
|
-
const { errmsg, errcode }= res
|
|
696
|
-
if(errcode === 0){
|
|
697
|
-
if(res.data.phone_suffix) {
|
|
698
|
-
this.setData({
|
|
699
|
-
formSafeDataCodeMobile: res.data.phone_suffix,
|
|
700
|
-
phoneNumberEndTitle: '(尾号' + res.data.phone_suffix + ')'
|
|
701
|
-
})
|
|
702
|
-
// 下一步
|
|
703
|
-
this.nextStep()
|
|
704
|
-
} else {
|
|
705
|
-
wx.showToast({
|
|
706
|
-
title: '手机绑定状态异常,请使用人脸识别方式验证',
|
|
707
|
-
icon: 'none',
|
|
708
|
-
duration: 3000
|
|
709
|
-
})
|
|
710
|
-
this.setData({
|
|
711
|
-
formSafeDataCodeMobile: '',
|
|
712
|
-
phoneNumberEndTitle: ''
|
|
713
|
-
})
|
|
714
|
-
}
|
|
715
|
-
} else {
|
|
716
|
-
wx.showToast({
|
|
717
|
-
title: errmsg,
|
|
718
|
-
icon: 'none',
|
|
719
|
-
duration: 3000
|
|
720
|
-
})
|
|
721
|
-
}
|
|
722
|
-
})
|
|
723
|
-
},
|
|
724
|
-
// 其他方式
|
|
725
|
-
handletoSendVerificationCode () {
|
|
726
|
-
console.log('启用sms验证')
|
|
727
|
-
try {
|
|
728
|
-
// 临时保存并移除 verification_code
|
|
729
|
-
const tempCode = this.data.formSafeData.verification_code
|
|
730
|
-
const tempFormSafeData = { ...this.data.formSafeData }
|
|
731
|
-
delete tempFormSafeData.verification_code
|
|
732
|
-
|
|
733
|
-
this.setData({
|
|
734
|
-
submitSafeMode: 'other',
|
|
735
|
-
formSafeData: tempFormSafeData
|
|
736
|
-
})
|
|
737
|
-
|
|
738
|
-
const form = this.selectComponent('#formSafe')
|
|
739
|
-
if (form && typeof form.handleSubmit === 'function') {
|
|
740
|
-
form.handleSubmit()
|
|
741
|
-
} else {
|
|
742
|
-
// 恢复 verification_code
|
|
743
|
-
this.setData({
|
|
744
|
-
formSafeData: { ...this.data.formSafeData, verification_code: tempCode },
|
|
745
|
-
submitSafeMode: ''
|
|
746
|
-
})
|
|
747
|
-
}
|
|
748
|
-
} catch (error) {
|
|
749
|
-
// 恢复 verification_code
|
|
750
|
-
this.setData({
|
|
751
|
-
formSafeData: { ...this.data.formSafeData, verification_code: tempCode },
|
|
752
|
-
submitSafeMode: ''
|
|
753
|
-
})
|
|
754
|
-
}
|
|
755
|
-
},
|
|
756
|
-
/**
|
|
757
|
-
* 发送验证码
|
|
758
|
-
*/
|
|
759
|
-
sendVerificationCode () {
|
|
760
|
-
wx.showLoading({
|
|
761
|
-
title: '发送中',
|
|
762
|
-
})
|
|
763
|
-
if(!this.data.isIdCardSuccess){
|
|
764
|
-
wx.showToast({
|
|
765
|
-
title: '身份证号码验证没有通过,请重新填写',
|
|
766
|
-
icon: 'none'
|
|
767
|
-
});
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
if (this.data.isCountingDown) {
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// 检查重试次数
|
|
775
|
-
// if (this.data.retryCount >= this.data.maxRetryCount) {
|
|
776
|
-
// wx.showToast({
|
|
777
|
-
// title: '今日发送次数已达上限',
|
|
778
|
-
// icon: 'none'
|
|
779
|
-
// });
|
|
780
|
-
// return;
|
|
781
|
-
// }
|
|
782
|
-
console.log(this.data.formSafeData)
|
|
783
|
-
console.log(this.data.formSafeData.phone_number)
|
|
784
|
-
const { phone_number } = this.data.formSafeData
|
|
785
|
-
// 验证手机号格式
|
|
786
|
-
if (!this.validatePhone(phone_number)) {
|
|
787
|
-
wx.showToast({
|
|
788
|
-
title: '请输入正确的手机号',
|
|
789
|
-
icon: 'none'
|
|
790
|
-
});
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
// 判断手机尾号是否一致
|
|
794
|
-
const { formSafeDataCodeMobile } = this.data
|
|
795
|
-
const phoneEndNumber = phone_number.slice(-4)
|
|
796
|
-
if(phoneEndNumber !== formSafeDataCodeMobile) {
|
|
797
|
-
wx.showToast({
|
|
798
|
-
title: '手机号码与绑定号码不一致,请重新输入',
|
|
799
|
-
icon: 'none',
|
|
800
|
-
duration: 2000
|
|
801
|
-
})
|
|
802
|
-
return
|
|
803
|
-
}
|
|
804
|
-
if(formSafeDataCodeMobile === ''){
|
|
805
|
-
wx.showToast({
|
|
806
|
-
title: '手机号码与绑定手机号码不一致,请检查后输入',
|
|
807
|
-
icon: 'none',
|
|
808
|
-
duration: 2000
|
|
809
|
-
});
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
this.sendSmsCode(phone_number);
|
|
813
|
-
},
|
|
814
|
-
// 验证手机号
|
|
815
|
-
validatePhone(phone) {
|
|
816
|
-
console.log(phone)
|
|
817
|
-
const phoneReg = /^1[3-9]\d{9}$/;
|
|
818
|
-
return phoneReg.test(phone);
|
|
819
|
-
},
|
|
820
|
-
// 实际-发送短信验证码
|
|
821
|
-
sendSmsCode(phoneNumber) {
|
|
822
|
-
wx.showLoading({
|
|
823
|
-
title: '发送中...'
|
|
824
|
-
});
|
|
825
|
-
// 模拟发送请求
|
|
826
|
-
setTimeout(() => {
|
|
827
|
-
wx.hideLoading();
|
|
828
|
-
// 调接口获取短信验证码
|
|
829
|
-
jingtongVerifyRequest.sendSmsCode(phoneNumber).then(res => {
|
|
830
|
-
console.log(res.data)
|
|
831
|
-
const { data, errcode, errmsg } = res
|
|
832
|
-
if(errcode === 0){
|
|
833
|
-
wx.showToast({
|
|
834
|
-
title: '验证码已发送',
|
|
835
|
-
icon: 'success'
|
|
836
|
-
});
|
|
837
|
-
this.startCountdown();
|
|
838
|
-
this.setData({
|
|
839
|
-
isSendSms: true,
|
|
840
|
-
// retryCount: this.data.retryCount + 1,
|
|
841
|
-
formSafeDataCode: data.code,
|
|
842
|
-
getFormSafeDataCodeTime: Date.now()
|
|
843
|
-
});
|
|
844
|
-
} else {
|
|
845
|
-
wx.showToast({
|
|
846
|
-
title: errmsg || '验证码获取已超10次,请明天再试。',
|
|
847
|
-
icon: 'none',
|
|
848
|
-
duration: 2500
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
})
|
|
852
|
-
|
|
853
|
-
// 模拟成功响应
|
|
854
|
-
// const isSuccess = Math.random() > 0.9; // 80% 成功率
|
|
855
|
-
// if (isSuccess) {
|
|
856
|
-
// wx.showToast({
|
|
857
|
-
// title: '验证码已发送',
|
|
858
|
-
// icon: 'success'
|
|
859
|
-
// });
|
|
860
|
-
// this.startCountdown();
|
|
861
|
-
// this.setData({
|
|
862
|
-
// retryCount: this.data.retryCount + 1
|
|
863
|
-
// });
|
|
864
|
-
// } else {
|
|
865
|
-
// wx.showToast({
|
|
866
|
-
// title: '发送失败,请重试',
|
|
867
|
-
// icon: 'none'
|
|
868
|
-
// });
|
|
869
|
-
// }
|
|
870
|
-
}, 1500);
|
|
871
|
-
},
|
|
872
|
-
// 开始倒计时
|
|
873
|
-
startCountdown() {
|
|
874
|
-
this.setData({
|
|
875
|
-
countdown: 60,
|
|
876
|
-
isCountingDown: true,
|
|
877
|
-
verificationText: '已发送(60s)'
|
|
878
|
-
});
|
|
879
|
-
|
|
880
|
-
this.countdownTimer = setInterval(() => {
|
|
881
|
-
const newCountdown = this.data.countdown - 1;
|
|
882
|
-
|
|
883
|
-
if (newCountdown <= 0) {
|
|
884
|
-
this.setData({
|
|
885
|
-
countdown: 0,
|
|
886
|
-
isCountingDown: false,
|
|
887
|
-
verificationText: '重新发送'
|
|
888
|
-
});
|
|
889
|
-
clearInterval(this.countdownTimer);
|
|
890
|
-
this.countdownTimer = null;
|
|
891
|
-
} else {
|
|
892
|
-
this.setData({
|
|
893
|
-
countdown: newCountdown,
|
|
894
|
-
verificationText: `已发送(${newCountdown}s)`
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
}, 1000);
|
|
898
|
-
},
|
|
899
|
-
/**
|
|
900
|
-
* 打开收不到验证码提示框
|
|
901
|
-
*/
|
|
902
|
-
handleNotVerificationTipModal () {
|
|
903
|
-
this.setData({
|
|
904
|
-
showNotGetVerificationCodeTipModal: true
|
|
905
|
-
})
|
|
906
|
-
},
|
|
907
|
-
/**
|
|
908
|
-
* 关闭收不到验证码提示框
|
|
909
|
-
*/
|
|
910
|
-
handleNotGetVerificationCodeTipModalCancel() {
|
|
911
|
-
this.setData({
|
|
912
|
-
showNotGetVerificationCodeTipModal: false
|
|
913
|
-
})
|
|
914
|
-
},
|
|
915
|
-
/**
|
|
916
|
-
* 验证身份证号,手机号,短信验证码
|
|
917
|
-
*/
|
|
918
|
-
async handleSafeFormSubmit (e) {
|
|
919
|
-
console.log('进行身份证号码、手机号,短信验证码信息验证')
|
|
920
|
-
const formValid = e.detail.validStatus
|
|
921
|
-
const isSafeOther = this.data.submitSafeMode === 'other'
|
|
922
|
-
if (isSafeOther){
|
|
923
|
-
const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
|
|
924
|
-
this.data.submitSafeMode = ''
|
|
925
|
-
if (!formValid || !customValid.valid) {
|
|
926
|
-
// 自定义校验字段有问题,获取表单错误列表
|
|
927
|
-
const formErrList = e.detail.value
|
|
928
|
-
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
929
|
-
if (!formValid && customValid.valid) {
|
|
930
|
-
return
|
|
931
|
-
}
|
|
932
|
-
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
933
|
-
if (formValid && !customValid.valid) {
|
|
934
|
-
return
|
|
935
|
-
}
|
|
936
|
-
return
|
|
937
|
-
}
|
|
938
|
-
const { formData, formSafeData } = this.data
|
|
939
|
-
let params = {
|
|
940
|
-
'id_card_number': formSafeData.id_card_number, // 证件号码
|
|
941
|
-
'name': formData.name,
|
|
942
|
-
'verify_type': '101', // 身份证 固定值101
|
|
943
|
-
'support_type': '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
|
|
944
|
-
}
|
|
945
|
-
this.toOtherWay(params, 2, '')
|
|
946
|
-
return
|
|
947
|
-
}
|
|
948
|
-
const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
|
|
949
|
-
if (!formValid || !customValid.valid) {
|
|
950
|
-
// 自定义校验字段有问题,获取表单错误列表
|
|
951
|
-
const formErrList = e.detail.value
|
|
952
|
-
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
953
|
-
if (!formValid && customValid.valid) {
|
|
954
|
-
return
|
|
955
|
-
}
|
|
956
|
-
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
957
|
-
if (formValid && !customValid.valid) {
|
|
958
|
-
return
|
|
959
|
-
}
|
|
960
|
-
return
|
|
961
|
-
}
|
|
962
|
-
console.log('md加密验证码')
|
|
963
|
-
console.log(MD5(this.data.formSafeData.verification_code).toString())
|
|
964
|
-
// 判断手机尾号是否一致
|
|
965
|
-
const { formSafeData,formSafeDataCodeMobile } = this.data
|
|
966
|
-
let { phone_number } = formSafeData
|
|
967
|
-
const phoneEndNumber = phone_number.slice(-4)
|
|
968
|
-
if(phoneEndNumber !== formSafeDataCodeMobile) {
|
|
969
|
-
wx.showToast({
|
|
970
|
-
title: '手机号码与绑定号码不一致,请重新输入',
|
|
971
|
-
icon: 'none',
|
|
972
|
-
duration: 2000
|
|
973
|
-
})
|
|
974
|
-
return
|
|
975
|
-
}
|
|
976
|
-
// 判断是否发送验证码以及验证码是否过期
|
|
977
|
-
const { isSendSms } = this.data
|
|
978
|
-
if(!isSendSms) {
|
|
979
|
-
wx.showToast({
|
|
980
|
-
title: '没检验验证码,请发送验证码',
|
|
981
|
-
icon: 'none',
|
|
982
|
-
duration: 2000
|
|
983
|
-
})
|
|
984
|
-
return
|
|
985
|
-
}
|
|
986
|
-
let nowDateTime = Date.now()
|
|
987
|
-
const { getFormSafeDataCodeTime, formSafeDataCodeTimeOut, formSafeDataCode } = this.data
|
|
988
|
-
const secondDiff = Math.floor((nowDateTime - getFormSafeDataCodeTime) / 1000);
|
|
989
|
-
if (secondDiff > formSafeDataCodeTimeOut) {
|
|
990
|
-
wx.showToast({
|
|
991
|
-
title: '短信验证码已过期,请重新获取',
|
|
992
|
-
icon: 'none',
|
|
993
|
-
duration: 2000
|
|
994
|
-
})
|
|
995
|
-
return
|
|
996
|
-
}
|
|
997
|
-
// const ms5Code = MD5(this.data.formSafeData.verification_code).toString()
|
|
998
|
-
// if ( formSafeDataCode !== ms5Code) {
|
|
999
|
-
// wx.showToast({
|
|
1000
|
-
// title: '验证码不一致,请重新输入',
|
|
1001
|
-
// icon: 'none',
|
|
1002
|
-
// duration: 2000
|
|
1003
|
-
// })
|
|
1004
|
-
// return
|
|
1005
|
-
// }
|
|
1006
|
-
|
|
1007
|
-
// 接口校验验证码
|
|
1008
|
-
const smsCodeParam = {
|
|
1009
|
-
"mobile": formSafeData.phone_number,
|
|
1010
|
-
"mobileCode": formSafeData.verification_code
|
|
1011
|
-
}
|
|
1012
|
-
jingtongVerifyRequest.verifySmsCode(smsCodeParam).then(res => {
|
|
1013
|
-
const { errcode, errmsg } = res
|
|
1014
|
-
if (errcode === 0) {
|
|
1015
|
-
if(!res.data.success){
|
|
1016
|
-
wx.showToast({
|
|
1017
|
-
title: errmsg || '验证码校验失败,请重新输入。',
|
|
1018
|
-
icon: 'none',
|
|
1019
|
-
duration: 2000
|
|
1020
|
-
})
|
|
1021
|
-
return
|
|
1022
|
-
} else{
|
|
1023
|
-
this.nextStep()
|
|
1024
|
-
}
|
|
1025
|
-
} else {
|
|
1026
|
-
wx.showToast({
|
|
1027
|
-
title: errmsg || '验证码校验失败,请重新输入。',
|
|
1028
|
-
icon: 'none',
|
|
1029
|
-
duration: 2000
|
|
1030
|
-
})
|
|
1031
|
-
return
|
|
1032
|
-
}
|
|
1033
|
-
})
|
|
1034
|
-
},
|
|
1035
|
-
/**
|
|
1036
|
-
* 确认设置密码
|
|
1037
|
-
*/
|
|
1038
|
-
async handlePwdFormSubmit (e) {
|
|
1039
|
-
console.log('进行确认设置密码')
|
|
1040
|
-
const formValid = e.detail.validStatus
|
|
1041
|
-
const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
|
|
1042
|
-
if (!formValid || !customValid.valid) {
|
|
1043
|
-
// 自定义校验字段有问题,获取表单错误列表
|
|
1044
|
-
const formErrList = e.detail.value
|
|
1045
|
-
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
1046
|
-
if (!formValid && customValid.valid) {
|
|
1047
|
-
return
|
|
1048
|
-
}
|
|
1049
|
-
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
1050
|
-
if (formValid && !customValid.valid) {
|
|
1051
|
-
return
|
|
1052
|
-
}
|
|
1053
|
-
return
|
|
1054
|
-
}
|
|
1055
|
-
// 点击确定出现该提示
|
|
1056
|
-
wx.showLoading({
|
|
1057
|
-
title: '验证中',
|
|
1058
|
-
mask: true // 防止用户点击
|
|
1059
|
-
})
|
|
1060
|
-
console.log(this.data.formSafeData)
|
|
1061
|
-
console.log(this.data.formPwdData)
|
|
1062
|
-
const { formData, formSafeData, formPwdData, idCardType, formSafeDataCode, set_type } = this.data
|
|
1063
|
-
let setType = set_type === 3 ? formSafeData.cid_type : formData.cid_type
|
|
1064
|
-
let params = {
|
|
1065
|
-
"password": formPwdData.bank_card_password,
|
|
1066
|
-
"id_card_number": set_type === 3 ? formSafeData.id_card_number : formData.id_card_number,
|
|
1067
|
-
"id_type": idCardType[setType],
|
|
1068
|
-
"code": set_type === 3 ? formSafeData.verification_code : '',
|
|
1069
|
-
"mobile": set_type === 3 ? formSafeData.phone_number : ''
|
|
1070
|
-
}
|
|
1071
|
-
setTimeout(() => {
|
|
1072
|
-
jingtongVerifyRequest.modifyPassword(params).then(res => {
|
|
1073
|
-
console.log('设置新密码')
|
|
1074
|
-
wx.hideLoading()
|
|
1075
|
-
if(res.errcode === 0) {
|
|
1076
|
-
const { success } = res.data
|
|
1077
|
-
if(success) {
|
|
1078
|
-
// 应进行账密登录,就是走密码登录,登录成功直接跳转回/pages/index/index
|
|
1079
|
-
this.toLoginByPwd()
|
|
1080
|
-
// wx.reLaunch({
|
|
1081
|
-
// url: '/pages/index/index',
|
|
1082
|
-
// })
|
|
1083
|
-
}
|
|
1084
|
-
} else {
|
|
1085
|
-
wx.showToast({
|
|
1086
|
-
title: res.errmsg,
|
|
1087
|
-
icon: 'none',
|
|
1088
|
-
duration: 2000
|
|
1089
|
-
})
|
|
1090
|
-
}
|
|
1091
|
-
}).finally(() => {
|
|
1092
|
-
wx.hideLoading()
|
|
1093
|
-
})
|
|
1094
|
-
}, 1500)
|
|
1095
|
-
},
|
|
1096
|
-
async toLoginByPwd() {
|
|
1097
|
-
const { formData, formPwdData, idCardType } = this.data
|
|
1098
|
-
const params = {
|
|
1099
|
-
"password": formPwdData.bank_card_password,
|
|
1100
|
-
"id_card_number": formData.id_card_number,
|
|
1101
|
-
"id_type": idCardType[formData.cid_type],
|
|
1102
|
-
"cid_type": formData.cid_type,
|
|
1103
|
-
"login_verify_type": 1,
|
|
1104
|
-
"verify_expire_time": formData.verify_expire_time,
|
|
1105
|
-
"nation": Nation,
|
|
1106
|
-
"isbind": 1,
|
|
1107
|
-
"certName": formData.name
|
|
1108
|
-
}
|
|
1109
|
-
const [err, session ] = await utils.awaitTo (jingtongVerifyRequest.pwdLogin(params))
|
|
1110
|
-
if(err){
|
|
1111
|
-
console.log('忘记密码-重新设置密码-账号密码登录失败')
|
|
1112
|
-
console.log(err)
|
|
1113
|
-
} else {
|
|
1114
|
-
console.log('忘记密码-重新设置密码-账号密码登录成功')
|
|
1115
|
-
console.log(session)
|
|
1116
|
-
// 保存银行卡核验成功时间戳
|
|
1117
|
-
let timeStamp = new Date().getTime()
|
|
1118
|
-
wx.setStorageSync('tif.bankCardTimeStamp', timeStamp)
|
|
1119
|
-
this.authSuccess(session)
|
|
1120
|
-
}
|
|
1121
|
-
},
|
|
1122
|
-
// 跳转去银行卡验证设置密码
|
|
1123
|
-
handleToBankCard() {
|
|
1124
|
-
console.log('====跳转去银行卡验证设置密码====')
|
|
1125
|
-
// 跳转去银行卡验证设置密码
|
|
1126
|
-
this.setData({
|
|
1127
|
-
showToOtherModal: false
|
|
1128
|
-
}, () => {
|
|
1129
|
-
setTimeout(() => {
|
|
1130
|
-
wx.navigateTo({
|
|
1131
|
-
url: '/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify?id_card_number='+ this.data.formData.id_card_number
|
|
1132
|
-
+ '&cid_type=' + this.data.formData.cid_type
|
|
1133
|
-
+ '&name=' + this.data.formData.name
|
|
1134
|
-
+ '&verify_expire_time=' + this.data.formData.verify_expire_time
|
|
1135
|
-
+ '&source_type=2'
|
|
1136
|
-
+ '&checkType=2',
|
|
1137
|
-
})
|
|
1138
|
-
}, 100)
|
|
1139
|
-
})
|
|
1140
|
-
},
|
|
1141
|
-
// 关闭提示框
|
|
1142
|
-
handleToCancel () {
|
|
1143
|
-
this.setData({
|
|
1144
|
-
showToOtherModal: false
|
|
1145
|
-
})
|
|
1146
|
-
},
|
|
1147
|
-
openEye(e) {
|
|
1148
|
-
console.log(e)
|
|
1149
|
-
const isOpen = e.detail.isOpen
|
|
1150
|
-
const key = e.currentTarget.id
|
|
1151
|
-
const strKey = e.currentTarget.dataset.star
|
|
1152
|
-
console.log('isOpen', isOpen)
|
|
1153
|
-
console.log('key', key)
|
|
1154
|
-
console.log('strKey', strKey)
|
|
1155
|
-
if (isOpen) {
|
|
1156
|
-
console.log('显示脱敏')
|
|
1157
|
-
const { id_card_number } = this.data.formData
|
|
1158
|
-
const value = utils.hideIdCard(id_card_number, '111')
|
|
1159
|
-
console.log('value', value)
|
|
1160
|
-
this.setData({
|
|
1161
|
-
[`formData.${strKey}`]: value
|
|
1162
|
-
})
|
|
1163
|
-
} else {
|
|
1164
|
-
console.log('删除脱敏,显示明文')
|
|
1165
|
-
this.setData({
|
|
1166
|
-
[`formData.${strKey}`]: ''
|
|
1167
|
-
})
|
|
1168
|
-
}
|
|
1169
|
-
},
|
|
1170
|
-
handleFaceModalOk () {
|
|
1171
|
-
this.setData({
|
|
1172
|
-
showNotGetVerificationCodeTipModal: false,
|
|
1173
|
-
showTipModal: false,
|
|
1174
|
-
showTipFaceModal: false
|
|
1175
|
-
})
|
|
1176
|
-
},
|
|
1177
|
-
// 认证成功后续操作
|
|
1178
|
-
async authSuccess(session, isEn = false) {
|
|
1179
|
-
console.log('====判断是否真的登录成功=====')
|
|
1180
|
-
console.log(session)
|
|
1181
|
-
if (!session) {
|
|
1182
|
-
wx.showToast({
|
|
1183
|
-
title: '登录态失效,请重试',
|
|
1184
|
-
icon: 'none',
|
|
1185
|
-
duration: 2000
|
|
1186
|
-
})
|
|
1187
|
-
return
|
|
1188
|
-
}
|
|
1189
|
-
const { face_time, realname_time, cid, has_phone, certType } = session
|
|
1190
|
-
if ((!face_time && !realname_time) || !cid) {
|
|
1191
|
-
wx.showToast({
|
|
1192
|
-
title: `登录态失效请重试: ${this.data.formData.cid_type}`,
|
|
1193
|
-
icon: 'none',
|
|
1194
|
-
duration: 2000
|
|
1195
|
-
})
|
|
1196
|
-
return
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
wx.showToast({
|
|
1200
|
-
title: isEn ? 'Verification successful, redirecting...': '验证成功, 跳转中…',
|
|
1201
|
-
icon: 'none',
|
|
1202
|
-
duration: 5000,
|
|
1203
|
-
mask: true
|
|
1204
|
-
})
|
|
1205
|
-
|
|
1206
|
-
const cidType = session.cid_type
|
|
1207
|
-
|
|
1208
|
-
// 本地存储表单核验成功数据
|
|
1209
|
-
wx.setStorageSync('tif.formDataSuccess', session)
|
|
1210
|
-
|
|
1211
|
-
// 将弹窗标识设置为不需要弹窗
|
|
1212
|
-
jingtongVerifyRequest.setUserReadStatus(false).then(() => {
|
|
1213
|
-
console.log('设置弹窗标识成功')
|
|
1214
|
-
}).catch(err => {
|
|
1215
|
-
console.log('设置弹窗标识失败', err)
|
|
1216
|
-
})
|
|
1217
|
-
|
|
1218
|
-
setTimeout(() => {
|
|
1219
|
-
if (this.data.needUnite === "true") {
|
|
1220
|
-
// this.setData({
|
|
1221
|
-
// needUnite: ''
|
|
1222
|
-
// })
|
|
1223
|
-
|
|
1224
|
-
console.log('进入业务总入口, 判断是否有手机号码', has_phone)
|
|
1225
|
-
|
|
1226
|
-
// 登录成功回调 => 业务侧操作事项
|
|
1227
|
-
wx.$_ServiceConfiguration && wx.$_ServiceConfiguration.methods && wx.$_ServiceConfiguration.methods._loginSuccessCallBack && wx.$_ServiceConfiguration.methods._loginSuccessCallBack(session)
|
|
1228
|
-
|
|
1229
|
-
if (has_phone) {
|
|
1230
|
-
const realPhone = wx.getStorageSync('tif.realPhone') || ''
|
|
1231
|
-
const caPhone = wx.getStorageSync('tif.caPhone') || ''
|
|
1232
|
-
const confirmTime = wx.getStorageSync('tif.tel_confirm_time') || ''
|
|
1233
|
-
|
|
1234
|
-
console.log('realPhone', realPhone)
|
|
1235
|
-
console.log('caPhone', caPhone)
|
|
1236
|
-
console.log('confirmTime', confirmTime)
|
|
1237
|
-
|
|
1238
|
-
if (realPhone !== caPhone && confirmTime && (!utils.completeDate(new Date(Number(confirmTime + '000')), 6))) {
|
|
1239
|
-
// 埋点上报事件:自然人登录
|
|
1240
|
-
this.loginTracker(1, cidType)
|
|
1241
|
-
|
|
1242
|
-
this.setData({
|
|
1243
|
-
hadSuccessLogin: true
|
|
1244
|
-
})
|
|
1245
|
-
|
|
1246
|
-
// 【phone与caPhone不同】且【tel_confirm_time大于6个月】
|
|
1247
|
-
// 数据库手机号码有效期大于6个月
|
|
1248
|
-
flow.redirectTo({
|
|
1249
|
-
url: '../confirm-phone/confirm-phone'
|
|
1250
|
-
})
|
|
1251
|
-
} else {
|
|
1252
|
-
jingtongVerifyRequest.personToken({
|
|
1253
|
-
source: '11'
|
|
1254
|
-
}).then(async data => {
|
|
1255
|
-
// 设置用户账号信息
|
|
1256
|
-
setAccountInfo(session.openid)
|
|
1257
|
-
|
|
1258
|
-
// 埋点上报事件:自然人登录
|
|
1259
|
-
this.loginTracker(1, cidType)
|
|
1260
|
-
|
|
1261
|
-
this.setData({
|
|
1262
|
-
hadSuccessLogin: true
|
|
1263
|
-
})
|
|
1264
|
-
|
|
1265
|
-
// 埋点 - 个人用户实体全属性上报
|
|
1266
|
-
let last_login_time = utils.getCurrentTime()
|
|
1267
|
-
wx.setStorageSync('tif.lastLoginTime', last_login_time)
|
|
1268
|
-
const userEntityReportData = Object.assign(session, {
|
|
1269
|
-
user_status: '1',
|
|
1270
|
-
last_login_time,
|
|
1271
|
-
user_date_of_birth: session.cid_type === '111' ? utils.getBirthByIDCard(session.cid) : ''
|
|
1272
|
-
})
|
|
1273
|
-
await utils.awaitTo(jingtongVerifyRequest.userEntityReport(userEntityReportData))
|
|
1274
|
-
|
|
1275
|
-
setTimeout(() => {
|
|
1276
|
-
flow.resolve({
|
|
1277
|
-
token: data
|
|
1278
|
-
})
|
|
1279
|
-
wx.reLaunch({
|
|
1280
|
-
url: '/pages/index/index' // 主包页面路径
|
|
1281
|
-
})
|
|
1282
|
-
}, 1200)
|
|
1283
|
-
})
|
|
1284
|
-
}
|
|
1285
|
-
} else {
|
|
1286
|
-
// 埋点上报事件:自然人登录
|
|
1287
|
-
this.loginTracker(1, cidType)
|
|
1288
|
-
|
|
1289
|
-
this.setData({
|
|
1290
|
-
hadSuccessLogin: true
|
|
1291
|
-
})
|
|
1292
|
-
|
|
1293
|
-
flow.redirectTo({
|
|
1294
|
-
url: '../bind-phone/bind-phone?source=3'
|
|
1295
|
-
})
|
|
1296
|
-
}
|
|
1297
|
-
} else {
|
|
1298
|
-
console.log('返回主包')
|
|
1299
|
-
flow.resolve()
|
|
1300
|
-
wx.reLaunch({
|
|
1301
|
-
url: '/pages/index/index' // 主包页面路径
|
|
1302
|
-
})
|
|
1303
|
-
}
|
|
1304
|
-
}, 800)
|
|
1305
|
-
},
|
|
1306
|
-
// 埋点上报事件:自然人登录
|
|
1307
|
-
loginTracker(login_status = 1, cidType) {
|
|
1308
|
-
SDKTrack('nature_person_login', {
|
|
1309
|
-
// 1 登录成功;2 登录失败-身份信息核验失败;3 登录失败-人脸核验失败
|
|
1310
|
-
// 4 登录失败-电子营业执照核验失败;5 登录失败-账号密码输入错误
|
|
1311
|
-
// 6 取消登录(包含点击温馨提示的“取消”,点击请法人登录的×,在登录页面点击左上角返回按钮退出登录)
|
|
1312
|
-
// 7 退出小程序终止登录;old_1 历史数据:除登录成功之外的所有情况
|
|
1313
|
-
login_status,
|
|
1314
|
-
login_certificate: this.data.certTypeMap[cidType] || 1, // 证件类型
|
|
1315
|
-
invoke_location: '', // 调起位置
|
|
1316
|
-
login_validity_period: this.data.formData.verify_expire_time / 24 || '' // 免登录时间
|
|
1317
|
-
})
|
|
1318
|
-
},
|
|
1319
|
-
/**
|
|
1320
|
-
* 生命周期函数--监听页面初次渲染完成
|
|
1321
|
-
*/
|
|
1322
|
-
onReady() {
|
|
1323
|
-
|
|
1324
|
-
},
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* 生命周期函数--监听页面显示
|
|
1328
|
-
*/
|
|
1329
|
-
onShow() {
|
|
1330
|
-
|
|
1331
|
-
},
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* 生命周期函数--监听页面隐藏
|
|
1335
|
-
*/
|
|
1336
|
-
onHide() {
|
|
1337
|
-
this.clearTimer();
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
* 生命周期函数--监听页面卸载
|
|
1342
|
-
*/
|
|
1343
|
-
onUnload() {
|
|
1344
|
-
this.clearTimer();
|
|
1345
|
-
},
|
|
1346
|
-
// 清理定时器
|
|
1347
|
-
clearTimer() {
|
|
1348
|
-
if (this.countdownTimer) {
|
|
1349
|
-
clearInterval(this.countdownTimer);
|
|
1350
|
-
this.countdownTimer = null;
|
|
1351
|
-
}
|
|
1352
|
-
},
|
|
1353
|
-
/**
|
|
1354
|
-
* 页面相关事件处理函数--监听用户下拉动作
|
|
1355
|
-
*/
|
|
1356
|
-
onPullDownRefresh() {
|
|
1357
|
-
|
|
1358
|
-
},
|
|
1359
|
-
|
|
1360
|
-
/**
|
|
1361
|
-
* 页面上拉触底事件的处理函数
|
|
1362
|
-
*/
|
|
1363
|
-
onReachBottom() {
|
|
1364
|
-
|
|
1365
|
-
},
|
|
1366
|
-
|
|
1367
|
-
/**
|
|
1368
|
-
* 用户点击右上角分享
|
|
1369
|
-
*/
|
|
1370
|
-
onShareAppMessage() {
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
-
})
|