weapps-plugin-jingtong-verify 1.5.3 → 1.5.5

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.5.3
2
+ 1.5.5
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.5.3",
5
+ "version": "1.5.5",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -44,6 +44,8 @@ Page({
44
44
  '553': 9,
45
45
  '700': 3
46
46
  },
47
+ showLoginFailTipModal: false, // 登录失败次数锁定
48
+ showLoginFailTipTitle: '', // 登录失败次数锁定
47
49
  },
48
50
 
49
51
  /**
@@ -118,10 +120,14 @@ Page({
118
120
  // TODO: 执行判断失败次数是否大于等于5次
119
121
  if(failCount >= 5){
120
122
  // 点击确定出现该提示
121
- wx.showToast({
122
- title: '1小时内连续错误5次,已锁定账号,1小时后重试',
123
- icon: 'none',
124
- duration: 2000
123
+ // wx.showToast({
124
+ // title: '1小时内连续错误5次,已锁定账号,1小时后重试',
125
+ // icon: 'none',
126
+ // duration: 2000
127
+ // })
128
+ this.setData({
129
+ showLoginFailTipModal: true,
130
+ showLoginFailTipTitle:'1小时内连续错误5次,已锁定账号,1小时后重试'
125
131
  })
126
132
  return
127
133
  }
@@ -136,10 +142,14 @@ Page({
136
142
 
137
143
  } else{
138
144
  // 点击确定出现该提示
139
- wx.showToast({
140
- title: '当天累计错误超10次,已锁定账号,24小时后重试',
141
- icon: 'none',
142
- duration: 2000
145
+ // wx.showToast({
146
+ // title: '当天累计错误超10次,已锁定账号,24小时后重试',
147
+ // icon: 'none',
148
+ // duration: 2000
149
+ // })
150
+ this.setData({
151
+ showLoginFailTipModal: true,
152
+ showLoginFailTipTitle: '当天累计错误超10次,已锁定账号,24小时后重试'
143
153
  })
144
154
  return
145
155
  }
@@ -208,11 +218,14 @@ Page({
208
218
  constantVals.setStorageWithExpire(constantVals.bank_card_login_fail_time, Date.now())
209
219
  }
210
220
  // 点击确定出现该提示
211
- wx.showToast({
212
- title: errmsg,
213
- icon: 'none',
214
- duration: 2000
221
+ this.setData({
222
+ showLoginFailTipTitle: errmsg
215
223
  })
224
+ // wx.showToast({
225
+ // title: errmsg,
226
+ // icon: 'none',
227
+ // duration: 2000
228
+ // })
216
229
  } else{
217
230
  console.log('直接账密登录-登录成功')
218
231
  console.log(session)
@@ -437,6 +450,11 @@ Page({
437
450
  login_validity_period: this.data.formData.verify_expire_time / 24 || '' // 免登录时间
438
451
  })
439
452
  },
453
+ handleModalOk(){
454
+ this.setData({
455
+ showLoginFailTipModal: false
456
+ })
457
+ },
440
458
  /**
441
459
  * 生命周期函数--监听页面初次渲染完成
442
460
  */
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "usingComponents": {
3
3
  "g-form": "../../components/gsd-ui/g-form/index",
4
- "g-input": "../../components/gsd-ui/g-input/index"
4
+ "g-input": "../../components/gsd-ui/g-input/index",
5
+ "tip-modal": "../../components/tip-modal/tip-modal"
5
6
  },
6
7
  "navigationBarTitleText": "账密登录"
7
8
  }
@@ -70,4 +70,10 @@
70
70
  </view>
71
71
  </view>
72
72
  </view>
