weapps-plugin-jingtong-verify 1.10.1 → 1.11.0

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 CHANGED
@@ -1,2 +1,2 @@
1
1
  # SDK #
2
- 1.10.0
2
+ 1.11.0
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "weapps-plugin-jingtong-verify",
3
3
  "pluginName": "weapps-plugin-jingtong-verify",
4
4
  "pluginType": "mp",
5
- "version": "1.10.1",
5
+ "version": "1.11.0",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -3,9 +3,9 @@
3
3
  <image class="bg-image" src="https://js.jt.beijing.gov.cn/jt/APP/APP-xiazai.png"></image>
4
4
  <image class="btn-image" src="https://js.jt.beijing.gov.cn/jt/APP/APP-zhidao.png" bind:tap="handleOk"></image>
5
5
  <view class="btns">
6
- <view class="btn" bind:tap="handleCopy" data-link='https://apps.apple.com/cn/app/%E4%BA%AC%E9%80%9A/id6749835625'>苹果用户:点击即可复制下载链接</view>
7
6
  <view class="btn" bind:tap="handleCopy" data-link='https://app.jt.beijing.gov.cn/api/file/external/jtfs/download/latest'>安卓用户:点击即可复制下载链接</view>
8
7
  <view class="btn" bind:tap="handleCopy" data-link='https://appgallery.huawei.com/app/detail?id=com.bjbdc.jingtong.hos&channelId=SHARE&source=appshare'>鸿蒙用户:点击即可复制下载链接</view>
8
+ <view class="btn" bind:tap="handleCopy" data-link='https://apps.apple.com/cn/app/%E4%BA%AC%E9%80%9A/id6749835625'>苹果用户:点击即可复制下载链接</view>
9
9
  </view>
10
10
  </view>
11
11
  </view>
