weapps-plugin-jingtong-verify 1.5.1 → 1.5.3

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.
Files changed (20) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/sdk.js +32 -1
  4. package/weapps-plugin-jingtong-verify/i18n/rules.js +29 -0
  5. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxss +7 -0
  6. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.js +102 -30
  7. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxml +12 -18
  8. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxss +3 -2
  9. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.js +3 -1
  10. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxml +3 -1
  11. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxss +3 -3
  12. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.js +409 -13
  13. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxml +40 -3
  14. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxss +41 -0
  15. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +106 -3
  16. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +1 -1
  17. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxss +2 -2
  18. package/weapps-plugin-jingtong-verify/utils/request.js +69 -3
  19. package/weapps-plugin-jingtong-verify/utils/rules.js +19 -1
  20. package/weapps-plugin-jingtong-verify/utils/validate.js +17 -1
package/README.md CHANGED
@@ -1,2 +1,2 @@
1
1
  # SDK #
2
- 1.5.1
2
+ 1.5.3
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.1",
5
+ "version": "1.5.3",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -18,4 +18,4 @@
18
18
  "crypto-js": "^3.3.0",
19
19
  "miniprogram-sm-crypto": "^0.3.13"
20
20
  }
21
- }
21
+ }
package/sdk.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const jingtongVerifyRequest = require('./weapps-plugin-jingtong-verify/utils/request')
2
2
  const { nation } = require("./weapps-plugin-jingtong-verify/utils/country")
3
+ // const jingtongVerifyRequest = require('./utils/request')
4
+ // const { nation } = require("./utils/country")
3
5
  const {
4
6
  flow,
5
7
  config
@@ -24,6 +26,13 @@ const parseOptions = (options) => {
24
26
  return options
25
27
  }
26
28
 
29
+ // 身份验证
30
+ exports.goToFace = () => {
31
+ console.log('跳转到子包 === 身份验证服务')
32
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/face-verify/face-verify', {
33
+ needUnite: 'false' // 需串联起来
34
+ })
35
+ }
27
36
  // 获取会话
28
37
  exports.getSession = (options) => {
29
38
  // 对参数做兼容性处理
@@ -70,7 +79,29 @@ const toBindPhone = (source) => {
70
79
  source
71
80
  })
72
81
  }
73
-
82
+ // 去设置登录密码
83
+ exports.goToBankCardLoginPwdSetting = (options) => {
84
+ console.log('跳转到子包 === 设置登录密码')
85
+ // 对参数做兼容性处理
86
+ let optionsParse = parseOptions(options)
87
+ jingtongVerifyRequest.getSession({
88
+ success: res => {
89
+ console.log(res)
90
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting',{
91
+ "name": res.name,
92
+ "idCardNumber": res.cid,
93
+ "strCid": res.star_cid,
94
+ "cid_type": res.cid_type,
95
+ "verify_expire_time": res.verify_expire_time
96
+ })
97
+ },
98
+ fail: fail => {
99
+ console.log('getSession-fail', fail)
100
+ optionsParse && optionsParse.fail && optionsParse.fail(fail)
101
+ }
102
+ })
103
+
104
+ }
74
105
  // 比较两个时间 time1,time2均为日期类型
75
106
  // 判断当前日期与time1日期是否相差小于6月
76
107
  const completeDate = (time1, m) => {
@@ -344,6 +344,35 @@ const rules = {
344
344
  en: 'Please enter your login password'
345
345
  }
346
346
  },
347
+ verification_code: {
348
+ required: {
349
+ zh_CN: '请输入验证码',
350
+ en: 'Please enter the verification code'
351
+ }
352
+ },
353
+ },
354
+ // 设置密码
355
+ bankCardSetPwdRules: {
356
+ bank_card_password: {
357
+ required: {
358
+ zh_CN: '请输入登录密码',
359
+ en: 'Please enter your login password'
360
+ },
361
+ validate: {
362
+ zh_CN: '请输入有效登录密码',
363
+ en: 'Please enter your login password'
364
+ }
365
+ },
366
+ bank_card_pwd_password: {
367
+ required: {
368
+ zh_CN: '请再次输入登录密码',
369
+ en: 'Please enter your login password again'
370
+ },
371
+ validate: {
372
+ zh_CN: '两次密码输入不一致',
373
+ en: 'Please enter your login password again'
374
+ }
375
+ },
347
376
  },
