weapps-plugin-jingtong-verify 1.4.0 → 1.4.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/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.4.0",
5
+ "version": "1.4.1",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -12,6 +12,9 @@
12
12
  </view>
13
13
  </view>
14
14
  <view class="bottom-box">
15
- <button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">从微信获取,完成绑定</button>
15
+ <button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
16
+ <text class="cn">从微信获取,完成绑定</text>
17
+ <text class="en">You can access your phone number from WeChat to complete the bonding process.</text>
18
+ </button>
16
19
  </view>
17
20
  </view>
@@ -8,10 +8,23 @@
8
8
  background: rgba(206, 0, 34, 1);
9
9
  color: #ffffff;
10
10
  width: 686rpx !important;
11
- height: 96rpx;
12
11
  border-radius: 16rpx;
13
- font-size: 34rpx;
12
+ padding: 24rpx 28rpx;
14
13
  box-shadow: 0 24rpx 48rpx 0 rgba(206, 0, 34, 0.15);
14
+ display: flex;
15
+ flex-direction: column;
16
+ justify-content: center;
17
+ align-items: center;
18
+ font-weight: normal;
19
+ }
20
+ .btn .cn {
21
+ font-size: 34rpx;
22
+ line-height: 40rpx;
23
+ margin-bottom: 12rpx;
24
+ }
25
+ .btn .en {
26
+ font-size: 26rpx;
27
+ line-height: 30rpx;
15
28
  }
