weapps-plugin-jingtong-verify 1.4.5 → 1.4.7

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 (222) hide show
  1. package/app.json +41 -33
  2. package/package.json +20 -20
  3. package/sdk.js +289 -289
  4. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
  5. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
  6. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
  7. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
  8. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.js +41 -0
  9. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.json +4 -0
  10. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxml +20 -0
  11. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxss +112 -0
  12. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
  13. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
  14. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
  15. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
  16. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
  17. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
  18. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
  19. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
  20. package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
  21. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
  22. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
  23. package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
  24. package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
  25. package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
  26. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
  27. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
  28. package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
  29. package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
  30. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
  31. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
  32. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
  33. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
  34. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
  35. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
  36. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
  37. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
  38. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
  39. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -47
  40. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
  41. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
  42. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
  43. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
  44. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
  45. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
  46. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
  47. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
  48. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
  49. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
  50. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
  51. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
  52. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
  53. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
  54. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
  55. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +182 -179
  56. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
  57. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
  58. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
  59. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
  60. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
  61. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
  62. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
  63. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
  64. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
  65. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
  66. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
  67. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
  68. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
  69. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
  70. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
  71. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +241 -236
  72. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
  73. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
  74. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
  75. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
  76. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
  77. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
  78. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
  79. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
  80. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
  81. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
  82. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
  83. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
  84. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
  85. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
  86. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
  87. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
  88. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
  89. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
  90. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
  91. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
  92. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
  93. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
  94. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
  95. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
  96. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
  97. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
  98. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
  99. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
  100. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
  101. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
  102. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
  103. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
  104. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +214 -206
  105. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
  106. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
  107. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
  108. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
  109. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
  110. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
  111. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
  112. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
  113. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
  114. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
  115. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
  116. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
  117. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
  118. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
  119. package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
  120. package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
  121. package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
  122. package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
  123. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
  124. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
  125. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
  126. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
  127. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +47 -39
  128. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
  129. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +11 -9
  130. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
  131. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.js +73 -0
  132. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.json +4 -0
  133. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxml +19 -0
  134. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxss +72 -0
  135. package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
  136. package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
  137. package/weapps-plugin-jingtong-verify/i18n/rules.js +374 -262
  138. package/weapps-plugin-jingtong-verify/images/bank-card-verify.png +0 -0
  139. package/weapps-plugin-jingtong-verify/images/chek_right.png +0 -0
  140. package/weapps-plugin-jingtong-verify/images/chevron-down.png +0 -0
  141. package/weapps-plugin-jingtong-verify/images/chevron-up.png +0 -0
  142. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.js +488 -0
  143. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.json +7 -0
  144. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxml +73 -0
  145. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxss +205 -0
  146. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.js +1218 -0
  147. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.json +10 -0
  148. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxml +254 -0
  149. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxss +389 -0
  150. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.js +66 -0
  151. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.wxml +2 -0
  152. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.js +461 -0
  153. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.json +8 -0
  154. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxml +67 -0
  155. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxss +231 -0
  156. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.js +477 -0
  157. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.json +12 -0
  158. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxml +120 -0
  159. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxss +217 -0
  160. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
  161. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
  162. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
  163. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
  164. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
  165. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
  166. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
  167. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
  168. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
  169. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
  170. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
  171. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
  172. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1687 -1548
  173. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
  174. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +516 -504
  175. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +185 -133
  176. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
  177. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
  178. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
  179. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
  180. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.js +147 -0
  181. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.json +4 -0
  182. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxml +48 -0
  183. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxss +166 -0
  184. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
  185. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
  186. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
  187. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
  188. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.js +156 -0
  189. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.json +4 -0
  190. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxml +19 -0
  191. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxss +69 -0
  192. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
  193. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
  194. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
  195. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
  196. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +110 -110
  197. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
  198. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
  199. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
  200. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +854 -854
  201. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
  202. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
  203. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
  204. package/weapps-plugin-jingtong-verify/pages/setting/setting.js +331 -328
  205. package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
  206. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
  207. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
  208. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
  209. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
  210. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
  211. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
  212. package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
  213. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
  214. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
  215. package/weapps-plugin-jingtong-verify/utils/constantVal.js +75 -0
  216. package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
  217. package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
  218. package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
  219. package/weapps-plugin-jingtong-verify/utils/request.js +604 -1
  220. package/weapps-plugin-jingtong-verify/utils/rules.js +387 -301
  221. package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
  222. package/weapps-plugin-jingtong-verify/utils/validate.js +894 -772