@@ -191,7 +191,7 @@ Page({
191
191
  // 自定义校验提示文本
192
192
  customTipsMsg: '',
193
193
  // 显示引流modal
194
- showDrainageModal: true
194
+ showDrainageModal: false
195
195
  },
196
196
 
197
197
  handleDrainageModalOk() {
@@ -200,6 +200,16 @@ Page({
200
200
  })
201
201
  },
202
202
 
203
+ getDrainageModalIsShow() {
204
+ const that = this
205
+ jingtongVerifyRequest.getDrainageModalIsShow().then(res => {
206
+ console.log('getDrainageModalIsShow: ', res)
207
+ that.setData({
208
+ showDrainageModal: res && res.isShow === 1
209
+ })
210
+ })
211
+ },
212
+
203
213
  /**
204
214
  * 生命周期函数--监听页面加载
205
215
  */
@@ -211,6 +221,8 @@ Page({
211
221
 
212
222
  // 初始化操作,回填证件类型为身份证的身份信息
213
223
  this.initUserInfo()
224
+ // 查询引流弹窗是否显示
225
+ this.getDrainageModalIsShow()
214
226
  },
215
227
 
216
228
  // 初始化操作,回填证件类型为身份证的身份信息
@@ -395,7 +407,8 @@ Page({
395
407
 
396
408
  // if (count && 3 <= times && times <= 5) {
397
409
  if (count && times === 1) {
398
- console.log('==============累计刷脸失败超过3次,小于6次===============')
410
+ // console.log('==============累计刷脸失败超过3次,小于6次===============')
411
+ console.log('==============刷脸失败1次===============')
399
412
  this.setData({
400
413
  showFaceModal: true,
401
414
  // showFaceModalTimes: times
@@ -859,7 +872,7 @@ Page({
859
872
 
860
873
  // 开启人脸识别认证
861
874
  async toFaceVerify() {
862
- const [err, session] = await utils.awaitTo(jingtongVerifyRequest.faceVerifyWithIdCard(this.data.formData))
875
+ const [err, session] = await utils.awaitTo(jingtongVerifyRequest.faceVerifyWithIdCard2(this.data.formData))
863
876
 
864
877
  const cidType = this.data.formData.cid_type
865
878
 
@@ -871,8 +884,11 @@ Page({
871
884
  this.loginTracker(3, cidType)
872
885
 
873
886
  console.log('微信人脸识别失败', err)
874
- let { errmsg, errMsg, errCode } = JSON.parse(err)
875
- if (errCode) {
887
+ let { errmsg = '', errMsg = '', errCode = '', errcode = '' } = JSON.parse(err)
888
+ const resCode = errCode || errcode
889
+ console.log('===错误码===', resCode)
890
+ if (resCode) {
891
+ // https://developers.weixin.qq.com/miniprogram/dev/server/API/face/api_queryverifyinfo.html
876
892
  let errCodeArr = [
877
893
  10002,
878
894
  10003,
@@ -891,28 +907,28 @@ Page({
891
907
  90024,
892
908
  90025
893
909
  ]
894
- if (errCodeArr.indexOf(errCode) >= 0) {
910
+ if (errCodeArr.indexOf(resCode) >= 0) {
895
911
  console.log('在指定的错误码范围内,人脸失败次数+1')
896
912
  // 设置人脸失败次数
897
- await this.fetchFaceFailCount(true, errCode)
913
+ await this.fetchFaceFailCount(true, resCode)
898
914
  }
899
915
  // 人脸识别异常温馨提示弹窗
900
- this.handleFaceError(errCode)
916
+ this.handleFaceError(resCode)
901
917
  }
902
918
 
903
- if (errCode && errCode === 90100) {
919
+ if (resCode && resCode === 90100) {
904
920
  wx.showToast({
905
921
  title: '您已取消人脸识别',
906
922
  icon: 'none',
907
923
  duration: 3000
908
924
  })
909
- } else if (errCode && errCode === 10004) {
925
+ } else if (resCode && resCode === 10004) {
910
926
  wx.showToast({
911
927
  title: '人脸与身份信息不匹配',
912
928
  icon: 'none',
913
929
  duration: 3000
914
930
  })
915
- } else if (errCode && errCode === 10003) {
931
+ } else if (resCode && resCode === 10003) {
916
932
  wx.showToast({
917
933
  title: '姓名或证件号码有误',
918
934
  icon: 'none',
@@ -59,6 +59,8 @@ Page({
59
59
  verify_result
60
60
  }))
61
61
 
62
+ console.log('注销结果->', logOffErr, logOffRes)
63
+
62
64
  if (logOffErr) {
63
65
  console.log(logOffErr, '账号注销err')
64
66
  wx.showToast({
@@ -1,10 +1,17 @@
1
1
  // weapps-plugin-jingtong-verify/pages/setting/setting.js
2
2
  const jingtongVerifyRequest = require('../../utils/request')
3
- const { flow } = require("@wecity/weda-plugin-utils");
3
+ const {
4
+ flow
5
+ } = require("@wecity/weda-plugin-utils");
4
6
  const utils = require("../../utils/index")
5
- const { logout } = require("../../i18n/index");
7
+ const {
8
+ logout
9
+ } = require("../../i18n/index");
6
10
 
7
- import { SDKTrack, setAccountInfo } from '../../utils/QDTrackerNew/QDTrackerMain'
11
+ import {
12
+ SDKTrack,
13
+ setAccountInfo
14
+ } from '../../utils/QDTrackerNew/QDTrackerMain'
8
15
 
9
16
  Page({
10
17
 
@@ -28,12 +35,20 @@ Page({
28
35
 
29
36
  onLoad() {
30
37
  wx.hideShareMenu()
31
-
38
+
32
39
  let Gender = ''
33
40
  let Age = ''
34
41
  jingtongVerifyRequest.getSession({
35
42
  success: res => {
36
- let { cid, cid_type, sex, phone, face_time, realname_time, openid } = res
43
+ let {
44
+ cid,
45
+ cid_type,
46
+ sex,
47
+ phone,
48
+ face_time,
49
+ realname_time,
50
+ openid
51
+ } = res
37
52
  Gender = sex
38
53
  if (cid_type === '111' && cid) {
39
54
  Gender = utils.parseIDCard(cid).sex
@@ -49,7 +64,7 @@ Page({
49
64
  authExpired: (!face_time && !realname_time) || !cid,
50
65
  phone,
51
66
  star_phone: phone ? phone.replace(pho, '$1****$2') : ''
52
- })
67
+ })
53
68
 
54
69
  // 设置用户账号信息
55
70
  setAccountInfo(openid)
@@ -59,7 +74,11 @@ Page({
59
74
 
60
75
  // 同意协议和隐私政策
61
76
  viewPrivacy(e) {
62
- const { name, file, track } = e.currentTarget.dataset
77
+ const {
78
+ name,
79
+ file,
80
+ track
81
+ } = e.currentTarget.dataset
63
82
  console.log('文件地址', `https://js.jt.beijing.gov.cn/jt/tiffile/${file}.pdf`)
64
83
 
65
84
  const trackMap = {
@@ -132,7 +151,7 @@ Page({
132
151
  wx.removeStorageSync('tif.CAUniqueId')
133
152
  wx.removeStorageSync('tif.lastLoginTime')
134
153
 
135
-
154
+
136
155
  // 退出登录,执行业务侧回调清除本地缓存
137
156
  wx.$_ServiceConfiguration && wx.$_ServiceConfiguration.methods && wx.$_ServiceConfiguration.methods._loginOutCallBack && wx.$_ServiceConfiguration.methods._loginOutCallBack(wx.$_ServiceConfiguration)
138
157
 
@@ -177,7 +196,7 @@ Page({
177
196
  url: '../../pages/user-info/user-info'
178
197
  })
179
198
  },
180
-
199
+
181
200
  // 显示换绑手机号码弹窗
182
201
  showModal() {
183
202
  if (!this.data.authExpired) {
@@ -227,7 +246,7 @@ Page({
227
246
  let pho = /(\d{3})\d*(\d{4})/
228
247
 
229
248
  this.setData({
230
- phone: wx.getStorageSync('tif.realPhone') || '',
249
+ phone: wx.getStorageSync('tif.realPhone') || '',
231
250
  star_phone: phone ? phone.replace(pho, '$1****$2') : ''
232
251
  })
233
252
  }).catch(err => {
@@ -252,7 +271,11 @@ Page({
252
271
  title: '加载中…'
253
272
  })
254
273
 
255
- let { name, cid, cid_type } = this.data.sessionInfo
274
+ let {
275
+ name,
276
+ cid,
277
+ cid_type
278
+ } = this.data.sessionInfo
256
279
 
257
280
  if (!name || !cid || !cid_type) {
258
281
  wx.showToast({
@@ -281,49 +304,98 @@ Page({
281
304
  },
282
305
 
283
306
  // 进行微信人脸识别
284
- toWxFace(name, idCardNumber) {
307
+ async toWxFace() {
285
308
  let sessionInfo = this.data.sessionInfo
286
- wx.startFacialRecognitionVerify({
287
- name,
288
- idCardNumber,
289
- checkAliveType: '2',
290
- success(res) {
291
- console.log('刷脸认证结果: ', res)
292
- if (res.errCode !== 0) {
293
- wx.showToast({
294
- title: '人脸识别失败,请稍后再试',
295
- icon: 'none'
296
- })
297
- return
298
- } else {
299
- flow.navigateTo({
300
- url: `../../pages/log-off/log-off?sessionInfo=${JSON.stringify(sessionInfo)}&verify_result=${res.verifyResult}`
301
- })
302
- }
303
- },
304
- fail: err => {
305
- console.log('人脸识别err', err)
306
- let { errmsg, errMsg, errCode } = err
307
- if (errCode && errCode === 90100) {
308
- wx.showToast({
309
- title: '您已取消人脸识别',
310
- icon: 'none',
311
- duration: 3000
312
- })
313
- } else if (errCode && errCode === 10004) {
314
- wx.showToast({
315
- title: '人脸与身份信息不匹配',
316
- icon: 'none',
317
- duration: 3000
318
- })
319
- } else {
320
- wx.showToast({
321
- title: errmsg || errMsg || '人脸识别失败,请稍后再试',
322
- icon: 'none',
323
- duration: 3000
324
- })
325
- }
309
+ // wx.startFacialRecognitionVerify({
310
+ // name,
311
+ // idCardNumber,
312
+ // checkAliveType: '2',
313
+ // success(res) {
314
+ // console.log('刷脸认证结果: ', res)
315
+ // if (res.errCode !== 0) {
316
+ // wx.showToast({
317
+ // title: '人脸识别失败,请稍后再试',
318
+ // icon: 'none'
319
+ // })
320
+ // return
321
+ // } else {
322
+ // flow.navigateTo({
323
+ // url: `../../pages/log-off/log-off?sessionInfo=${JSON.stringify(sessionInfo)}&verify_result=${res.verifyResult}`
324
+ // })
325
+ // }
326
+ // },
327
+ // fail: err => {
328
+ // console.log('人脸识别err', err)
329
+ // let {
330
+ // errmsg,
331
+ // errMsg,
332
+ // errCode
333
+ // } = err
334
+ // if (errCode && errCode === 90100) {
335
+ // wx.showToast({
336
+ // title: '您已取消人脸识别',
337
+ // icon: 'none',
338
+ // duration: 3000
339
+ // })
340
+ // } else if (errCode && errCode === 10004) {
341
+ // wx.showToast({
342
+ // title: '人脸与身份信息不匹配',
343
+ // icon: 'none',
344
+ // duration: 3000
345
+ // })
346
+ // } else {
347
+ // wx.showToast({
348
+ // title: errmsg || errMsg || '人脸识别失败,请稍后再试',
349
+ // icon: 'none',
350
+ // duration: 3000
351
+ // })
352
+ // }
353
+ // }
354
+ // })
355
+
356
+
357
+ const [err, res] = await utils.awaitTo(jingtongVerifyRequest.yzFaceVerifyWithIdCard2({
358
+ cid_type: sessionInfo.cid_type,
359
+ id_card_number: sessionInfo.cid,
360
+ name: sessionInfo.name
361
+ }))
362
+ console.log('原子核验结果->', err, res)
363
+ if (err) {
364
+ let {
365
+ errmsg = '', errMsg = '', errCode = '', errcode = ''
366
+ } = JSON.parse(err)
367
+ const resCode = errCode || errcode
368
+ console.log('===错误码===', resCode)
369
+
370
+ if (resCode && resCode === 90100) {
371
+ wx.showToast({
372
+ title: '您已取消人脸识别',
373
+ icon: 'none',
374
+ duration: 3000
375
+ })
376
+ } else if (resCode && resCode === 10004) {
377
+ wx.showToast({
378
+ title: '人脸与身份信息不匹配',
379
+ icon: 'none',
380
+ duration: 3000
381
+ })
382
+ } else if (resCode && resCode === 10003) {
383
+ wx.showToast({
384
+ title: '姓名或证件号码有误',
385
+ icon: 'none',
386
+ duration: 3000
387
+ })
388
+ } else {
389
+ wx.showToast({
390
+ title: errmsg || errMsg || '认证失败,请稍后再试',
391
+ icon: 'none',
392
+ duration: 3000
393
+ })
326
394
  }
327
- })
395
+ } else {
396
+ flow.navigateTo({
397
+ url: `../../pages/log-off/log-off?sessionInfo=${JSON.stringify(sessionInfo)}&verify_result=${res.verify_result}`
398
+ })
399
+ }
328
400
  }
329
401
  })