348
377
  // 忘记密码设置新密码
349
378
  bankCardSetNewPwdRules: {
@@ -192,6 +192,13 @@
192
192
  align-items: center;
193
193
  justify-content: center;
194
194
  border-radius: 10rpx;
195
+ color: #62667a;
196
+ text-align: center;
197
+ font-family: "PingFang SC";
198
+ font-size: 17px;
199
+ font-style: normal;
200
+ font-weight: 500;
201
+ line-height: normal;
195
202
  }
196
203
 
197
204
  .readonly-input input {
@@ -58,7 +58,7 @@ Page({
58
58
  bank_card_password: '',
59
59
  bank_card_pwd_password: ''
60
60
  },
61
- pwdRules: rulesConfig.bankCardSetPwdRules('zh_CN'),
61
+ pwdRules: rulesConfig.bankCardSetNewPwdRules('zh_CN'),
62
62
  validatePwdType: {
63
63
  bank_card_password(value) {
64
64
  return utils.validate.checkBankCardLoginPwd(value).data
@@ -132,6 +132,8 @@ Page({
132
132
  formData.cid_type = options.cid_type
133
133
  formData.verify_expire_time = options.verify_expire_time
134
134
  formSafeData.cid_type = options.cid_type
135
+ // formSafeData.id_card_number = options.idCardNumber
136
+ // formSafeData.strCid = options.strCid
135
137
  this.setData({
136
138
  formData: formData,
137
139
  formSafeData: formSafeData
@@ -157,16 +159,17 @@ Page({
157
159
  this.setData({
158
160
  currentStep: this.data.currentStep + 1
159
161
  });
160
- if(this.data.currentStep == 1){
161
- // this.getTailNumber()
162
- }
162
+ // if(this.data.currentStep == 1){
163
+ // this.getTailNumber()
164
+ // }
163
165
  }
164
166
  },
165
167
  /**
166
168
  * 获取手机号尾号并设置证件号码
167
169
  */
168
- getTailNumber (e) {
169
- let value = e.detail.value
170
+ getTailNumber () {
171
+ // let value = e.detail.value
172
+ let value = this.data.formSafeData.id_card_number
170
173
  if(value === '' || value === null){
171
174
  return
172
175
  }
@@ -181,19 +184,19 @@ Page({
181
184
  "support_type": '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
182
185
  }
183
186
  console.log('结果')
184
- console.log(this.toOtherWay(params, 2, value))
187
+ // console.log(this.toOtherWay(params, 2, value))
185
188
 
186
- this.toOtherWay(params, 2, value)
187
- // setTimeout(() => {
188
- // console.log(this.data.isIdCardSuccess)
189
- // // this.toGetTailNumber(value)
190
- // }, 100)
189
+ // this.toOtherWay(params, 2, value)
190
+ setTimeout(() => {
191
+ // console.log(this.data.isIdCardSuccess)
192
+ this.toGetTailNumber(value)
193
+ }, 100)
191
194
  },
192
195
  toGetTailNumber (value) {
193
- const { isIdCardSuccess } = this.data
194
- if(!isIdCardSuccess){
195
- return
196
- }
196
+ // const { isIdCardSuccess } = this.data
197
+ // if(!isIdCardSuccess){
198
+ // return
199
+ // }
197
200
  // let value = e.detail.value
198
201
  // const { id_card_number, strCid } = this.data.formSafeData
199
202
  // let { formSafeData } = this.data
@@ -645,11 +648,13 @@ Page({
645
648
  const { errcode }= res
646
649
  if(errcode === 0){
647
650
  wx.hideLoading()
651
+ // 判断type,1为信息确认,2为信息确认并获取手机号尾号,目前业务不需要走type=2
648
652
  if(type === 1) {
649
653
  this.setData({
650
654
  set_type: 3
651
655
  })
652
- this.nextStep()
656
+ // 先去根据身份证校验手机号,正确才能走下一步,不然只能走人脸识别
657
+ this.toCheckPhoneByIdCard()
653
658
  } else {
654
659
  this.setData({
655
660
  isIdCardSuccess: true
@@ -672,17 +677,56 @@ Page({
672
677
  })
673
678
  }, 1500)
674
679
  },
680
+ /**
681
+ * 根据身份证校验手机号,正确才能走下一步,不然只能走人脸识别
682
+ */
683
+ toCheckPhoneByIdCard() {
684
+ const { id_card_number } = this.data.formData
685
+ const checkPhoneByIdCardParam = {
686
+ "id_card_number": id_card_number,
687
+ "phone_number": ''
688
+ }
689
+ jingtongVerifyRequest.getInfoCheck(checkPhoneByIdCardParam).then(res => {
690
+ const { errmsg, errcode }= res
691
+ if(errcode === 0){
692
+ if(res.data.phone_suffix) {
693
+ this.setData({
694
+ formSafeDataCodeMobile: res.data.phone_suffix,
695
+ phoneNumberEndTitle: '(尾号' + res.data.phone_suffix + ')'
696
+ })
697
+ // 下一步
698
+ this.nextStep()
699
+ } else {
700
+ wx.showToast({
701
+ title: '手机绑定状态异常,请使用人脸识别方式验证',
702
+ icon: 'none',
703
+ duration: 3000
704
+ })
705
+ this.setData({
706
+ formSafeDataCodeMobile: '',
707
+ phoneNumberEndTitle: ''
708
+ })
709
+ }
710
+ } else {
711
+ wx.showToast({
712
+ title: errmsg,
713
+ icon: 'none',
714
+ duration: 3000
715
+ })
716
+ }
717
+ })
718
+ },
675
719
  /**
676
720
  * 发送验证码
677
721
  */
678
722
  sendVerificationCode () {
679
- if(!this.data.isIdCardSuccess){
680
- wx.showToast({
681
- title: '身份证号码验证没有通过,请重新验证',
682
- icon: 'none'
683
- });
684
- return;
685
- }
723
+ // if(!this.data.isIdCardSuccess){
724
+ // wx.showToast({
725
+ // title: '身份证号码验证没有通过,请重新验证',
726
+ // icon: 'none'
727
+ // });
728
+ // return;
729
+ // }
686
730
  if (this.data.isCountingDown) {
687
731
  return;
688
732
  }
@@ -744,8 +788,8 @@ Page({
744
788
  // 调接口获取短信验证码
745
789
  jingtongVerifyRequest.sendSmsCode(phoneNumber).then(res => {
746
790
  console.log(res.data)
747
- const { data } = res
748
- if(data.errcode === 0){
791
+ const { data, errcode, errmsg } = res
792
+ if(errcode === 0){
749
793
  wx.showToast({
750
794
  title: '验证码已发送',
751
795
  icon: 'success'
@@ -754,12 +798,12 @@ Page({
754
798
  this.setData({
755
799
  isSendSms: true,
756
800
  retryCount: this.data.retryCount + 1,
757
- formSafeDataCode: data.data.code,
801
+ formSafeDataCode: data.code,
758
802
  getFormSafeDataCodeTime: Date.now()
759
803
  });
760
804
  } else {
761
805
  wx.showToast({
762
- title: '发送失败,请重试',
806
+ title: errmsg || '发送失败,稍后请重试',
763
807
  icon: 'none'
764
808
  });
765
809
  }
@@ -891,7 +935,34 @@ Page({
891
935
  })
892
936
  return
893
937
  }
894
- this.nextStep()
938
+
939
+ // 接口校验验证码
940
+ const smsCodeParam = {
941
+ "mobile": formSafeData.phone_number,
942
+ "mobileCode": formSafeData.verification_code
943
+ }
944
+ jingtongVerifyRequest.verifySmsCode(smsCodeParam).then(res => {
945
+ const { errcode, errmsg } = res
946
+ if (errcode === 0) {
947
+ if(!res.data.success){
948
+ wx.showToast({
949
+ title: '验证码不正确,请重新输入',
950
+ icon: 'none',
951
+ duration: 2000
952
+ })
953
+ return
954
+ } else{
955
+ this.nextStep()
956
+ }
957
+ } else {
958
+ wx.showToast({
959
+ title: errmsg,
960
+ icon: 'none',
961
+ duration: 2000
962
+ })
963
+ return
964
+ }
965
+ })
895
966
  },
896
967
  /**
897
968
  * 确认设置密码
@@ -993,7 +1064,8 @@ Page({
993
1064
  + '&cid_type=' + this.data.formData.cid_type
994
1065
  + '&name=' + this.data.formData.name
995
1066
  + '&verify_expire_time=' + this.data.formData.verify_expire_time
996
- + '&source_type=2',
1067
+ + '&source_type=2'
1068
+ + '&checkType=2',
997
1069
  })
998
1070
  }, 100)
999
1071
  })
@@ -9,7 +9,7 @@
9
9
  <image src="../../images/Frame.png" mode="aspectFit" class="img"></image>
10
10
  </view>
11
11
  <view class="title">{{ language == 'zh_CN' ? '设置新登录密码' : 'Set new login password' }}</view>
12
- <view class="title_describe">{{ language == 'zh_CN' ? '保护您个人信息更安全' : 'Protect your personal information more securely' }}</view>
12
+ <view class="title_describe">{{ language == 'zh_CN' ? '新登录密码设置后原密码将会失效' : 'After setting the new login password, the original password will become invalid' }}</view>
13
13
  </view>
14
14
  <view class="content-box" wx:if="{{ language === 'zh_CN' }}">
15
15
  <!-- 完整配置 -->
@@ -51,14 +51,8 @@
51
51
  label="证件号码"
52
52
  placeholder="请输入本人证件号码"
53
53
  value="{{ formData.strCid || formData.id_card_number }}"
54
- showEye="{{ formData.id_card_number }}"
55
- isOpen="{{ !formData.strCid }}"
56
54
  clearable="{{ false }}"
57
55
  class="readonly-input"
58
- isOpen="{{ !formData.strCid }}"
59
- showQuestion="{{ true }}"
60
- bind:showQuestionTip="showQuestionTip"
61
- bind:openEye="openEye"
62
56
  />
63
57
  </view>
64
58
  </g-form>
@@ -80,24 +74,23 @@
80
74
  bind:submit="handleSafeFormSubmit"
81
75
  >
82
76
  <view class="form-item-wrap">
83
- <!-- <g-input
77
+ <g-input
84
78
  id="id_card_number"
85
79
  data-star="strCid"
86
80
  label="身份证号码"
87
81
  placeholder="请输入本人证件号码"
88
82
  value="{{ formSafeData.strCid || formSafeData.id_card_number }}"
89
- clearable="{{ false }}"
90
- class="readonly-input"
91
- isOpen="{{ !formSafeData.strCid }}"
92
- bind:change="handleSafeChange"
83
+ clearable="{{ true }}"
84
+ isOpen="{{ !formSafeData.strCid }}"
93
85
  showQuestion="{{ true }}"
94
86
  bind:showQuestionTip="showQuestionTip"
95
- /> -->
96
-
87
+ />
88
+
89
+ <!-- bind:change="handleSafeChange" -->
97
90
  <!-- isOpen="{{ !formData.strCid }}" -->
98
91
  <!-- bind:openEye="openEye" -->
99
92
  <!-- showEye="{{ formData.id_card_number }}" -->
100
- <g-input
93
+ <!-- <g-input
101
94
  id="id_card_number"
102
95
  data-star="strCid"
103
96
  label="身份证号码"
@@ -108,7 +101,7 @@
108
101
  showQuestion="{{ true }}"
109
102
  bind:showQuestionTip="showQuestionTip"
110
103
  bind:blur="getTailNumber"
111
- />
104
+ /> -->
112
105
  </view>
113
106
  <!-- 手机号码 -->
114
107
  <view class="form-item-wrap">
@@ -192,12 +185,13 @@
192
185
  bind:blur="handlePwdStrongChange"
193
186
  />
194
187
  </view>
195
- <!-- 确认登录密码 -->
188
+ <!-- 确认新密码 -->
196
189
  <view class="form-item-wrap">
197
190
  <g-input
198
191
  id="bank_card_pwd_password"
199
- label="确认登录密码"
192
+ label="确认新密码"
200
193
  placeholder="请再次输入新登录密码"
194
+ placeholder-class="bank-card-verify-placeholder"
201
195
  value="{{ formPwdData.bank_card_pwd_password }}"
202
196
  clearable="true"
203
197
  password="true"
@@ -187,13 +187,14 @@
187
187
 
188
188
  .other-way-btn{
189
189
  width: 100%;
190
- height: 76rpx;
190
+ height: 96rpx;
191
191
  border: 1px solid #CE0022;
192
192
  display: flex;
193
193
  align-items: center;
194
194
  justify-content: center;
195
195
  border-radius: 10rpx;
196
196
  color: #CE0022;
197
+ font-size: 34rpx;
197
198
  }
198
199
 
199
200
  /* 步骤条以及内容 */
@@ -306,7 +307,7 @@
306
307
  .not_get_verification_code{
307
308
  padding:40rpx; color: #ce0022;
308
309
  font-family: "PingFang SC";
309
- font-size: 34rpx;
310
+ font-size: 28rpx;
310
311
  font-style: normal;
311
312
  font-weight: 500;
312
313
  line-height: normal;
@@ -29,6 +29,7 @@ Page({
29
29
  return utils.validate.checkBankCardLoginPwd(value).data && utils.validate.checkConfirmPwd(value, formData.bank_card_password).data
30
30
  }, // 记录是否已经登录成功
31
31
  },
32
+ isShowPasswordStrength: false,// 是否显示密码强度
32
33
  passwordStrength: 0, // 密码强度等级 0-3
33
34
  passwordStrengthText: '弱',
34
35
  // 是否显示自定义校验提示
@@ -181,7 +182,8 @@ Page({
181
182
 
182
183
  this.setData({
183
184
  passwordStrength: strength, // 弱=1,中=2,强=3
184
- passwordStrengthText: strengthText
185
+ passwordStrengthText: strengthText,
186
+ isShowPasswordStrength: true
185
187
  })
186
188
  }
187
189
  })
@@ -26,7 +26,7 @@
26
26
  <view class="form-item-wrap">
27
27
  <view class="form-item-header">
28
28
  <text class="form-label">设置登录密码<text class="required-star">*</text></text>
29
- <view class="password-strength-indicator">
29
+ <view class="password-strength-indicator" wx:if="{{isShowPasswordStrength}}">
30
30
  <view class="strength-bar">
31
31
  <view class="strength-segment weak {{ passwordStrength >= 1 ? 'active' : '' }}"></view>
32
32
  <view class="strength-segment medium {{ passwordStrength >= 2 ? 'active' : '' }}"></view>
@@ -40,6 +40,7 @@
40
40
  <g-input
41
41
  id="bank_card_password"
42
42
  placeholder="请输入登录密码"
43
+ placeholder-class="bank-card-verify-placeholder"
43
44
  value="{{ formData.bank_card_password }}"
44
45
  clearable="true"
45
46
  password="true"
@@ -54,6 +55,7 @@
54
55
  id="bank_card_pwd_password"
55
56
  label="确认登录密码"
56
57
  placeholder="请再次输入登录密码"
58
+ placeholder-class="bank-card-verify-placeholder"
57
59
  value="{{ formData.bank_card_pwd_password }}"
58
60
  clearable="true"
59
61
  password="true"
@@ -202,15 +202,15 @@
202
202
  }
203
203
 
204
204
  .strength-segment.weak.active {
205
- background-color: #ff4757;
205
+ background-color: #CE0022;
206
206
  }
207
207
 
208
208
  .strength-segment.medium.active {
209
- background-color: #ffa502;
209
+ background-color: #EE8610;
210
210
  }
211
211
 
212
212
  .strength-segment.strong.active {
213
- background-color: #2ed573;
213
+ background-color: #21C58A;
214
214
  }
215
215
 
216
216
  .strength-text {