weapps-plugin-jingtong-verify 1.4.3 → 1.4.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.4.2
2
+ 1.4.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.4.3",
5
+ "version": "1.4.5",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -434,6 +434,11 @@ Page({
434
434
  console.log('存在可回填的temp数据', formDataTemp[cid_type])
435
435
  let formData = Object.assign(formDataOld, formDataTemp[cid_type])
436
436
  Nation = formData.nation
437
+ // 国外护照,回填名字
438
+ if (cid_type === '700') {
439
+ formData.sur_name_en = formData.sur_name
440
+ formData.first_name_en = formData.first_name
441
+ }
437
442
  this.setData({
438
443
  formData
439
444
  })
@@ -640,7 +645,9 @@ Page({
640
645
  nation,
641
646
  nation_name,
642
647
  sur_name,
648
+ sur_name_en: sur_name,
643
649
  first_name,
650
+ first_name_en: first_name,
644
651
  sex: sex ? sex : '',
645
652
  birthday,
646
653
  cid_expire_date,
@@ -683,39 +690,46 @@ Page({
683
690
  })
684
691
  },
685
692
 
693
+ // 显示自定义校验错误提示
694
+ showCuntomErrTip(msg) {
695
+ this.setData({
696
+ showCustomTips: true,
697
+ customTipsMsg: msg
698
+ }, () => {
699
+ // 3秒后关闭
700
+ setTimeout(() => {
701
+ this.setData({
702
+ showCustomTips: false,
703
+ customTipsMsg: ''
704
+ });
705
+ }, 3500);
706
+ })
707
+ },
708
+
686
709
  async handleFormSubmit(e) {
687
- // 自定义校验结果
688
710
  const formValid = e.detail.validStatus
689
- let customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
711
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
690
712
  if (!formValid || !customValid.valid) {
691
- // 如果自定义校验字段没问题,则跳过
692
- if (customValid.valid) {
693
- return
694
- }
695
713
  // 自定义校验字段有问题,获取表单错误列表
696
714
  const formErrList = e.detail.value
697
- // 计算是否单独弹出错误提示
698
- let showCustomTips = false
699
- if (formErrList && formErrList.length) {
700
- showCustomTips = !formErrList.some(i => ["id_card_number", "nation"].includes(i.name))
701
- } else {
702
- showCustomTips = true
715
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
716
+ if (!formValid && customValid.valid) {
717
+ this.showCuntomErrTip(formErrList[0].message)
718
+ return
703
719
  }
704
- // 如果需要弹出,则弹出
705
- if (showCustomTips) {
706
- this.setData({
707
- showCustomTips: true,
708
- customTipsMsg: customValid.msg
709
- }, () => {
710
- // 3秒后关闭
711
- setTimeout(() => {
712
- this.setData({
713
- showCustomTips: false,
714
- customTipsMsg: ''
715
- });
716
- }, 3500);
717
- })
720
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
721
+ if (formValid && !customValid.valid) {
722
+ this.showCuntomErrTip(customValid.msg)
723
+ return
724
+ }
725
+ // 如果两者都有问题,则判断显示谁
726
+ let lastMsg = ''
727
+ if (formErrList.some(i => ["id_card_number", "nation"].includes(i.name))) {
728
+ lastMsg = formErrList[0].message
729
+ } else {
730
+ lastMsg = customValid.msg
718
731
  }
732
+ this.showCuntomErrTip(lastMsg)
719
733
  return
720
734
  }
721
735
  wx.showLoading({
@@ -324,6 +324,7 @@
324
324
  id="form"
325
325
  model="{{ formData }}"
326
326
  rules="{{ rules }}"
327
+ showTips="{{ false }}"
327
328
  validateType="{{ validateType }}"
328
329
  primary-text="Submit"
329
330
  bind:submit="handleFormSubmit"
@@ -413,37 +413,46 @@ Page({
413
413
  })
414
414
  },
415
415
 
416
+ // 显示自定义校验错误提示
417
+ showCuntomErrTip(msg) {
418
+ this.setData({
419
+ showCustomTips: true,
420
+ customTipsMsg: msg
421
+ }, () => {
422
+ // 3秒后关闭
423
+ setTimeout(() => {
424
+ this.setData({
425
+ showCustomTips: false,
426
+ customTipsMsg: ''
427
+ });
428
+ }, 3500);
429
+ })
430
+ },
431
+
416
432
  async handleFormSubmit(e) {
417
- const vid1 = this.validateFullname()
418
- if (!e.detail.validStatus || !vid1.valid) {
419
- // 如果自定义校验字段没问题,则跳过
420
- if (vid1.valid) {
421
- return
422
- }
433
+ const formValid = e.detail.validStatus
434
+ const customValid = this.validateFullname()
435
+ if (!e.detail.validStatus || !customValid.valid) {
423
436
  // 自定义校验字段有问题,获取表单错误列表
424
437
  const formErrList = e.detail.value
425
- // 计算是否单独弹出错误提示
426
- let showCustomTips = false
427
- if (formErrList && formErrList.length) {
428
- showCustomTips = !formErrList.some(i => ["id_card_number", "nation"].includes(i.name))
429
- } else {
430
- showCustomTips = true
438
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
439
+ if (!formValid && customValid.valid) {
440
+ this.showCuntomErrTip(formErrList[0].message)
441
+ return
431
442
  }
432
- // 如果需要弹出,则弹出
433
- if (showCustomTips) {
434
- this.setData({
435
- showCustomTips: true,
436
- customTipsMsg: vid1.msg
437
- }, () => {
438
- // 3秒后关闭
439
- setTimeout(() => {
440
- this.setData({
441
- showCustomTips: false,
442
- customTipsMsg: ''
443
- });
444
- }, 3500);
445
- })
443
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
444
+ if (formValid && !customValid.valid) {
445
+ this.showCuntomErrTip(customValid.msg)
446
+ return
447
+ }
448
+ // 如果两者都有问题,则判断显示谁
449
+ let lastMsg = ''
450
+ if (formErrList.some(i => ["id_card_number", "nation"].includes(i.name))) {
451
+ lastMsg = formErrList[0].message
452
+ } else {
453
+ lastMsg = customValid.msg
446
454
  }
455
+ this.showCuntomErrTip(lastMsg)
447
456
  return
448
457
  }
449
458
  this.setData({
@@ -17,6 +17,7 @@
17
17
  id="form"
18
18
  model="{{ formData }}"
19
19
  rules="{{ rules }}"
20
+ showTips="{{ false }}"
20
21
  validateType="{{ validateType }}"
21
22
  primary-text="Submit"
22
23
  bind:submit="handleFormSubmit"