weapps-plugin-jingtong-verify 1.5.3 → 1.5.4

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.5.3",
5
+ "version": "1.5.4",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -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
  })
@@ -659,7 +662,8 @@ Page({
659
662
  this.setData({
660
663
  isIdCardSuccess: true
661
664
  })
662
- this.toGetTailNumber(value)
665
+ this.sendVerificationCode()
666
+ // this.toGetTailNumber(value)
663
667
  }
664
668
  } else {
665
669
  wx.hideLoading()
@@ -716,17 +720,49 @@ Page({
716
720
  }
717
721
  })
718
722
  },
723
+ // 其他方式
724
+ handletoSendVerificationCode () {
725
+ console.log('启用sms验证')
726
+ try {
727
+ // 临时保存并移除 verification_code
728
+ const tempCode = this.data.formSafeData.verification_code
729
+ const tempFormSafeData = { ...this.data.formSafeData }
730
+ delete tempFormSafeData.verification_code
731
+
732
+ this.setData({
733
+ submitSafeMode: 'other',
734
+ formSafeData: tempFormSafeData
735
+ })
736
+
737
+ const form = this.selectComponent('#formSafe')
738
+ if (form && typeof form.handleSubmit === 'function') {
739
+ form.handleSubmit()
740
+ } else {
741
+ // 恢复 verification_code
742
+ this.setData({
743
+ formSafeData: { ...this.data.formSafeData, verification_code: tempCode },
744
+ submitSafeMode: ''
745
+ })
746
+ }
747
+ } catch (error) {
748
+ // 恢复 verification_code
749
+ this.setData({
750
+ formSafeData: { ...this.data.formSafeData, verification_code: tempCode },
751
+ submitSafeMode: ''
752
+ })
753
+ }
754
+ },
719
755
  /**
720
756
  * 发送验证码
721
757
  */
722
758
  sendVerificationCode () {
723
- // if(!this.data.isIdCardSuccess){
724
- // wx.showToast({
725
- // title: '身份证号码验证没有通过,请重新验证',
726
- // icon: 'none'
727
- // });
728
- // return;
729
- // }
759
+ if(!this.data.isIdCardSuccess){
760
+ wx.showToast({
761
+ title: '身份证号码验证没有通过,请重新填写',
762
+ icon: 'none'
763
+ });
764
+ return;
765
+ }
730
766
  if (this.data.isCountingDown) {
731
767
  return;
732
768
  }
@@ -877,6 +913,33 @@ Page({
877
913
  async handleSafeFormSubmit (e) {
878
914
  console.log('进行身份证号码、手机号,短信验证码信息验证')
879
915
  const formValid = e.detail.validStatus
916
+ const isSafeOther = this.data.submitSafeMode === 'other'
917
+ if (isSafeOther){
918
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
919
+ this.data.submitSafeMode = ''
920
+ if (!formValid || !customValid.valid) {
921
+ // 自定义校验字段有问题,获取表单错误列表
922
+ const formErrList = e.detail.value
923
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
924
+ if (!formValid && customValid.valid) {
925
+ return
926
+ }
927
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
928
+ if (formValid && !customValid.valid) {
929
+ return
930
+ }
931
+ return
932
+ }
933
+ const { formData, formSafeData } = this.data
934
+ let params = {
935
+ 'id_card_number': formSafeData.id_card_number, // 证件号码
936
+ 'name': formData.name,
937
+ 'verify_type': '101', // 身份证 固定值101
938
+ 'support_type': '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
939
+ }
940
+ this.toOtherWay(params, 2, '')
941
+ return
942
+ }
880
943
  const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
881
944
  if (!formValid || !customValid.valid) {
882
945
  // 自定义校验字段有问题,获取表单错误列表
@@ -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' }}">
@@ -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' }}">
@@ -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
 
@@ -1590,6 +1591,11 @@ Page({
1590
1591
  title: '验证中…',
1591
1592
  mask: true
1592
1593
  })
1594
+ // 验证是否在锁定期内,在的话,直接弹窗提示,并返回
1595
+ let bankCardFailTime = constantVal.getStorageWithExpire(constantVal.bank_card_verify_fail_time)
1596
+ if(bankCardFailTime){
1597
+
1598
+ }
1593
1599
  // 身份二要素校验
1594
1600
  const { name, id_card_number } = this.data.formData
1595
1601
  const verifyIdCardParams = {