@@ -0,0 +1,1218 @@
1
+ const jingtongVerifyRequest = require('../../utils/request')
2
+ const constantVals = require('../../utils/constantVal')
3
+ const rulesConfig = require("../../utils/rules")
4
+ const utils = require("../../utils/index")
5
+ const MD5 = require("../../utils/md5")
6
+ const { flow } = require("@wecity/weda-plugin-utils");
7
+ import { SDKTrack, setAccountInfo } from '../../utils/QDTrackerNew/QDTrackerMain'
8
+ let cidType = '111'
9
+ let Nation = 'CHN'
10
+ Page({
11
+
12
+ /**
13
+ * 页面的初始数据
14
+ */
15
+ data: {
16
+ language: 'zh_CN', // 语言环境:默认中文
17
+ formData: {
18
+ cid_type: '111', // 证件类型
19
+ name: '', // 姓名
20
+ strCid: '', // 身份证号码(脱敏)
21
+ id_card_number: '', // 证件号码
22
+ verify_type: '101', // 身份证 固定值101
23
+ verify_expire_time: '', // 登录有效期
24
+ support_type: '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
25
+ },
26
+ showTipModal: false,
27
+ rules: rulesConfig.setNewPwdInfoRules('zh_CN'),
28
+ validateType: {
29
+ id_card_number(value) {
30
+ return utils.validate.checkCid(value, cidType, Nation).data
31
+ },
32
+ name(value) {
33
+ return utils.validate.checkName(value, cidType).data
34
+ },
35
+ },
36
+ formSafeData: {
37
+ cid_type: '111', // 证件类型
38
+ strCid: '', // 身份证号码(脱敏)
39
+ id_card_number: '', // 证件号码
40
+ phone_number: '', // 手机号
41
+ verification_code: '' //验证码
42
+ },
43
+ formSafeDataCodeMobile: '', // 根据证件号码获取的手机号尾号
44
+ formSafeDataCode: '', // 接口返回的验证码
45
+ getFormSafeDataCodeTime: '', // 调接口返回的验证码时间
46
+ formSafeDataCodeTimeOut: 60, // 接口返回的验证码过期时间(秒)默认1分钟
47
+ phoneNumberEndTitle: '', // 手机号尾号提示
48
+ safeRules: rulesConfig.safeVerificationInfoRules('zh_CN'),
49
+ validateSafeType: {
50
+ id_card_number(value) {
51
+ return utils.validate.checkCid(value, cidType, Nation).data
52
+ },
53
+ phone_number(value) {
54
+ return utils.validate.checkPhone(value).data
55
+ },
56
+ },
57
+ formPwdData: {
58
+ bank_card_password: '',
59
+ bank_card_pwd_password: ''
60
+ },
61
+ pwdRules: rulesConfig.bankCardSetPwdRules('zh_CN'),
62
+ validatePwdType: {
63
+ bank_card_password(value) {
64
+ return utils.validate.checkBankCardLoginPwd(value).data
65
+ },
66
+ bank_card_pwd_password(value, formPwdData) {
67
+ console.log(formPwdData)
68
+ console.log(formPwdData.bank_card_password)
69
+ return utils.validate.checkBankCardLoginPwd(value).data && utils.validate.checkConfirmPwd(value, formPwdData.bank_card_password).data
70
+ },
71
+ },
72
+ passwordStrength: 0, // 密码强度等级 0-3
73
+ passwordStrengthText: '弱',
74
+ currentStep: 0, // 当前步骤,从0开始
75
+ steps: [
76
+ { title: '信息确认' },
77
+ { title: '安全验证' },
78
+ { title: '重置密码' }
79
+ ],
80
+ // 是否显示自定义校验提示
81
+ showCustomTips: false,
82
+ // 自定义校验提示文本
83
+ customTipsMsg: '',
84
+ // 获取验证参数
85
+ verificationText: '发送验证码',
86
+ countdown: 0,
87
+ isCountingDown: false,
88
+ isSendSms: true, // 是否发送验证码
89
+ maxRetryCount: 3, // 最大重试次数
90
+ retryCount: 0, // 当前重试次数
91
+ // 收不到验证码提示框
92
+ showNotGetVerificationCodeTipModal: false,
93
+ // 人脸识别认证弹窗
94
+ showToOtherModal: false,
95
+ submitMode: '',
96
+ idCardType: {
97
+ '111': '1',// 大陆
98
+ '414': '2',// 护照
99
+ '516': '3',// 港澳台通行证
100
+ '511': '4',// 台胞证
101
+ '5': '5' // 其他未指定类型
102
+ },
103
+ showTipFaceModal: false,
104
+ set_type: 3, // 1:人脸认证,2:银行卡,3:短信
105
+ isIdCardSuccess: false, //第二步安全验证,验证身份证号是否当前本人的身份证号
106
+ },
107
+ /**
108
+ * 生命周期函数--监听页面加载
109
+ */
110
+ onLoad(options) {
111
+ const that = this
112
+ this.setData({
113
+ validatePwdType: {
114
+ // 单字段复杂度校验:仅依赖 value
115
+ bank_card_password(value) {
116
+ return utils.validate.checkBankCardLoginPwd(value).data
117
+ },
118
+ // 确认密码:通过闭包读取最新的整表单数据(尤其是主密码)
119
+ bank_card_pwd_password(value) {
120
+ console.log('检测')
121
+ console.log(that.data.formPwdData)
122
+ const mainPwd = (that.data && that.data.formPwdData && that.data.formPwdData.bank_card_password) || ''
123
+ return utils.validate.checkConfirmPwd(value, mainPwd).data
124
+ },
125
+ }
126
+ })
127
+ if(options.idCardNumber) {
128
+ let { formData, formSafeData } = this.data
129
+ formData.id_card_number = options.idCardNumber
130
+ formData.strCid = options.strCid
131
+ formData.name = options.name
132
+ formData.cid_type = options.cid_type
133
+ formData.verify_expire_time = options.verify_expire_time
134
+ formSafeData.cid_type = options.cid_type
135
+ this.setData({
136
+ formData: formData,
137
+ formSafeData: formSafeData
138
+ })
139
+ }
140
+ if(options.source_type){
141
+ if(options.isSuccess){
142
+ this.setData({
143
+ currentStep: 0,
144
+ set_type: 2
145
+ })
146
+ } else {
147
+ this.setData({
148
+ currentStep: 2,
149
+ set_type: 2
150
+ })
151
+ }
152
+ }
153
+ },
154
+ // 下一步
155
+ nextStep() {
156
+ if (this.data.currentStep < this.data.steps.length - 1) {
157
+ this.setData({
158
+ currentStep: this.data.currentStep + 1
159
+ });
160
+ if(this.data.currentStep == 1){
161
+ // this.getTailNumber()
162
+ }
163
+ }
164
+ },
165
+ /**
166
+ * 获取手机号尾号并设置证件号码
167
+ */
168
+ getTailNumber (e) {
169
+ const { formData, formSafeData } = this.data
170
+ let params = {
171
+ "cid_type": formData.cid_type, // 证件类型
172
+ "name": formData.name, // 姓名
173
+ "strCid": formData.strCid, // 身份证号码(脱敏)
174
+ "id_card_number": formSafeData.id_card_number, // 证件号码
175
+ "verify_type": '101', // 身份证 固定值101
176
+ "verify_expire_time": formData.verify_expire_time, // 登录有效期
177
+ "support_type": '0x40' // 4:姓名+证件号+有效起始及结束日期 0x40:姓名+证件号 0x42:姓名+证件号+人像
178
+ }
179
+ console.log('结果')
180
+ console.log(this.toOtherWay(params, 2, value))
181
+
182
+ let value = e.detail.value
183
+ this.toOtherWay(params, 2, value)
184
+ setTimeout(() => {
185
+ console.log(this.data.isIdCardSuccess)
186
+ // this.toGetTailNumber(value)
187
+ }, 100)
188
+ },
189
+ toGetTailNumber (value) {
190
+ const { isIdCardSuccess } = this.data
191
+ if(!isIdCardSuccess){
192
+ return
193
+ }
194
+ // let value = e.detail.value
195
+ // const { id_card_number, strCid } = this.data.formSafeData
196
+ // let { formSafeData } = this.data
197
+ // formSafeData.id_card_number = id_card_number
198
+ // formSafeData.strCid = strCid
199
+ // this.setData({
200
+ // formSafeData: formSafeData
201
+ // })
202
+ jingtongVerifyRequest.getTailNumber(value).then(res => {
203
+ console.log('获取手机号尾号')
204
+ console.log(res)
205
+ if(res.errcode !== 0){
206
+ this.setData({
207
+ formSafeDataCodeMobile: '',
208
+ phoneNumberEndTitle: ''
209
+ })
210
+ } else {
211
+ if(res.errcode === 0) {
212
+ if(res.data.phone !== ''){
213
+ this.setData({
214
+ formSafeDataCodeMobile: res.data.phone,
215
+ phoneNumberEndTitle: '(尾号' + res.data.phone + ')'
216
+ })
217
+ } else {
218
+ this.setData({
219
+ formSafeDataCodeMobile: '',
220
+ phoneNumberEndTitle: ''
221
+ })
222
+ }
223
+ } else {
224
+ wx.showToast({
225
+ title: data.errmsg,
226
+ icon: 'none',
227
+ duration: 2000
228
+ })
229
+ }
230
+ }
231
+ })
232
+ },
233
+ // 上一步(可选)
234
+ prevStep() {
235
+ if (this.data.currentStep > 0) {
236
+ this.setData({
237
+ currentStep: this.data.currentStep - 1
238
+ });
239
+ }
240
+ },
241
+
242
+ // 跳转到指定步骤(可选)
243
+ goToStep(stepIndex) {
244
+ this.setData({
245
+ currentStep: stepIndex
246
+ });
247
+ },
248
+
249
+ // 步骤点击事件(可选)
250
+ onStepTap(e) {
251
+ const { index } = e.detail;
252
+ console.log('点击了步骤:', index);
253
+ // 可以在这里添加跳转逻辑
254
+ },
255
+ /**
256
+ * 跳转到人脸识别
257
+ * @param {} e
258
+ */
259
+ async handleFormSubmit (e) {
260
+ const isOther = this.data.submitMode === 'other'
261
+ const formValid = e.detail.validStatus
262
+ if(isOther){
263
+ // 自定义英文名校验(与现有一致)
264
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
265
+
266
+ if (!formValid || !customValid.valid) {
267
+ // 与现有提示优先级一致
268
+ const formErrList = e.detail.value || []
269
+ if (!formValid && customValid.valid) {
270
+ } else if (formValid && !customValid.valid) {
271
+ } else {
272
+ const needPrior = formErrList.find(i => ["id_card_number", "nation"].includes(i.name))
273
+
274
+ }
275
+ this.setData({
276
+ submitMode: ''
277
+ })
278
+ return
279
+ }
280
+ // 通过后再跳“其他方式”业务(可按需补入参清洗,沿用 handleFormSubmit 的清洗逻辑)
281
+ this.toOtherWay(this.data.formData, 1)
282
+ return
283
+ }
284
+
285
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
286
+ if (!formValid || !customValid.valid) {
287
+ // 自定义校验字段有问题,获取表单错误列表
288
+ const formErrList = e.detail.value
289
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
290
+ if (!formValid && customValid.valid) {
291
+ return
292
+ }
293
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
294
+ if (formValid && !customValid.valid) {
295
+ return
296
+ }
297
+ return
298
+ }
299
+ // 去验证人脸
300
+ this.toFaceVerify()
301
+ },
302
+ /**
303
+ * 去验证人脸
304
+ */
305
+ async toFaceVerify() {
306
+ console.log('验证能否人脸识别')
307
+ // 缓存人脸识别失败数据
308
+ let faceFailCount = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_count)
309
+ let faceFailTime = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_time)
310
+ // 存在首次人脸识别失败时间
311
+ if(faceFailTime) {
312
+ // 判断人脸识别失败次数是否大于或等于3次,是的话,就要判断是否在10分钟不能人脸识别限制内
313
+ if(faceFailCount >= 3){
314
+ console.log(faceFailCount)
315
+ // 当前时间
316
+ const now = Date.now()
317
+
318
+ // 判断是否在10分钟内(1小时 = 3600 * 1000 毫秒)
319
+ const isWithinOneHour = (now - faceFailTime) < (10 * 60 * 1000)
320
+ console.log('当前仍在10分钟限制内')
321
+ console.log(isWithinOneHour)
322
+ if(isWithinOneHour) {
323
+ // 判断银行卡核验是否在锁定期内,在的话,不能跳转,提示改为直接提示
324
+ const bankCardFailTime = constantVals.getStorageWithExpire(constantVals.bank_card_verify_fail_time)
325
+ if(bankCardFailTime){
326
+ // 当前时间
327
+ const now = Date.now()
328
+
329
+ // 判断是否在10分钟内(1小时 = 3600 * 1000 毫秒)
330
+ const isWithinOneHour = (now - bankCardFailTime) < (10 * 60 * 1000)
331
+ if(isWithinOneHour){
332
+ console.log('当前仍在10分钟限制内')
333
+ }
334
+ this.setData({
335
+ showTipFaceModal: true
336
+ })
337
+ } else {
338
+ console.log('当前仍在10分钟限制内')
339
+ this.setData({
340
+ showToOtherModal: true
341
+ })
342
+ }
343
+ return
344
+ }
345
+ }
346
+ }
347
+ // 判断是否是PC端登录
348
+ await this.getDevice()
349
+ wx.showLoading({
350
+ title: '验证中',
351
+ })
352
+ const params = {
353
+ 'id_card_number': this.data.formData.id_card_number,
354
+ 'type': 1,
355
+ 'isCount': true
356
+ }
357
+ setTimeout(() => {
358
+ jingtongVerifyRequest.getVerifyLimit(params).then(res =>{
359
+ console.log('获取人脸识别失败次数结果')
360
+ console.log(res)
361
+ console.log(res.data)
362
+ console.log(res.data)
363
+ if(res.errcode === 4054 || res.data.times >= 3) {
364
+ // 人脸错误次数大于3次,提示
365
+ this.setData({
366
+ showToOtherModal: true
367
+ })
368
+ return
369
+ }
370
+ if (res.data.errcode === 0) {
371
+ jingtongVerifyRequest.verifyIdcard(this.data.formData).then(res => {
372
+ console.log('获取身份证二要素核验结果')
373
+ console.log(res)
374
+ if(res.errcode === 0){
375
+ // 可以进行人脸
376
+ this.faceVerifyIng()
377
+ } else {
378
+ wx.showToast({
379
+ title: res.errmsg,
380
+ icon: 'none',
381
+ duration: 2000
382
+ })
383
+ }
384
+ return
385
+ }).finally(() => {
386
+ wx.hideLoading()
387
+ })
388
+ } else {
389
+ wx.showToast({
390
+ title: res.errmsg,
391
+ icon: 'none',
392
+ duration: 2000
393
+ })
394
+ return
395
+ }
396
+ }).finally(() => {
397
+ wx.hideLoading()
398
+ })
399
+ }, 1000)
400
+ },
401
+ async faceVerifyIng() {
402
+ const { formData } = this.data
403
+ const params = {
404
+ "id_card_number": formData.id_card_number,
405
+ "name": formData.name,
406
+ "cid_type": formData.cid_type,
407
+ "verify_expire_time": formData.verify_expire_time,
408
+ "isbind": 1
409
+ }
410
+ const [err, session] = await utils.awaitTo(
411
+ jingtongVerifyRequest.setNewPwdToFaceVerifyWithIdCard(params))
412
+ console.log('设置新登录密码人脸认证')
413
+ console.log(err)
414
+ console.log(session)
415
+
416
+ if (err) {
417
+ const { errmsg, errMsg, errCode } = JSON.parse(err)
418
+ // 缓存人脸识别失败数据
419
+ let faceFailCount = constantVals.getStorageWithExpire(constantVals.bank_card_forgot_face_fail_count)
420
+ if(faceFailCount >= 3) {
421
+ faceFailCount = 0
422
+ }
423
+ faceFailCount = faceFailCount + 1
424
+ constantVals.setStorageWithExpire(constantVals.bank_card_forgot_face_fail_count, faceFailCount)
425
+ if(faceFailCount === 1){
426
+ constantVals.setStorageWithExpire(constantVals.bank_card_forgot_face_fail_time, Date.now(), 10 * 60)
427
+ }
428
+ // 此处应要有埋点上报
429
+ wx.showToast({
430
+ title: errMsg,
431
+ icon: 'none',
432
+ duration: 3000
433
+ })
434
+ if (errCode) {
435
+ let errCodeArr = [10002, 10003, 10004, 10005, 10012, 10057, 90002, 90003, 90004, 90005, 90006, 90100, 90023, 90024, 90025]
436
+ if (errCodeArr.indexOf(errCode) >= 0) {
437
+ console.log('在指定的错误码范围内,人脸失败次数+1')
438
+ // 设置人脸失败次数
439
+ // await this.fetchFaceFailCount(true, errCode)
440
+ }
441
+ // 人脸识别异常温馨提示弹窗
442
+ // this.handleFaceError(errCode)
443
+ }
444
+ } else {
445
+ // 此处需要埋点处理
446
+
447
+ console.log('认证成功返回页面数据:', session)
448
+ // 人脸识别成功清空失败缓存数据
449
+ constantVals.removeStorage(constantVals.bank_card_forgot_face_fail_count)
450
+ constantVals.removeStorage(constantVals.bank_card_forgot_face_fail_time)
451
+ // 保存刷脸成功时间戳
452
+ let timeStamp = new Date().getTime()
453
+ wx.setStorageSync('tif.faceTimeStamp', timeStamp)
454
+ this.setData({
455
+ currentStep: 2,
456
+ set_type: 1
457
+ });
458
+ }
459
+ },
460
+ // 判断是否是PC端登录
461
+ getDevice() {
462
+ return new Promise((resolve, reject) => {
463
+ const systemInfo = wx.getDeviceInfo();
464
+ console.log('systemInfo', systemInfo)
465
+ if (['windows', 'mac'].includes(systemInfo.platform)) {
466
+ console.log('当前为电脑端微信');
467
+ wx.showToast({
468
+ title: '请您使用移动端京通小程序',
469
+ icon: 'none',
470
+ duration: 3000
471
+ })
472
+ return
473
+ } else {
474
+ console.log('当前为手机端');
475
+ resolve()
476
+ }
477
+ })
478
+ },
479
+ // 输入框去空
480
+ handleChange(e) {
481
+ let value = e.detail.value
482
+ let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
483
+
484
+ // 删除前后空格
485
+ if (typeof value === 'string' && formId !== 'cid_type') {
486
+ value = value.trim()
487
+ }
488
+ if (formId) {
489
+ this.setData({ [`formData.${formId}`]: value })
490
+ }
491
+ },
492
+ showQuestionTip() {
493
+ this.setData({
494
+ showTipModal: true
495
+ })
496
+ },
497
+ handleModalOk () {
498
+ this.setData({
499
+ showNotGetVerificationCodeTipModal: false,
500
+ showTipModal: false
501
+ })
502
+ },
503
+ // 输入框去空
504
+ handleSafeChange(e) {
505
+ let value = e.detail.value
506
+ let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
507
+
508
+ // 删除前后空格
509
+ if (typeof value === 'string' && formId !== 'cid_type') {
510
+ value = value.trim()
511
+ }
512
+ if (formId) {
513
+ this.setData({ [`formSafeData.${formId}`]: value })
514
+ }
515
+ },
516
+ // 设置密码输入框变化处理
517
+ handlePwdChange(e) {
518
+ let value = e.detail.value
519
+ let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
520
+
521
+ if (typeof value === 'string' && formId !== 'cid_type') {
522
+ value = value.trim()
523
+ }
524
+
525
+ if (formId) {
526
+ this.setData({ [`formPwdData.${formId}`]: value })
527
+ }
528
+ },
529
+ handlePwdStrongChange(e) {
530
+ let value = e.detail.value
531
+ let formId = (e && e.currentTarget && e.currentTarget.id) || (e && e.target && e.target.id) || ''
532
+ if (typeof value === 'string' && formId !== 'cid_type') {
533
+ value = value.trim()
534
+ }
535
+ // 如果是密码字段,计算强度
536
+ if (formId === 'bank_card_password') {
537
+ this.calculatePasswordStrength(value)
538
+ }
539
+ },
540
+ // 计算密码强度
541
+ calculatePasswordStrength(password) {
542
+ let strength = 0
543
+ let strengthText = '弱'
544
+
545
+ if (!password) {
546
+ this.setData({
547
+ passwordStrength: 0,
548
+ passwordStrengthText: '弱'
549
+ })
550
+ return
551
+ }
552
+
553
+ // 长度检查
554
+ if (password.length >= 8) {
555
+ strength++
556
+ }
557
+
558
+ // 包含数字
559
+ if (/\d/.test(password)) {
560
+ strength++
561
+ }
562
+
563
+ // 包含字母
564
+ if (/[a-zA-Z]/.test(password)) {
565
+ strength++
566
+ }
567
+
568
+ // 包含特殊字符
569
+ if (/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
570
+ strength++
571
+ }
572
+
573
+ // 根据强度设置文本
574
+ if (strength >= 4) {
575
+ strengthText = '强'
576
+ } else if (strength >= 2) {
577
+ strengthText = '中'
578
+ } else {
579
+ strengthText = '弱'
580
+ }
581
+ // 此处判断密码强度
582
+ jingtongVerifyRequest.verifyPwdStrength(password).then(res => {
583
+ console.log(res)
584
+ const { errcode, data } = res
585
+ if(errcode === 0){
586
+ console.log(strength)
587
+ // 根据强度设置文本
588
+ if (data.score >= 90) {
589
+ strength = 3
590
+ strengthText = '强'
591
+ } else if (data.score >= 75) {
592
+ strength = 3
593
+ strengthText = '强'
594
+ } else if (data.score >= 65) {
595
+ strength = 2
596
+ strengthText = '中'
597
+ } else if (data.score >= 50) {
598
+ strength = 2
599
+ strengthText = '中'
600
+ } else {
601
+ strength = 1
602
+ strengthText = '弱'
603
+ }
604
+
605
+ this.setData({
606
+ passwordStrength: Math.min(strength, 3), // 最多显示3个等级
607
+ passwordStrengthText: strengthText
608
+ })
609
+ }
610
+ })
611
+ },
612
+ // 其他方式
613
+ handletoOther () {
614
+ console.log('启用sms验证')
615
+ // 方案B
616
+ this.data.submitMode = 'other' // 设置来源标记
617
+ const form = this.selectComponent('#form')
618
+ if (form && typeof form.handleSubmit === 'function') {
619
+ // 触发表单的内置校验流程,结果会回调到 handleFormSubmit
620
+ form.handleSubmit()
621
+ } else {
622
+ wx.showToast({ title: '表单未就绪,请稍后再试', icon: 'none' })
623
+ }
624
+ // this.nextStep()
625
+ // wx.navigateTo({
626
+ // url: '/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting',
627
+ // })
628
+ },
629
+ /**
630
+ * 其他方式实际处理
631
+ */
632
+ toOtherWay(params, type, value) {
633
+ wx.showLoading({
634
+ title: '验证中',
635
+ })
636
+ setTimeout(() => {
637
+ jingtongVerifyRequest.verifyIdcard(params).then(res =>{
638
+ console.log('点击其他方式-获取身份证二要素核验结果')
639
+ console.log(res)
640
+ const { errcode }= res
641
+ if(errcode === 0){
642
+ wx.hideLoading()
643
+ if(type === 1) {
644
+ this.setData({
645
+ set_type: 3
646
+ })
647
+ this.nextStep()
648
+ } else {
649
+ this.setData({
650
+ isIdCardSuccess: true
651
+ })
652
+ this.toGetTailNumber(value)
653
+ }
654
+ } else {
655
+ wx.hideLoading()
656
+ wx.showToast({
657
+ title: res.errmsg,
658
+ icon: 'none',
659
+ duration: 2000
660
+ })
661
+ this.setData({
662
+ isIdCardSuccess: false
663
+ })
664
+ }
665
+ }).finally(() => {
666
+ wx.hideLoading()
667
+ })
668
+ }, 1500)
669
+ },
670
+ /**
671
+ * 发送验证码
672
+ */
673
+ sendVerificationCode () {
674
+ if(!this.data.isIdCardSuccess){
675
+ wx.showToast({
676
+ title: '身份证号码验证没有通过,请重新验证',
677
+ icon: 'none'
678
+ });
679
+ return;
680
+ }
681
+ if (this.data.isCountingDown) {
682
+ return;
683
+ }
684
+
685
+ // 检查重试次数
686
+ if (this.data.retryCount >= this.data.maxRetryCount) {
687
+ wx.showToast({
688
+ title: '今日发送次数已达上限',
689
+ icon: 'none'
690
+ });
691
+ return;
692
+ }
693
+ console.log(this.data.formSafeData)
694
+ console.log(this.data.formSafeData.phone_number)
695
+ const { phone_number } = this.data.formSafeData
696
+ // 验证手机号格式
697
+ if (!this.validatePhone(phone_number)) {
698
+ wx.showToast({
699
+ title: '请输入正确的手机号',
700
+ icon: 'none'
701
+ });
702
+ return;
703
+ }
704
+ const { formSafeDataCodeMobile } = this.data
705
+ if(formSafeDataCodeMobile === ''){
706
+ wx.showToast({
707
+ title: '手机号码与绑定手机号码不一致,请检查后输入',
708
+ icon: 'none',
709
+ duration: 2000
710
+ });
711
+ return;
712
+ }
713
+ this.sendSmsCode(phone_number);
714
+ },
715
+ // 验证手机号
716
+ validatePhone(phone) {
717
+ console.log(phone)
718
+ const phoneReg = /^1[3-9]\d{9}$/;
719
+ return phoneReg.test(phone);
720
+ },
721
+ // 实际-发送短信验证码
722
+ sendSmsCode(phoneNumber) {
723
+ wx.showLoading({
724
+ title: '发送中...'
725
+ });
726
+ // 模拟发送请求
727
+ setTimeout(() => {
728
+ wx.hideLoading();
729
+ // 调接口获取短信验证码
730
+ jingtongVerifyRequest.sendSmsCode(phoneNumber).then(res => {
731
+ console.log(res.data)
732
+ const { data } = res
733
+ if(data.errcode === 0){
734
+ wx.showToast({
735
+ title: '验证码已发送',
736
+ icon: 'success'
737
+ });
738
+ this.startCountdown();
739
+ this.setData({
740
+ isSendSms: true,
741
+ retryCount: this.data.retryCount + 1,
742
+ formSafeDataCode: data.data.code,
743
+ getFormSafeDataCodeTime: Date.now()
744
+ });
745
+ } else {
746
+ wx.showToast({
747
+ title: '发送失败,请重试',
748
+ icon: 'none'
749
+ });
750
+ }
751
+ })
752
+
753
+ // 模拟成功响应
754
+ // const isSuccess = Math.random() > 0.9; // 80% 成功率
755
+ // if (isSuccess) {
756
+ // wx.showToast({
757
+ // title: '验证码已发送',
758
+ // icon: 'success'
759
+ // });
760
+ // this.startCountdown();
761
+ // this.setData({
762
+ // retryCount: this.data.retryCount + 1
763
+ // });
764
+ // } else {
765
+ // wx.showToast({
766
+ // title: '发送失败,请重试',
767
+ // icon: 'none'
768
+ // });
769
+ // }
770
+ }, 1500);
771
+ },
772
+ // 开始倒计时
773
+ startCountdown() {
774
+ this.setData({
775
+ countdown: 60,
776
+ isCountingDown: true,
777
+ verificationText: '已发送(60s)'
778
+ });
779
+
780
+ this.countdownTimer = setInterval(() => {
781
+ const newCountdown = this.data.countdown - 1;
782
+
783
+ if (newCountdown <= 0) {
784
+ this.setData({
785
+ countdown: 0,
786
+ isCountingDown: false,
787
+ verificationText: '重新发送'
788
+ });
789
+ clearInterval(this.countdownTimer);
790
+ this.countdownTimer = null;
791
+ } else {
792
+ this.setData({
793
+ countdown: newCountdown,
794
+ verificationText: `已发送(${newCountdown}s)`
795
+ });
796
+ }
797
+ }, 1000);
798
+ },
799
+ /**
800
+ * 打开收不到验证码提示框
801
+ */
802
+ handleNotVerificationTipModal () {
803
+ this.setData({
804
+ showNotGetVerificationCodeTipModal: true
805
+ })
806
+ },
807
+ /**
808
+ * 关闭收不到验证码提示框
809
+ */
810
+ handleNotGetVerificationCodeTipModalCancel() {
811
+ this.setData({
812
+ showNotGetVerificationCodeTipModal: false
813
+ })
814
+ },
815
+ /**
816
+ * 验证身份证号,手机号,短信验证码
817
+ */
818
+ async handleSafeFormSubmit (e) {
819
+ console.log('进行身份证号码、手机号,短信验证码信息验证')
820
+ const formValid = e.detail.validStatus
821
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
822
+ if (!formValid || !customValid.valid) {
823
+ // 自定义校验字段有问题,获取表单错误列表
824
+ const formErrList = e.detail.value
825
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
826
+ if (!formValid && customValid.valid) {
827
+ return
828
+ }
829
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
830
+ if (formValid && !customValid.valid) {
831
+ return
832
+ }
833
+ return
834
+ }
835
+ console.log('md加密验证码')
836
+ console.log(MD5(this.data.formSafeData.verification_code).toString())
837
+ // 判断手机尾号是否一致
838
+ const { formSafeData,formSafeDataCodeMobile } = this.data
839
+ let { phone_number } = formSafeData
840
+ const phoneEndNumber = phone_number.slice(-4)
841
+ if(phoneEndNumber !== formSafeDataCodeMobile) {
842
+ wx.showToast({
843
+ title: '手机号码与绑定号码不一致,请重新输入',
844
+ icon: 'none',
845
+ duration: 2000
846
+ })
847
+ return
848
+ }
849
+ // 判断是否发送验证码以及验证码是否过期
850
+ const { isSendSms } = this.data
851
+ if(!isSendSms) {
852
+ wx.showToast({
853
+ title: '没检验验证码,请发送验证码',
854
+ icon: 'none',
855
+ duration: 2000
856
+ })
857
+ return
858
+ }
859
+ let nowDateTime = Date.now()
860
+ const { getFormSafeDataCodeTime, formSafeDataCodeTimeOut, formSafeDataCode } = this.data
861
+ const secondDiff = Math.floor((nowDateTime - getFormSafeDataCodeTime) / 1000);
862
+ if (secondDiff > formSafeDataCodeTimeOut) {
863
+ wx.showToast({
864
+ title: '短信验证码已过期,请重新获取',
865
+ icon: 'none',
866
+ duration: 2000
867
+ })
868
+ return
869
+ }
870
+ const ms5Code = MD5(this.data.formSafeData.verification_code).toString()
871
+ if ( formSafeDataCode !== ms5Code) {
872
+ wx.showToast({
873
+ title: '验证码不一致,请重新输入',
874
+ icon: 'none',
875
+ duration: 2000
876
+ })
877
+ return
878
+ }
879
+ this.nextStep()
880
+ },
881
+ /**
882
+ * 确认设置密码
883
+ */
884
+ async handlePwdFormSubmit (e) {
885
+ console.log('进行确认设置密码')
886
+ const formValid = e.detail.validStatus
887
+ const customValid = this.data.language !== 'en' ? { valid: true, msg: '' } : this.validateFullname()
888
+ if (!formValid || !customValid.valid) {
889
+ // 自定义校验字段有问题,获取表单错误列表
890
+ const formErrList = e.detail.value
891
+ // 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
892
+ if (!formValid && customValid.valid) {
893
+ return
894
+ }
895
+ // 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
896
+ if (formValid && !customValid.valid) {
897
+ return
898
+ }
899
+ return
900
+ }
901
+ // 点击确定出现该提示
902
+ wx.showLoading({
903
+ title: '验证中',
904
+ mask: true // 防止用户点击
905
+ })
906
+ console.log(this.data.formSafeData)
907
+ console.log(this.data.formPwdData)
908
+ const { formData, formSafeData, formPwdData, idCardType, formSafeDataCode, set_type } = this.data
909
+ let setType = set_type === 3 ? formSafeData.cid_type : formData.cid_type
910
+ let params = {
911
+ "password": formPwdData.bank_card_password,
912
+ "id_card_number": set_type === 3 ? formSafeData.id_card_number : formData.id_card_number,
913
+ "id_type": idCardType[setType],
914
+ "code": set_type === 3 ? formSafeData.verification_code : '',
915
+ "mobile": set_type === 3 ? formSafeData.phone_number : ''
916
+ }
917
+ setTimeout(() => {
918
+ jingtongVerifyRequest.modifyPassword(params).then(res => {
919
+ console.log('设置新密码')
920
+ wx.hideLoading()
921
+ if(res.errcode === 0) {
922
+ const { success } = res.data
923
+ if(success) {
924
+ // 应进行账密登录,就是走密码登录,登录成功直接跳转回/pages/index/index
925
+ this.toLoginByPwd()
926
+ // wx.reLaunch({
927
+ // url: '/pages/index/index',
928
+ // })
929
+ }
930
+ } else {
931
+ wx.showToast({
932
+ title: res.errmsg,
933
+ icon: 'none',
934
+ duration: 2000
935
+ })
936
+ }
937
+ }).finally(() => {
938
+ wx.hideLoading()
939
+ })
940
+ }, 1500)
941
+ },
942
+ async toLoginByPwd() {
943
+ const { formData, formPwdData, idCardType } = this.data
944
+ const params = {
945
+ "password": formPwdData.bank_card_password,
946
+ "id_card_number": formData.id_card_number,
947
+ "id_type": idCardType[formData.cid_type],
948
+ "cid_type": formData.cid_type,
949
+ "login_verify_type": 1,
950
+ "verify_expire_time": formData.verify_expire_time,
951
+ "nation": Nation,
952
+ "isbind": 1,
953
+ "certName": formData.name
954
+ }
955
+ const [err, session ] = await utils.awaitTo (jingtongVerifyRequest.pwdLogin(params))
956
+ if(err){
957
+ console.log('忘记密码-重新设置密码-账号密码登录失败')
958
+ console.log(err)
959
+ } else {
960
+ console.log('忘记密码-重新设置密码-账号密码登录成功')
961
+ console.log(session)
962
+ // 保存银行卡核验成功时间戳
963
+ let timeStamp = new Date().getTime()
964
+ wx.setStorageSync('tif.bankCardTimeStamp', timeStamp)
965
+ this.authSuccess(session)
966
+ }
967
+ },
968
+ // 跳转去银行卡验证设置密码
969
+ handleToBankCard() {
970
+ console.log('====跳转去银行卡验证设置密码====')
971
+ // 跳转去银行卡验证设置密码
972
+ this.setData({
973
+ showToOtherModal: false
974
+ }, () => {
975
+ setTimeout(() => {
976
+ wx.navigateTo({
977
+ url: '/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify?id_card_number='+ this.data.formData.id_card_number
978
+ + '&cid_type=' + this.data.formData.cid_type
979
+ + '&name=' + this.data.formData.name
980
+ + '&verify_expire_time=' + this.data.formData.verify_expire_time
981
+ + '&source_type=2',
982
+ })
983
+ }, 100)
984
+ })
985
+ },
986
+ // 关闭提示框
987
+ handleToCancel () {
988
+ this.setData({
989
+ showToOtherModal: false
990
+ })
991
+ },
992
+ openEye(e) {
993
+ console.log(e)
994
+ const isOpen = e.detail.isOpen
995
+ const key = e.currentTarget.id
996
+ const strKey = e.currentTarget.dataset.star
997
+ console.log('isOpen', isOpen)
998
+ console.log('key', key)
999
+ console.log('strKey', strKey)
1000
+ if (isOpen) {
1001
+ console.log('显示脱敏')
1002
+ const { id_card_number } = this.data.formData
1003
+ const value = utils.hideIdCard(id_card_number, '111')
1004
+ console.log('value', value)
1005
+ this.setData({
1006
+ [`formData.${strKey}`]: value
1007
+ })
1008
+ } else {
1009
+ console.log('删除脱敏,显示明文')
1010
+ this.setData({
1011
+ [`formData.${strKey}`]: ''
1012
+ })
1013
+ }
1014
+ },
1015
+ handleFaceModalOk () {
1016
+ this.setData({
1017
+ showNotGetVerificationCodeTipModal: false,
1018
+ showTipModal: false,
1019
+ showTipFaceModal: false
1020
+ })
1021
+ },
1022
+ // 认证成功后续操作
1023
+ async authSuccess(session, isEn = false) {
1024
+ console.log('====判断是否真的登录成功=====')
1025
+ console.log(session)
1026
+ if (!session) {
1027
+ wx.showToast({
1028
+ title: '登录态失效,请重试',
1029
+ icon: 'none',
1030
+ duration: 2000
1031
+ })
1032
+ return
1033
+ }
1034
+ const { face_time, realname_time, cid, has_phone, certType } = session
1035
+ if ((!face_time && !realname_time) || !cid) {
1036
+ wx.showToast({
1037
+ title: `登录态失效请重试: ${this.data.formData.cid_type}`,
1038
+ icon: 'none',
1039
+ duration: 2000
1040
+ })
1041
+ return
1042
+ }
1043
+
1044
+ wx.showToast({
1045
+ title: isEn ? 'Verification successful, redirecting...': '验证成功, 跳转中…',
1046
+ icon: 'none',
1047
+ duration: 5000,
1048
+ mask: true
1049
+ })
1050
+
1051
+ const cidType = session.cid_type
1052
+
1053
+ // 本地存储表单核验成功数据
1054
+ wx.setStorageSync('tif.formDataSuccess', session)
1055
+
1056
+ // 将弹窗标识设置为不需要弹窗
1057
+ jingtongVerifyRequest.setUserReadStatus(false).then(() => {
1058
+ console.log('设置弹窗标识成功')
1059
+ }).catch(err => {
1060
+ console.log('设置弹窗标识失败', err)
1061
+ })
1062
+
1063
+ setTimeout(() => {
1064
+ if (this.data.needUnite === "true") {
1065
+ // this.setData({
1066
+ // needUnite: ''
1067
+ // })
1068
+
1069
+ console.log('进入业务总入口, 判断是否有手机号码', has_phone)
1070
+
1071
+ // 登录成功回调 => 业务侧操作事项
1072
+ wx.$_ServiceConfiguration && wx.$_ServiceConfiguration.methods && wx.$_ServiceConfiguration.methods._loginSuccessCallBack && wx.$_ServiceConfiguration.methods._loginSuccessCallBack(session)
1073
+
1074
+ if (has_phone) {
1075
+ const realPhone = wx.getStorageSync('tif.realPhone') || ''
1076
+ const caPhone = wx.getStorageSync('tif.caPhone') || ''
1077
+ const confirmTime = wx.getStorageSync('tif.tel_confirm_time') || ''
1078
+
1079
+ console.log('realPhone', realPhone)
1080
+ console.log('caPhone', caPhone)
1081
+ console.log('confirmTime', confirmTime)
1082
+
1083
+ if (realPhone !== caPhone && confirmTime && (!utils.completeDate(new Date(Number(confirmTime + '000')), 6))) {
1084
+ // 埋点上报事件:自然人登录
1085
+ this.loginTracker(1, cidType)
1086
+
1087
+ this.setData({
1088
+ hadSuccessLogin: true
1089
+ })
1090
+
1091
+ // 【phone与caPhone不同】且【tel_confirm_time大于6个月】
1092
+ // 数据库手机号码有效期大于6个月
1093
+ flow.redirectTo({
1094
+ url: '../confirm-phone/confirm-phone'
1095
+ })
1096
+ } else {
1097
+ jingtongVerifyRequest.personToken({
1098
+ source: '11'
1099
+ }).then(async data => {
1100
+ // 设置用户账号信息
1101
+ setAccountInfo(session.openid)
1102
+
1103
+ // 埋点上报事件:自然人登录
1104
+ this.loginTracker(1, cidType)
1105
+
1106
+ this.setData({
1107
+ hadSuccessLogin: true
1108
+ })
1109
+
1110
+ // 埋点 - 个人用户实体全属性上报
1111
+ let last_login_time = utils.getCurrentTime()
1112
+ wx.setStorageSync('tif.lastLoginTime', last_login_time)
1113
+ const userEntityReportData = Object.assign(session, {
1114
+ user_status: '1',
1115
+ last_login_time,
1116
+ user_date_of_birth: session.cid_type === '111' ? utils.getBirthByIDCard(session.cid) : ''
1117
+ })
1118
+ await utils.awaitTo(jingtongVerifyRequest.userEntityReport(userEntityReportData))
1119
+
1120
+ setTimeout(() => {
1121
+ flow.resolve({
1122
+ token: data
1123
+ })
1124
+ wx.reLaunch({
1125
+ url: '/pages/index/index' // 主包页面路径
1126
+ })
1127
+ }, 1200)
1128
+ })
1129
+ }
1130
+ } else {
1131
+ // 埋点上报事件:自然人登录
1132
+ this.loginTracker(1, cidType)
1133
+
1134
+ this.setData({
1135
+ hadSuccessLogin: true
1136
+ })
1137
+
1138
+ flow.redirectTo({
1139
+ url: '../bind-phone/bind-phone?source=3'
1140
+ })
1141
+ }
1142
+ } else {
1143
+ console.log('返回主包')
1144
+ flow.resolve()
1145
+ wx.reLaunch({
1146
+ url: '/pages/index/index' // 主包页面路径
1147
+ })
1148
+ }
1149
+ }, 800)
1150
+ },
1151
+ // 埋点上报事件:自然人登录
1152
+ loginTracker(login_status = 1, cidType) {
1153
+ SDKTrack('nature_person_login', {
1154
+ // 1 登录成功;2 登录失败-身份信息核验失败;3 登录失败-人脸核验失败
1155
+ // 4 登录失败-电子营业执照核验失败;5 登录失败-账号密码输入错误
1156
+ // 6 取消登录(包含点击温馨提示的“取消”,点击请法人登录的×,在登录页面点击左上角返回按钮退出登录)
1157
+ // 7 退出小程序终止登录;old_1 历史数据:除登录成功之外的所有情况
1158
+ login_status,
1159
+ login_certificate: this.data.certTypeMap[cidType] || 1, // 证件类型
1160
+ invoke_location: '', // 调起位置
1161
+ login_validity_period: this.data.formData.verify_expire_time / 24 || '' // 免登录时间
1162
+ })
1163
+ },
1164
+ /**
1165
+ * 生命周期函数--监听页面初次渲染完成
1166
+ */
1167
+ onReady() {
1168
+
1169
+ },
1170
+
1171
+ /**
1172
+ * 生命周期函数--监听页面显示
1173
+ */
1174
+ onShow() {
1175
+
1176
+ },
1177
+
1178
+ /**
1179
+ * 生命周期函数--监听页面隐藏
1180
+ */
1181
+ onHide() {
1182
+ this.clearTimer();
1183
+ },
1184
+
1185
+ /**
1186
+ * 生命周期函数--监听页面卸载
1187
+ */
1188
+ onUnload() {
1189
+ this.clearTimer();
1190
+ },
1191
+ // 清理定时器
1192
+ clearTimer() {
1193
+ if (this.countdownTimer) {
1194
+ clearInterval(this.countdownTimer);
1195
+ this.countdownTimer = null;
1196
+ }
1197
+ },
1198
+ /**
1199
+ * 页面相关事件处理函数--监听用户下拉动作
1200
+ */
1201
+ onPullDownRefresh() {
1202
+
1203
+ },
1204
+
1205
+ /**
1206
+ * 页面上拉触底事件的处理函数
1207
+ */
1208
+ onReachBottom() {
1209
+
1210
+ },
1211
+
1212
+ /**
1213
+ * 用户点击右上角分享
1214
+ */
1215
+ onShareAppMessage() {
1216
+
1217
+ }
1218
+ })