73
- </view>
73
+ </view>
74
+ <!-- 登录失败次数锁定提示 -->
75
+ <tip-modal
76
+ visible="{{ showLoginFailTipModal }}"
77
+ bind:cancel="handleModalOk"
78
+ desc1="{{showLoginFailTipTitle}}"
79
+ ></tip-modal>
@@ -103,6 +103,8 @@ Page({
103
103
  showTipFaceModal: false,
104
104
  set_type: 3, // 1:人脸认证,2:银行卡,3:短信
105
105
  isIdCardSuccess: false, //第二步安全验证,验证身份证号是否当前本人的身份证号
106
+ isShowPasswordStrength: false,// 是否显示密码强度
107
+ submitSafeMode:'',
106
108
  },
107
109
  /**
108
110
  * 生命周期函数--监听页面加载
@@ -612,7 +614,8 @@ Page({
612
614
 
613
615
  this.setData({
614
616
  passwordStrength: Math.min(strength, 3), // 最多显示3个等级
615
- passwordStrengthText: strengthText
617
+ passwordStrengthText: strengthText,
618
+ isShowPasswordStrength: true
616
619
  })
617
620
  }
618
621
  })
@@ -647,9 +650,9 @@ Page({
647
650
  console.log(res)
648
651
  const { errcode }= res
649
652
  if(errcode === 0){
650
- wx.hideLoading()
651
653
  // 判断type,1为信息确认,2为信息确认并获取手机号尾号,目前业务不需要走type=2
652
654
  if(type === 1) {
655
+ wx.hideLoading()
653
656
  this.setData({
654
657
  set_type: 3
655
658
  })
@@ -659,7 +662,9 @@ Page({
659
662
  this.setData({
660
663
  isIdCardSuccess: true
661
664
  })
662
- this.toGetTailNumber(value)
665
+ this.sendVerificationCode()
666
+ wx.hideLoading()
667
+ // this.toGetTailNumber(value)
663
668
  }
664
669
  } else {
665
670
  wx.hideLoading()
@@ -716,17 +721,52 @@ Page({
716
721
  }
717
722
  })
718
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
+ },
719
756
  /**
720
757
  * 发送验证码
721
758
  */
722
759
  sendVerificationCode () {
723
- // if(!this.data.isIdCardSuccess){
724
- // wx.showToast({
725
- // title: '身份证号码验证没有通过,请重新验证',
726
- // icon: 'none'
727
- // });
728
- // return;
729
- // }
760
+ wx.showLoading({
761
+ title: '发送中',
762
+ })
763
+ if(!this.data.isIdCardSuccess){
764
+ wx.showToast({
765
+ title: '身份证号码验证没有通过,请重新填写',
766
+ icon: 'none'
767
+ });
768
+ return;
769
+ }
730
770
  if (this.data.isCountingDown) {
731
771
  return;
732
772
  }
@@ -877,6 +917,33 @@ Page({
877
917
  async handleSafeFormSubmit (e) {
878
918
  console.log('进行身份证号码、手机号,短信验证码信息验证')
879
919
  const formValid = e.detail.validStatus
920
+ const isSafeOther = this.data.submitSafeMode === 'other'
921
+ if (isSafeOther){
922
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
923
+ this.data.submitSafeMode = ''
924
+ if (!formValid || !customValid.valid) {
925
+ // 自定义校验字段有问题,获取表单错误列表
926
+ const formErrList = e.detail.value
927
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
928
+ if (!formValid && customValid.valid) {
929
+ return
930
+ }
931
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
932
+ if (formValid && !customValid.valid) {
933
+ return
934
+ }
935
+ return
936
+ }
937
+ const { formData, formSafeData } = this.data
938
+ let params = {
939
+ 'id_card_number': formSafeData.id_card_number, // 证件号码
940
+ 'name': formData.name,
941
+ 'verify_type': '101', // 身份证 固定值101
942
+ 'support_type': '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
943
+ }
944
+ this.toOtherWay(params, 2, '')
945
+ return
946
+ }
880
947
  const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
881
948
  if (!formValid || !customValid.valid) {
882
949
  // 自定义校验字段有问题,获取表单错误列表
@@ -82,8 +82,7 @@
82
82
  value="{{ formSafeData.strCid || formSafeData.id_card_number }}"
83
83
  clearable="{{ true }}"
84
84
  isOpen="{{ !formSafeData.strCid }}"
85
- showQuestion="{{ true }}"
86
- bind:showQuestionTip="showQuestionTip"
85
+ bind:change="handleSafeChange"
87
86
  />
88
87
 
89
88
  <!-- bind:change="handleSafeChange" -->
@@ -128,7 +127,7 @@
128
127
  <view
129
128
  slot="append"
130
129
  class="verification-btn {{ isCountingDown ? 'disabled' : '' }}"
131
- bind:tap="sendVerificationCode"
130
+ bind:tap="handletoSendVerificationCode"
132
131
  >
133
132
  {{ verificationText }}
134
133
  </view>
@@ -162,10 +161,10 @@
162
161
  <view class="form-item-wrap">
163
162
  <view class="form-item-header">
164
163
  <text class="form-label">设置新密码<text class="required-star">*</text></text>
165
- <view class="password-strength-indicator">
164
+ <view class="password-strength-indicator" wx:if="{{isShowPasswordStrength}}">
166
165
  <view class="strength-bar">
167
- <view class="strength-segment weak {{ passwordStrength >= 1 ? 'active' : '' }}"></view>
168
- <view class="strength-segment medium {{ passwordStrength >= 2 ? 'active' : '' }}"></view>
166
+ <view class="strength-segment {{ passwordStrength >= 3 ? 'strong' : passwordStrength >= 2 ? 'medium' : 'weak' }} {{ passwordStrength >= 1 ? 'active' : '' }}"></view>
167
+ <view class="strength-segment {{ passwordStrength >= 3 ? 'strong' : 'medium' }} {{ passwordStrength >= 2 ? 'active' : '' }}"></view>
169
168
  <view class="strength-segment strong {{ passwordStrength >= 3 ? 'active' : '' }}"></view>
170
169
  </view>
171
170
  <view class="strength-text {{ passwordStrength >= 3 ? 'strong' : passwordStrength >= 2 ? 'medium' : 'weak' }}">
@@ -334,7 +334,7 @@
334
334
  .password-strength-indicator {
335
335
  display: flex;
336
336
  align-items: center;
337
- gap: 50rpx;
337
+ gap: 25rpx;
338
338
  }
339
339
 
340
340
  .strength-bar {
@@ -365,6 +365,7 @@
365
365
  .strength-text {
366
366
  font-size: 28rpx;
367
367
  font-weight: bold;
368
+ padding-right: 20rpx;
368
369
  }
369
370
 
370
371
  .strength-text.weak {
@@ -28,8 +28,8 @@
28
28
  <text class="form-label">设置登录密码<text class="required-star">*</text></text>
29
29
  <view class="password-strength-indicator" wx:if="{{isShowPasswordStrength}}">
30
30
  <view class="strength-bar">
31
- <view class="strength-segment weak {{ passwordStrength >= 1 ? 'active' : '' }}"></view>
32
- <view class="strength-segment medium {{ passwordStrength >= 2 ? 'active' : '' }}"></view>
31
+ <view class="strength-segment {{ passwordStrength >= 3 ? 'strong' : passwordStrength >= 2 ? 'medium' : 'weak' }} {{ passwordStrength >= 1 ? 'active' : '' }}"></view>
32
+ <view class="strength-segment {{ passwordStrength >= 3 ? 'strong' : 'medium' }} {{ passwordStrength >= 2 ? 'active' : '' }}"></view>
33
33
  <view class="strength-segment strong {{ passwordStrength >= 3 ? 'active' : '' }}"></view>
34
34
  </view>
35
35
  <view class="strength-text {{ passwordStrength >= 3 ? 'strong' : passwordStrength >= 2 ? 'medium' : 'weak' }}">
@@ -185,7 +185,7 @@
185
185
  .password-strength-indicator {
186
186
  display: flex;
187
187
  align-items: center;
188
- gap: 50rpx;
188
+ gap: 25rpx;
189
189
  }
190
190
 
191
191
  .strength-bar {
@@ -216,6 +216,7 @@
216
216
  .strength-text {
217
217
  font-size: 28rpx;
218
218
  font-weight: bold;
219
+ padding-right: 20rpx;
219
220
  }
220
221
 
221
222
  .strength-text.weak {
@@ -267,9 +267,9 @@ Page({
267
267
  // 当前时间
268
268
  const now = Date.now()
269
269
 
270
- // 判断是否在10分钟内(1小时 = 3600 * 1000 毫秒)
271
- const isWithinOneHour = (now - bankCardFailTime) < (10 * 60 * 1000)
272
- console.log('当前仍在10分钟限制内')
270
+ // 判断是否在30分钟内(1小时 = 3600 * 1000 毫秒)
271
+ const isWithinOneHour = (now - bankCardFailTime) < (30 * 60 * 1000)
272
+ console.log('当前仍在30分钟限制内')
273
273
  if(isWithinOneHour){
274
274
  this.setData({
275
275
  showToOtherModal: true
@@ -425,10 +425,10 @@ Page({
425
425
  bankCardFailCount = 0
426
426
  }
427
427
  bankCardFailCount = bankCardFailCount + 1
428
- constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_count, bankCardFailCount)
429
- if(bankCardFailCount === 1){
430
- // 设置10分钟后过期
431
- constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_time, Date.now(), 10 * 60)
428
+ constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_count, bankCardFailCount, 5 * 60)
429
+ if(bankCardFailCount >= 3){
430
+ // 设置30分钟后过期
431
+ constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_time, Date.now(), 30 * 60)
432
432
  }
433
433
  if(errmsg){
434
434
  wx.showToast({
@@ -492,10 +492,10 @@ Page({
492
492
  bankCardFailCount = 0
493
493
  }
494
494
  bankCardFailCount = bankCardFailCount + 1
495
- constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_count, bankCardFailCount)
496
- if(bankCardFailCount === 1){
497
- // 设置10分钟后过期
498
- constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_time, Date.now(), 10 * 60)
495
+ constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_count, bankCardFailCount, 5 * 60)
496
+ if(bankCardFailCount >= 3){
497
+ // 设置30分钟后过期
498
+ constantVal.setStorageWithExpire(constantVal.bank_card_verify_fail_time, Date.now(), 30 * 60)
499
499
  }
500
500
  if(errmsg){
501
501
  wx.showToast({
@@ -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
  const validator = require('../../components/gsd-ui/utils/validator')
8
+ const constantVal = require("../../utils/constantVal")
8
9
  let cidType = '111'
9
10
  let Nation = 'CHN'
10
11
 
@@ -194,6 +195,7 @@ Page({
194
195
  // 防重复点击标记 - 基于接口返回状态
195
196
  isSubmitting: false,
196
197
  checkType: 1, // 1:无密码和手机号,2:无密码有手机号,3:无手机号有密码
198
+ showOtherWayTipModal: false, // 提示
197
199
  },
198
200
 
199
201
  /**
@@ -1391,7 +1393,8 @@ Page({
1391
1393
  showFaceModal: false,
1392
1394
  showLockFaceModal: false,
1393
1395
  showCardModal: false,
1394
- showTipModal: false
1396
+ showTipModal: false,
1397
+ showOtherWayTipModal: false
1395
1398
  })
1396
1399
  },
1397
1400
 
@@ -1590,6 +1593,25 @@ Page({
1590
1593
  title: '验证中…',
1591
1594
  mask: true
1592
1595
  })
1596
+ // 验证是否在锁定期内,在的话,直接弹窗提示,并返回
1597
+ let bankCardFailTime = constantVal.getStorageWithExpire(constantVal.bank_card_verify_fail_time)
1598
+ if(bankCardFailTime){
1599
+ // 当前时间
1600
+ const now = Date.now()
1601
+
1602
+ // 判断是否在30分钟内(1小时 = 3600 * 1000 毫秒)
1603
+ const isWithinOneHour = (now - bankCardFailTime) < (30 * 60 * 1000)
1604
+ if(isWithinOneHour){
1605
+ console.log('当前仍在10分钟限制内')
1606
+ this.setData({
1607
+ showOtherWayTipModal: true
1608
+ })
1609
+ wx.showToast({
1610
+ title: '还存在银行卡验证失败锁定期内,请稍后再试',
1611
+ })
1612
+ return
1613
+ }
1614
+ }
1593
1615
  // 身份二要素校验
1594
1616
  const { name, id_card_number } = this.data.formData
1595
1617
  const verifyIdCardParams = {
@@ -514,3 +514,9 @@
514
514
  bind:CancelBtn="cancelFaceErrorModal"
515
515
  bind:ConfirmBtn="okFaceErrorModal"
516
516
  ></face-error-modal>
517
+ <!-- 其他方式锁定提示 -->
518
+ <tip-modal
519
+ visible="{{ showOtherWayTipModal }}"
520
+ bind:cancel="handleModalOk"
521
+ desc1="因您多次人脸识别验证未能通过,为保障账户安全,人脸识别的验证方式已暂时锁定,待锁定时效(10分钟)结束后,重新尝试人脸识别验证。"
522
+ ></tip-modal>
@@ -20,7 +20,8 @@ Page({
20
20
  24: '1天免登录',
21
21
  168: '7天免登录',
22
22
  720: '30天免登录'
23
- }
23
+ },
24
+ isShowUpdatePwd: false
24
25
  },
25
26
 
26
27
  /**
@@ -63,6 +64,7 @@ Page({
63
64
  loginWay: loginWay
64
65
  })
65
66
  }
67
+ this.getShowUpdatePwd(cid)
66
68
  // if (cid_type === '516') {
67
69
  // this.setData({
68
70
  // exitHmSession: true,
@@ -82,6 +84,37 @@ Page({
82
84
  }
83
85
  })
84
86
  },
87
+ getShowUpdatePwd(value) {
88
+ jingtongVerifyRequest.checkPhonePwd(value).then(res => {
89
+ const { errmsg, errcode } = res
90
+ if(errcode === 0){
91
+ if(!res.data.is_new){
92
+ this.setData({
93
+ isShowUpdatePwd: true
94
+ })
95
+ } else {
96
+ this.setData({
97
+ isShowUpdatePwd: false
98
+ })
99
+ }
100
+ } else {
101
+ wx.showToast({
102
+ title: errmsg,
103
+ icon: 'none',
104
+ duration: 2000,
105
+ })
106
+ }
107
+ }).catch(error => {
108
+ console.log('异常')
109
+ console.log(error)
110
+ const { errmsg } = error
111
+ wx.showToast({
112
+ title: errmsg,
113
+ icon: 'none',
114
+ duration: 2000,
115
+ })
116
+ })
117
+ },
85
118
  // 跳转登录管理页面
86
119
  goToLoginWag() {
87
120
  // 上报事件
@@ -7,7 +7,7 @@
7
7
  <image src="../../images/Vector.png" mode="" class="img" wx:if="{{ loginWay }}"/>
8
8
  </view>
9
9
  </view>
10
- <view class="cell" catchtap="goToUpdatePwd">
10
+ <view class="cell" catchtap="goToUpdatePwd" wx:if="{{isShowUpdatePwd}}">
11
11
  <view class="label">
12
12
  修改登录密码
13
13
  </view>