16
29
  .content-box {
17
30
  display: flex;
@@ -5,6 +5,7 @@ const { flow } = require("@wecity/weda-plugin-utils");
5
5
  const rulesConfig = require("../../utils/rules")
6
6
  import { SDKTrack, setAccountInfo } from '../../utils/QDTrackerNew/QDTrackerMain'
7
7
  let cidType = '111'
8
+ let Nation = 'CHN'
8
9
 
9
10
  Page({
10
11
  /**
@@ -71,7 +72,7 @@ Page({
71
72
  ],
72
73
  validateType: {
73
74
  id_card_number(value) {
74
- return utils.validate.checkCid(value, cidType).data
75
+ return utils.validate.checkCid(value, cidType, Nation).data
75
76
  },
76
77
  name(value) {
77
78
  return utils.validate.checkName(value, cidType).data
@@ -83,7 +84,7 @@ Page({
83
84
  return utils.validate.checkName(value, cidType).data
84
85
  },
85
86
  passport_number(value) {
86
- return utils.validate.checkHmtPassport(value, cidType).data
87
+ return utils.validate.checkHmtPassport(value, cidType, Nation).data
87
88
  },
88
89
  },
89
90
  rulesMap: {
@@ -171,6 +172,7 @@ Page({
171
172
  // 标记港澳居民来往内地通行证存在回显的session信息
172
173
  // exitHmSession: false,
173
174
  // HmSession: {}
175
+ showForeignTip: false
174
176
  },
175
177
 
176
178
  /**
@@ -204,6 +206,14 @@ Page({
204
206
  // 设置用户账号信息
205
207
  setAccountInfo(res.openid)
206
208
 
209
+ const hideForeignTip = wx.getStorageSync('tif.hideForeignTip') || 0
210
+ console.log('hideForeignTip', hideForeignTip)
211
+ if (!cid && hideForeignTip !== '1') {
212
+ this.setData({
213
+ showForeignTip: true
214
+ })
215
+ }
216
+
207
217
  if (cid_type === '111' && cid && name) {
208
218
  // 回填身份证类型
209
219
  this.setData({
@@ -254,6 +264,7 @@ Page({
254
264
  // 三证照:港澳通行证、台湾通行证、华侨护照
255
265
  matchOptionsRule () {
256
266
  let { cid_type, nation, sbSwitch } = this.data.formData
267
+ Nation = nation
257
268
 
258
269
  if (cid_type === '516' || cid_type === '511' || cid_type === '414') {
259
270
  if (nation !== 'CHN' && cid_type === '516') {
@@ -381,6 +392,7 @@ Page({
381
392
  let { cid_type, nation, nation_name } = this.data.formData
382
393
  let { rules, currentAuthType } = this.data.rulesMap[cid_type]
383
394
  console.log('核验源', currentAuthType)
395
+ Nation = nation
384
396
  // 默认【中国】
385
397
  if (cid_type === '516' || cid_type === '511' || cid_type === '414') {
386
398
  nation = 'CHN'
@@ -405,6 +417,7 @@ Page({
405
417
  if (formDataTemp && formDataTemp[cid_type]) {
406
418
  console.log('存在可回填的temp数据', formDataTemp[cid_type])
407
419
  let formData = Object.assign(formDataOld, formDataTemp[cid_type])
420
+ Nation = formData.nation
408
421
  this.setData({
409
422
  formData
410
423
  })
@@ -523,6 +536,7 @@ Page({
523
536
  wx.setStorageSync('tif.formDataTemp', formDataTemp)
524
537
  if (needFull) {
525
538
  // 是否需要回传
539
+ Nation = ''
526
540
  this.setData({
527
541
  formData: {
528
542
  cid_type: newCidType,
@@ -613,6 +627,7 @@ Page({
613
627
  verify_expire_time: verify_expire_time && Number(verify_expire_time) || ''
614
628
  }
615
629
  formData = Object.assign(formData, res, passportOldData)
630
+ Nation = nation
616
631
  this.setData({
617
632
  formData,
618
633
  passportOldData
@@ -1356,5 +1371,13 @@ Page({
1356
1371
  })
1357
1372
  // 处理三证照的正则问题
1358
1373
  this.matchOptionsRule()
1374
+ },
1375
+
1376
+ // 隐藏提示
1377
+ closeForeignTip() {
1378
+ wx.setStorageSync('tif.hideForeignTip', '1')
1379
+ this.setData({
1380
+ showForeignTip: false
1381
+ })
1359
1382
  }
1360
1383
  })
@@ -29,6 +29,12 @@
29
29
  ></g-picker>
30
30
  </view>
31
31
 
32
+ <!-- 外国人提示 -->
33
+ <view class="foreign-tip" wx:if="{{ formData.cid_type === '111' && showForeignTip }}">
34
+ <text>For foreign nationals, please click here to select International passport.</text>
35
+ <image src="../../images/close-circle.png" mode="widthFix" bind:tap="closeForeignTip" />
36
+ </view>
37
+
32
38
  <!-- 银行卡核验(港澳/台居住证) -->
33
39
  <view wx:if="{{ currentAuthType === 'cardAuth' }}">
34
40
  <view class="form-tip">
@@ -88,7 +94,7 @@
88
94
  placeholder="请输入本人姓名"
89
95
  value="{{ formData.strName || formData.name }}"
90
96
  clearable="{{ false }}"
91
- showEye="{{ true }}"
97
+ showEye="{{ formData.name }}"
92
98
  isOpen="{{ !formData.strName }}"
93
99
  bind:change="handleChange"
94
100
  showQuestion="{{ true }}"
@@ -105,7 +111,7 @@
105
111
  placeholder="请输入本人证件号码"
106
112
  value="{{ formData.strCid || formData.id_card_number }}"
107
113
  clearable="{{ false }}"
108
- showEye="{{ true }}"
114
+ showEye="{{ formData.id_card_number }}"
109
115
  isOpen="{{ !formData.strCid }}"
110
116
  bind:change="handleChange"
111
117
  showQuestion="{{ true }}"
@@ -80,4 +80,38 @@
80
80
  background: linear-gradient( #F5FAFF 0%, #F1F7FF 100%);
81
81
  padding: 0 20rpx 20rpx;
82
82
  box-sizing: border-box;
83
+ }
84
+
85
+ .foreign-tip {
86
+ display: flex;
87
+ flex-direction: row;
88
+ justify-content: space-between;
89
+ align-items: center;
90
+ margin: -12rpx 32rpx 0;
91
+ background: #EEF2F6;
92
+ border-radius: 8rpx;
93
+ padding: 24rpx 16rpx 24rpx 24rpx;
94
+ position: relative;
95
+ }
96
+ .foreign-tip::before {
97
+ content: '';
98
+ position: absolute;
99
+ border-left: 17rpx solid transparent;
100
+ border-top: 17rpx solid transparent;
101
+ border-bottom: 17rpx solid #EEF2F6;
102
+ border-right: 17rpx solid transparent;
103
+ top: -30rpx;
104
+ right: 18rpx;
105
+
106
+ }
107
+ .foreign-tip text {
108
+ font-weight: 500;
109
+ font-size: 26rpx;
110
+ color: #62667A;
111
+ line-height: 30rpx;
112
+ }
113
+ .foreign-tip image {
114
+ width: 40rpx;
115
+ height: 40rpx;
116
+ flex-shrink: 0;
83
117
  }
@@ -96,6 +96,7 @@ Page({
96
96
  wx.removeStorageSync('tif.faceTimeStamp')
97
97
  wx.removeStorageSync('tif.CAUniqueId')
98
98
  wx.removeStorageSync('tif.lastLoginTime')
99
+ wx.removeStorageSync('tif.hideForeignTip')
99
100
 
100
101
  flow.navigateTo({
101
102
  url: '../logoff-success/logoff-success',
@@ -70,8 +70,8 @@ Page({
70
70
  sex = '女'
71
71
  }
72
72
  }
73
- // 港澳/台通行证、华侨护照和外国护照四类证件
74
- const fourTypeCertList = ['516', '511', '414', '700']
73
+ // 港澳/台通行证、华侨护照三类证件
74
+ const fourTypeCertList = ['516', '511', '414']
75
75
  const fourTypeCert = fourTypeCertList.includes(cid_type) || false
76
76
 
77
77
  // 获取弹窗时间戳
@@ -83,6 +83,7 @@ Page({
83
83
  birthday = birth_date.slice(0, 4) + '-' + birth_date.slice(4, 6) + '-' + birth_date.slice(6, 8);
84
84
  }
85
85
  this.setData({
86
+ cid_type,
86
87
  sexIndex: sex === '未知' ? 0 : Number(res.sex) - 1,
87
88
  birthday,
88
89
  fourTypeCert,
@@ -50,6 +50,13 @@
50
50
  </text>
51
51
  </view>
52
52
 
53
+ <view class="cell" wx:if="{{ cid_type === '700' }}">
54
+ <text class="label">出生日期</text>
55
+ <text class="content">
56
+ <text>{{ birthday }}</text>
57
+ </text>
58
+ </view>
59
+
53
60
  <view class="cell">
54
61
  <view class="cell-flex">
55
62
  <text class="label">证件号码</text>
@@ -349,7 +349,8 @@ function checkOrgName(orgName) {
349
349
  }
350
350
 
351
351
  // 证件号码
352
- function checkCid(cid, ctype, who = '') {
352
+ function checkCid(cid, ctype, nation, who = '') {
353
+ console.log('校验证件号码', nation)
353
354
  cid = removeSpaceFun(cid);
354
355
  if (!cid) {
355
356
  return {
@@ -403,7 +404,7 @@ function checkCid(cid, ctype, who = '') {
403
404
  // 港澳居民来往内地通行证、台湾居民来往大陆通行证
404
405
  if (ctype === 516 || ctype === 511) {
405
406
  console.log('港澳居民来往内地通行证、台湾居民来往大陆通行证')
406
- if (!checkHmtPassport(cid, ctype).data) {
407
+ if (!checkHmtPassport(cid, ctype, nation).data) {
407
408
  return {
408
409
  data: false,
409
410
  msg: who + '证件号码不正确'
@@ -470,22 +471,39 @@ function checkResidenceCid(cid) {
470
471
  /**
471
472
  * 港澳台居民来往内地通行证号码校验
472
473
  * https://www.nia.gov.cn/n741440/n741547/c1197066/content.html
473
- * 港澳:"H/M"+8位阿拉伯数字
474
+ * https://www.guiyang.gov.cn/zwgk/zdlyxxgk2024/shsyjzdms/shaq/crjgl/202408/t20240823_85468731.html
475
+ * 港澳-中国籍:"H/M"+8位阿拉伯数字
476
+ * 港澳-外籍:"HA/MA"+7位阿拉伯数字
474
477
  * 台湾: 8位阿拉伯数字
475
478
  */
476
- function checkHmtPassport(value, ctype) {
479
+ function checkHmtPassport(value, ctype, nation = 'CHN') {
480
+ console.log('港澳台居民来往内地通行证号码校验', nation)
477
481
  value = value.replace(/(^\s*)|(\s*$)/g, "")
478
482
  ctype = +ctype
479
483
 
480
484
  const isHm = [516,17].includes(ctype) // 港澳
481
485
  const isTw = [511,18].includes(ctype) // 台湾
482
486
  const hmReg = /^(H|M|h|m)[0-9]{8}$/
487
+ const hmForeignReg = /^[hm]a\d{7}$/i
483
488
  const twReg = /^[0-9]{8}$/
484
489
 
485
- if (isHm && !hmReg.test(value)) {
486
- return {
487
- data: false,
488
- msg: '港澳居民来往内地通行证号码不正确'
490
+ if (isHm) {
491
+ if (!nation || nation === 'CHN') {
492
+ console.log('中国籍')
493
+ if (!hmReg.test(value)) {
494
+ return {
495
+ data: false,
496
+ msg: '港澳居民来往内地通行证号码不正确'
497
+ }
498
+ }
499
+ } else {
500
+ console.log('外籍')
501
+ if (!hmForeignReg.test(value)) {
502
+ return {
503
+ data: false,
504
+ msg: '港澳居民来往内地通行证号码不正确'
505
+ }
506
+ }
489
507
  }
490
508
  }
491
509
  if (isTw && !twReg.test(value)) {