weapps-plugin-jingtong-verify 1.6.0 → 1.6.2-beta

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 (224) hide show
  1. package/README.md +1 -1
  2. package/app.json +33 -41
  3. package/package.json +21 -21
  4. package/sdk.js +309 -320
  5. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
  6. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
  7. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
  8. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
  9. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
  10. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
  11. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
  12. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
  13. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
  14. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
  15. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
  16. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
  17. package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
  18. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
  19. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
  20. package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
  21. package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
  22. package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
  23. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
  24. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
  25. package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
  26. package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
  27. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
  28. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
  29. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
  30. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
  31. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
  32. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
  33. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
  34. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
  35. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
  36. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -47
  37. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
  38. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
  39. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
  40. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
  41. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
  42. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
  43. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
  44. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
  45. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
  46. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
  47. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
  48. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
  49. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
  50. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
  51. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
  52. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -182
  53. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
  54. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
  55. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
  56. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
  57. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
  58. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
  59. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
  60. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
  61. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
  62. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
  63. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
  64. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
  65. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
  66. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
  67. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
  68. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +236 -241
  69. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
  70. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
  71. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
  72. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
  73. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
  74. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
  75. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
  76. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
  77. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
  78. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
  79. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
  80. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
  81. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
  82. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
  83. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
  84. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
  85. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
  86. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
  87. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
  88. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
  89. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
  90. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
  91. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
  92. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
  93. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
  94. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
  95. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
  96. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
  97. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
  98. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
  99. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
  100. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
  101. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -214
  102. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
  103. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
  104. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
  105. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
  106. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
  107. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
  108. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
  109. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
  110. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
  111. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
  112. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
  113. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
  114. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
  115. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
  116. package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
  117. package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
  118. package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
  119. package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
  120. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
  121. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
  122. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
  123. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
  124. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -47
  125. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
  126. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -11
  127. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
  128. package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
  129. package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
  130. package/weapps-plugin-jingtong-verify/i18n/rules.js +262 -403
  131. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
  132. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
  133. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
  134. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
  135. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
  136. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
  137. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
  138. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
  139. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
  140. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
  141. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
  142. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
  143. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1558 -1812
  144. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
  145. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +504 -522
  146. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -185
  147. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
  148. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
  149. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
  150. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
  151. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
  152. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
  153. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
  154. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
  155. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
  156. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
  157. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
  158. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
  159. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +120 -110
  160. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
  161. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
  162. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
  163. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +864 -854
  164. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
  165. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
  166. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
  167. package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -331
  168. package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
  169. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
  170. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
  171. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
  172. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
  173. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
  174. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
  175. package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
  176. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
  177. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
  178. package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
  179. package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
  180. package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
  181. package/weapps-plugin-jingtong-verify/utils/request.js +1 -670
  182. package/weapps-plugin-jingtong-verify/utils/rules.js +301 -405
  183. package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
  184. package/weapps-plugin-jingtong-verify/utils/validate.js +772 -910
  185. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.js +0 -41
  186. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.json +0 -4
  187. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxml +0 -20
  188. package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxss +0 -112
  189. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.js +0 -73
  190. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.json +0 -4
  191. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxml +0 -19
  192. package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxss +0 -72
  193. package/weapps-plugin-jingtong-verify/images/bank-card-verify.png +0 -0
  194. package/weapps-plugin-jingtong-verify/images/chek_right.png +0 -0
  195. package/weapps-plugin-jingtong-verify/images/chevron-down.png +0 -0
  196. package/weapps-plugin-jingtong-verify/images/chevron-up.png +0 -0
  197. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.js +0 -506
  198. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.json +0 -8
  199. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxml +0 -79
  200. package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxss +0 -212
  201. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.js +0 -1392
  202. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.json +0 -10
  203. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxml +0 -247
  204. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxss +0 -397
  205. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.js +0 -66
  206. package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.wxml +0 -2
  207. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.js +0 -463
  208. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.json +0 -8
  209. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxml +0 -69
  210. package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxss +0 -232
  211. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.js +0 -984
  212. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.json +0 -12
  213. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxml +0 -157
  214. package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxss +0 -258
  215. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.js +0 -147
  216. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.json +0 -4
  217. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxml +0 -48
  218. package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxss +0 -166
  219. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.js +0 -189
  220. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.json +0 -4
  221. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxml +0 -19
  222. package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxss +0 -69
  223. package/weapps-plugin-jingtong-verify/utils/constantVal.js +0 -75
  224. package/weapps-plugin-jingtong-verify/utils/md5.js +0 -184
@@ -1,911 +1,773 @@
1
- /* eslint-disable*/
2
- /**
3
- * 检查账号是否合法,只允许字母数字组合
4
- */
5
- function checkAccount(userAccount) {
6
- if (userAccount == null || userAccount == "") {
7
- return {
8
- data: false,
9
- msg: '请输入账号'
10
- };
11
- }
12
- // 长度判断
13
- if (userAccount.length > 20 || userAccount.length < 6) {
14
- return {
15
- data: false,
16
- msg: '登录账号长度应为6-20'
17
- };
18
- }
19
- // 数字或字母组合
20
- var reg_num = /^[0-9]{1,}$/;
21
- var reg_letter = /^[A-Za-z]{1,}$/;
22
- var reg_num_letter = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{2,}$/
23
- if (reg_num_letter.test(userAccount) || reg_num.test(userAccount) || reg_letter.test(userAccount)) {
24
- return {
25
- data: true,
26
- msg: '账号可用'
27
- };
28
- }
29
- return {
30
- data: false,
31
- msg: '登录账号只允许字母或数字组合'
32
- };
33
- }
34
-
35
- /**
36
- * 检查输入字符是否合法,不合法,返回false
37
- */
38
- function checkInputVal(e) {
39
- var keyNum;
40
- if (e.charCode) { //firefox
41
- keyNum = e.charCode;
42
- } else if (event) { //IE
43
- keyNum = event.keyCode;
44
- }
45
- if ((48 <= keyNum && keyNum <= 57) ||
46
- (65 <= keyNum && keyNum <= 90) ||
47
- (97 <= keyNum && keyNum <= 122)) {
48
- return true;
49
- } else {
50
- return false;
51
- }
52
- }
53
- /**
54
- * 检查银行卡登录密码复杂度
55
- * 要求:
56
- * - 长度为 8~20 位
57
- * - 必须包含数字、大写字母、小写字母、特殊字符中的两种及以上
58
- */
59
- function checkBankCardLoginPwd(userPassword) {
60
- if (!userPassword || userPassword.trim() === '') {
61
- return {
62
- data: false,
63
- msg: '请输入密码'
64
- };
65
- }
66
-
67
- if (userPassword.length < 8 || userPassword.length > 20) {
68
- return {
69
- data: false,
70
- msg: '密码长度应为8-20个字符'
71
- };
72
- }
73
-
74
- // 定义四种类型的正则
75
- const regNum = /[0-9]/;
76
- const regLower = /[a-z]/;
77
- const regUpper = /[A-Z]/;
78
- const regSpecial = /[^A-Za-z0-9]/;
79
-
80
- // 计算命中类型数量
81
- let typeCount = 0;
82
- if (regNum.test(userPassword)) typeCount++;
83
- if (regLower.test(userPassword)) typeCount++;
84
- if (regUpper.test(userPassword)) typeCount++;
85
- if (regSpecial.test(userPassword)) typeCount++;
86
-
87
- if (typeCount < 2) {
88
- return {
89
- data: false,
90
- msg: '密码需包含数字、大写字母、小写字母、特殊字符中的至少两种'
91
- };
92
- }
93
-
94
- return {
95
- data: true,
96
- msg: ''
97
- };
98
- }
99
- /**
100
- * 检查密码是否合法
101
- */
102
- function checkPwd(userPassword) {
103
- if (userPassword == null || userPassword == "") {
104
- return {
105
- data: false,
106
- msg: '请输入密码'
107
- };
108
- }
109
- if (userPassword.length > 20 || userPassword.length < 8) {
110
- return {
111
- data: false,
112
- msg: '密码长度应为8-20个字符'
113
- };
114
- } else {
115
- var reg_num = /[0-9]{1,}/;
116
- var reg_letter = /[A-Za-z]{1,}/;
117
- if (!(reg_num.test(userPassword) && reg_letter.test(userPassword))) {
118
- return {
119
- data: false,
120
- msg: '密码应为8~20个字符,必须包含字母和数字'
121
- };
122
- }
123
- }
124
- return {
125
- data: true,
126
- msg: ''
127
- };
128
- }
129
-
130
- /**
131
- * 检查确认密码是否合法
132
- */
133
- function checkConfirmPwd(userPassword, reUserPassword) {
134
- console.log('两次密码')
135
- console.log(userPassword + '+' + reUserPassword)
136
- if (reUserPassword == "" || reUserPassword == null) {
137
- return {
138
- data: false,
139
- msg: '请再次输入确认密码'
140
- };
141
- }
142
- if (userPassword != reUserPassword) {
143
- return {
144
- data: false,
145
- msg: '两次密码输入不一致'
146
- };
147
- }
148
- return {
149
- data: true,
150
- msg: ''
151
- };
152
- }
153
-
154
- /**
155
- * 检查用户姓名是否合法
156
- */
157
- function checkName(userName, cid_type = '111') {
158
- console.log('checkName ==> cid_type:', cid_type)
159
-
160
- if (!userName) {
161
- return {
162
- data: false,
163
- msg: '请输入证件上用户姓名'
164
- };
165
- }
166
- var onlyChineseReg = /^[\u2E80-\uFE4F]+$/; // 中文
167
- var chineseReg = /^[\u2E80-\uFE4F_a-zA-Z_\·•]+$/; // 大陆居民:中文无特殊符号
168
- var emojiReg = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi;
169
- // var englishReg = /^[A-Za-z]+$/ // 全英文
170
- // var chOrEnReg = /^([a-zA-Z\u4E00-\u9FA5]*?)$/ // 英文大小写及中文
171
- var waiGuoReg = /^[A-Za-z]+(\s|\.|\, )?[A-Za-z]*/ // 全英文大写,中间可能有空格,圆点,逗号
172
- var patternSep = /[#\$%\^&\*【】‘;:”“'。,、.,?<>+=:]+/g; // 特殊字符判断
173
-
174
- if (cid_type === '111') {
175
- // 大陆
176
- if (userName.length > 30 || userName.length < 1) {
177
- return {
178
- data: false,
179
- msg: '姓名长度在1~30个字符之间'
180
- };
181
- }
182
- if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
183
- return {
184
- data: false,
185
- msg: '输入空格及其他特殊符号无效 '
186
- };
187
- }
188
- } else if (cid_type === '700') {
189
- // if (onlyChineseReg.test(userName)) {
190
- // return {
191
- // data: false,
192
- // msg: '不能输入中文'
193
- // };
194
- // }
195
- let letterReg = /[a-z]/
196
- if (letterReg.test(userName)) {
197
- console.log('输入了小写', userName)
198
- return {
199
- data: false,
200
- msg: '不能输入小写字母'
201
- }
202
- }
203
- }
204
-
205
- // if (person_type === '10' || person_type === '13') {
206
- // // 大陆、华侨
207
- // if (userName.length > 30 || userName.length < 1) {
208
- // return {
209
- // data: false,
210
- // msg: '姓名长度在1~30个字符之间'
211
- // };
212
- // }
213
- // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
214
- // return {
215
- // data: false,
216
- // msg: '输入空格及其他特殊符号无效 '
217
- // };
218
- // }
219
- // } else if (person_type === '11' || person_type === '12') { // 港澳、台湾
220
- // if (userName.length > 30 || userName.length < 1) {
221
- // return {
222
- // data: false,
223
- // msg: '姓名长度在1~30个字符之间'
224
- // };
225
- // }
226
- // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
227
- // return {
228
- // data: false,
229
- // msg: '输入空格及其他特殊符号无效 '
230
- // };
231
- // }
232
- // } else if (person_type === '14') { // 外国人
233
- // if (cid_type === '553') { // 外国人永久居留证
234
- // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
235
- // return {
236
- // data: false,
237
- // msg: '输入空格及其他特殊符号无效 '
238
- // };
239
- // }
240
- // } else { // 普通护照
241
- // if (!waiGuoReg.test(userName)) {
242
- // return {
243
- // data: false,
244
- // msg: '名字应为全英文'
245
- // };
246
- // }
247
- // }
248
- // }
249
- return {
250
- data: true,
251
- msg: ''
252
- };
253
- }
254
-
255
- /**
256
- * 检查手机号码是否合法
257
- */
258
- function checkPhone(userPhone) {
259
- if (userPhone == "" || userPhone == null) {
260
- return {
261
- data: false,
262
- msg: '请输入手机号码'
263
- };
264
- }
265
- var telreg = /^(((1[0-9]{1}[0-9]{1}))+\d{8})$/;
266
- if (!telreg.test(userPhone) || userPhone.length != 11) {
267
- return {
268
- data: false,
269
- msg: '手机号码格式不正确'
270
- };
271
- }
272
- return {
273
- data: true,
274
- msg: ''
275
- };
276
- }
277
- /**
278
- * 检查银联卡卡号是否合法
279
- */
280
- function checkBankCard(cardNo) {
281
- console.log('卡号')
282
- console.log(cardNo)
283
- if (!cardNo || cardNo.trim() === '') {
284
- return {
285
- data: false,
286
- msg: '请输入银行卡号'
287
- };
288
- }
289
-
290
- // 去除空格
291
- cardNo = cardNo.replace(/\s+/g, '');
292
-
293
- // 必须全为数字
294
- if (!/^\d+$/.test(cardNo)) {
295
- console.log('数字问题')
296
- return {
297
- data: false,
298
- msg: '银行卡号必须为数字'
299
- };
300
- }
301
-
302
- // 银联卡一般为16~19位
303
- if (cardNo.length < 16 || cardNo.length > 19) {
304
- console.log('长度问题')
305
- return {
306
- data: false,
307
- msg: '银行卡号长度应为16到19位'
308
- };
309
- }
310
-
311
- // Luhn算法校验
312
- // if (!luhnCheck(cardNo)) {
313
- // return {
314
- // data: false,
315
- // msg: '银行卡号不合法'
316
- // };
317
- // }
318
-
319
- return {
320
- data: true,
321
- msg: ''
322
- };
323
- }
324
-
325
- /**
326
- * Luhn算法校验
327
- */
328
- function luhnCheck(cardNo) {
329
- if (cardNo == null) return false;
330
-
331
- // 转为字符串并去掉空格
332
- const s = String(cardNo).replace(/\s+/g, '');
333
- // 必须全为数字
334
- if (!/^\d+$/.test(s)) return false;
335
-
336
- let sum = 0;
337
- // 从右向左遍历,rightmost (check digit) 不乘2,左边第一个开始乘2,依次交替
338
- let doubleFlag = false;
339
- for (let i = s.length - 1; i >= 0; i--) {
340
- let digit = Number(s[i]);
341
- if (doubleFlag) {
342
- digit = digit * 2;
343
- if (digit > 9) digit -= 9; // 等价于把两位数各位相加
344
- }
345
- sum += digit;
346
- doubleFlag = !doubleFlag;
347
- }
348
-
349
- return sum % 10 === 0;
350
- }
351
- /**
352
- * 检查证电子邮件是否合法
353
- */
354
- function checkEmail(userEmail) {
355
- if (userEmail == "" || userEmail == null) {
356
- return {
357
- data: false,
358
- msg: '请输入邮箱'
359
- };
360
- }
361
- var mailreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
362
- if (!mailreg.test(userEmail)) {
363
- return {
364
- data: false,
365
- msg: '电子邮件格式不正确'
366
- };
367
- }
368
- return {
369
- data: true,
370
- msg: ''
371
- };
372
- }
373
-
374
- /**
375
- * 检查联系地址
376
- */
377
- function checkAddr(userAddress) {
378
- if (userAddress == "" || userAddress == null) {
379
- return {
380
- data: false,
381
- msg: '请输入证件上的住址'
382
- };
383
- }
384
- return {
385
- data: true,
386
- msg: ''
387
- };
388
- }
389
-
390
- // 组织机构代码
391
- function checkOrgCid(orgNum, unType) {
392
- if (orgNum == "" || orgNum == null) {
393
- return {
394
- data: false,
395
- msg: '请输入单位证件号码'
396
- };
397
- }
398
- // 特殊字符判断和汉字
399
- ///[^\u4e00-\u9fa5]/匹配中文字符,[^\x00-\xff]/匹配双字节字符
400
- var re = /[^\x00-\xff]/;
401
- if (/[#\$%\^&\*【】@!!¥?|‘;:”“'。,、?<>+=:]+/g.test(orgNum) || re.test(orgNum)) {
402
- return {
403
- data: false,
404
- msg: '单位证件号码不允许特殊字符或者中文字符'
405
- };
406
- }
407
-
408
- if (unType == 49) {
409
- // 统一社会信用代码
410
- var ret = CheckSocialCreditCode(orgNum);
411
- if (!ret) {
412
- return {
413
- data: false,
414
- msg: '请填写正确的统一社会信用代码'
415
- };
416
- }
417
- } else if (unType == 50) {
418
- // 组织机构代码
419
- var ret = checkorgcode(orgNum);
420
- if (!ret) {
421
- return {
422
- data: false,
423
- msg: '请填写正确的组织机构代码'
424
- };
425
- }
426
- } else if (unType == 51) {
427
- // 工商营业执照
428
- var ret = isValidBusCode(orgNum);
429
- if (!ret) {
430
- return {
431
- data: false,
432
- msg: '请填写正确的工商营业执照'
433
- };
434
- }
435
- } else if (unType == 60) {
436
- // 税务登记证
437
- var ret = numAndupperCaseCheck(orgNum);
438
- if (!ret) {
439
- return {
440
- data: false,
441
- msg: '请填写正确的税务登记证'
442
- };
443
- }
444
- }
445
- return {
446
- data: true,
447
- msg: ''
448
- };
449
- }
450
-
451
- // 组织机构名称
452
- function checkOrgName(orgName) {
453
- if (orgName == "" || orgName == null) {
454
- return {
455
- data: false,
456
- msg: '请输入组织机构名称'
457
- };
458
- }
459
- if (orgName.length > 100) {
460
- return {
461
- data: false,
462
- msg: '组织机构名称允许100个字符以内'
463
- };
464
- }
465
- return {
466
- data: true,
467
- msg: ''
468
- };
469
- }
470
-
471
- // 证件号码
472
- function checkCid(cid, ctype, nation, who = '') {
473
- console.log('校验证件号码', nation)
474
- cid = removeSpaceFun(cid);
475
- if (!cid) {
476
- return {
477
- data: false,
478
- msg: '请填写证件号码'
479
- };
480
- }
481
- ctype = +ctype
482
- if (/.*[\u4e00-\u9fa5]+.*$/.test(cid)) {
483
- return {
484
- data: false,
485
- msg: who + '证件号码不允许使用汉字'
486
- };
487
- }
488
- // 全角字符判断
489
- if (/[^\x00-\xff]/.test(cid)) {
490
- return {
491
- data: false,
492
- msg: who + '证件号码不允许全角字符'
493
- };
494
- }
495
- // 特殊字符判断
496
- if (ctype !== 553 && /[#\$%\^&\*【】‘;:”“'。,,、.?<>+=:]+/g.test(cid)) {
497
- return {
498
- data: false,
499
- msg: who + '证件号码不允许\'#$%^&*【】‘;:”“\'。,、.,?<>+=:\'等特殊字符'
500
- };
501
- }
502
-
503
- // 身份证
504
- if (ctype === 111) {
505
- if (!checkIDCard(cid)) {
506
- return {
507
- data: false,
508
- msg: who + '证件号码不正确'
509
- };
510
- }
511
- }
512
-
513
- // 港澳居住证、台湾居住证
514
- if (ctype === 17 || ctype === 18) {
515
- console.log('港澳居住证、台湾居住证')
516
- if (!checkResidenceCid(cid)) {
517
- return {
518
- data: false,
519
- msg: who + '证件号码不正确'
520
- }
521
- }
522
- }
523
-
524
- // 港澳居民来往内地通行证、台湾居民来往大陆通行证
525
- if (ctype === 516 || ctype === 511) {
526
- console.log('港澳居民来往内地通行证、台湾居民来往大陆通行证')
527
- if (!checkHmtPassport(cid, ctype, nation).data) {
528
- return {
529
- data: false,
530
- msg: who + '证件号码不正确'
531
- }
532
- }
533
- }
534
-
535
- // 外国护照(银行卡核验时)
536
- // if (ctype === 700) {
537
- // // 不能输入大陆身份证和华侨护照
538
- // if (checkIDCard(cid) || checkCHNPassport(cid)) {
539
- // return {
540
- // data: false,
541
- // msg: who + '证件号码不正确'
542
- // };
543
- // }
544
- // }
545
-
546
- // 华侨护照
547
- // if (ctype === 414) {
548
- // let re1 = /^[EG]{1}[0-9]{8}$/;
549
- // let re2 = /^[EG]{1}[A-Z]{1}[0-9]{7}$/;
550
- // if (!re1.test(cid) && !re2.test(cid)) {
551
- // return {data: false, msg: who + '证件号码不正确'};
552
- // }
553
- // }
554
- // 港澳
555
- // if (ctype === 516) {
556
- // let pattern = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
557
- // if (!pattern.test(cid)) {
558
- // return {data: false, msg: who + '证件号码不正确'};
559
- // }
560
- // }
561
- // 台湾
562
- // if (ctype === 511) {
563
- // let re1 = /^[0-9]{8}[a-zA-Z()]{1,3}$/;
564
- // let re2 = /^[0-9]{10}[a-zA-Z()]{1,3}$/;
565
- // if ((!re1.test(cid) && !re2.test(cid))) {
566
- // return {data: false, msg: who + '证件号码不正确'};
567
- // }
568
- // }
569
- // 外国人永久居留证
570
- // if (ctype === 553) {
571
- // if (cid.length !== 15) {
572
- // return {data: false, msg: who + '证件号码不正确'};
573
- // }
574
- // }
575
- return {
576
- data: true,
577
- msg: ''
578
- };
579
- }
580
-
581
- /**
582
- * 港澳居住证、台湾居住证校验
583
- * 客户提供
584
- * 前三位(810/820/830)和位数(18位数)
585
- */
586
- function checkResidenceCid(cid) {
587
- let reg = /^(810|820|830).{15}$/
588
- return reg.test(cid)
589
- }
590
-
591
- /**
592
- * 港澳台居民来往内地通行证号码校验
593
- * https://www.nia.gov.cn/n741440/n741547/c1197066/content.html
594
- * https://www.guiyang.gov.cn/zwgk/zdlyxxgk2024/shsyjzdms/shaq/crjgl/202408/t20240823_85468731.html
595
- * 港澳-中国籍:"H/M"+8位阿拉伯数字
596
- * 港澳-外籍:"HA/MA"+7位阿拉伯数字
597
- * 台湾: 8位阿拉伯数字
598
- */
599
- function checkHmtPassport(value, ctype, nation = 'CHN') {
600
- console.log('港澳台居民来往内地通行证号码校验', nation)
601
- value = value.replace(/(^\s*)|(\s*$)/g, "")
602
- ctype = +ctype
603
-
604
- const isHm = [516,17].includes(ctype) // 港澳
605
- const isTw = [511,18].includes(ctype) // 台湾
606
- const hmReg = /^(H|M|h|m)[0-9]{8}$/
607
- const hmForeignReg = /^[hm]a\d{7}$/i
608
- const twReg = /^[0-9]{8}$/
609
-
610
- if (isHm) {
611
- if (!nation || nation === 'CHN') {
612
- console.log('中国籍')
613
- if (!hmReg.test(value)) {
614
- return {
615
- data: false,
616
- msg: '港澳居民来往内地通行证号码不正确'
617
- }
618
- }
619
- } else {
620
- console.log('外籍')
621
- if (!hmForeignReg.test(value)) {
622
- return {
623
- data: false,
624
- msg: '港澳居民来往内地通行证号码不正确'
625
- }
626
- }
627
- }
628
- }
629
- if (isTw && !twReg.test(value)) {
630
- return {
631
- data: false,
632
- msg: '港澳居民来往内地通行证号码不正确'
633
- }
634
- }
635
- return {
636
- data: true,
637
- msg: ''
638
- }
639
- }
640
-
641
- // 华侨护照414校验规则
642
- function checkCHNPassport(cid) {
643
- let re1 = /^[EG]{1}[0-9]{8}$/;
644
- let re2 = /^[EG]{1}[A-Z]{1}[0-9]{7}$/;
645
- if (!re1.test(cid) && !re2.test(cid)) {
646
- return false;
647
- }
648
- return true
649
- }
650
-
651
- // 统一社会信用代码校验规则
652
- function CheckSocialCreditCode(code) {
653
- code = code.replace(/(^\s*)|(\s*$)/g, "")
654
- var testCode = numAndupperCaseCheck(code);
655
- if ((code.length != 18) || (testCode == false)) {
656
- return false;
657
- } else {
658
- var Ancode; //统一社会信用代码的每一个值
659
- var Ancodevalue; //统一社会信用代码每一个值的权重
660
- var total = 0;
661
- var weightedfactors = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28]; //加权因子
662
- var str = '0123456789ABCDEFGHJKLMNPQRTUWXY'; //不用I、O、S、V、Z
663
- for (var i = 0; i < code.length - 1; i++) {
664
- Ancode = code.substring(i, i + 1);
665
- Ancodevalue = str.indexOf(Ancode);
666
- total = total + Ancodevalue * weightedfactors[i]; //权重与加权因子相乘之和
667
- }
668
- var logiccheckcode = 31 - total % 31;
669
- if (logiccheckcode == 31) {
670
- logiccheckcode = 0;
671
- }
672
- var Str = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,T,U,W,X,Y";
673
- var Array_Str = Str.split(',');
674
- logiccheckcode = Array_Str[logiccheckcode];
675
- var checkcode = code.substring(17, 18);
676
- if (logiccheckcode != checkcode) {
677
- return false;
678
- }
679
- return true;
680
- }
681
- }
682
-
683
- // 组织机构代码校验
684
- function checkorgcode(orgcode) {
685
- orgcode = orgcode.replace(/(^\s*)|(\s*$)/g, "");
686
- if (orgcode.length != 9) {
687
- return false;
688
- }
689
-
690
- var patrn = /^[0-9A-Z]+$/;
691
-
692
- if (patrn.test(orgcode) == false) {
693
- return false;
694
- }
695
-
696
- var lastpatrn = /^[0-9X]+$/;
697
- var checkcode = orgcode.substring(8, 9);
698
- if (lastpatrn.test(checkcode) == false) { //最后的校验为只能是0到9的数字或者大写字母X
699
- return false;
700
- }
701
- var ws = [3, 7, 9, 10, 5, 8, 4, 2];
702
- var str = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
703
- var ancode;
704
- var ancodevalue;
705
- var total = 0;
706
- for (var i = 0; i < orgcode.length - 1; i++) {
707
- ancode = orgcode.substring(i, i + 1);
708
- ancodevalue = str.indexOf(ancode) * ws[i];
709
- total = total + ancodevalue;
710
- }
711
- var logiccheckcode = 11 - total % 11;
712
- if (logiccheckcode == 10) {
713
- logiccheckcode = 'X';
714
- }
715
- if (logiccheckcode == 11) {
716
- logiccheckcode = '0';
717
- }
718
-
719
- if (checkcode != logiccheckcode) {
720
- return false;
721
- } else {
722
- return true;
723
- }
724
-
725
- }
726
-
727
- // 工商营业执照
728
- function isValidBusCode(busCode) {
729
- busCode = busCode.replace(/(^\s*)|(\s*$)/g, "");
730
- var ret = false;
731
- if ("" == busCode || busCode.length == 0) {
732
- return false;
733
- }
734
- var patrn = /^[0-9]+$/;
735
- if (!patrn.test(busCode)) {
736
- return false;
737
- }
738
- if (busCode.length == 15) {
739
- var sum = 0;
740
- var s = [];
741
- var p = [];
742
- var a = [];
743
- var m = 10;
744
- p[0] = m;
745
- for (var i = 0; i < busCode.length; i++) {
746
- a[i] = parseInt(busCode.substring(i, i + 1), m);
747
- s[i] = (p[i] % (m + 1)) + a[i];
748
- if (0 == s[i] % m) {
749
- p[i + 1] = 10 * 2;
750
- } else {
751
- p[i + 1] = (s[i] % m) * 2;
752
- }
753
- }
754
- if (1 == (s[14] % m)) {
755
- //营业执照编号正确!
756
- ret = true;
757
- } else {
758
- //营业执照编号错误!
759
- ret = false;
760
-
761
- }
762
- } else {
763
- ret = false;
764
- //alert("营业执照格式不对,必须是15位数的!");
765
- }
766
- return ret;
767
- }
768
-
769
- // 身份证号码
770
- function checkIDCard(sId) {
771
- if (sId == null || sId == "") {
772
- return false;
773
- }
774
- var aCity = {
775
- 11: "北京",
776
- 12: "天津",
777
- 13: "河北",
778
- 14: "山西",
779
- 15: "内蒙古",
780
- 21: "辽宁",
781
- 22: "吉林",
782
- 23: "黑龙江",
783
- 31: "上海",
784
- 32: "江苏",
785
- 33: "浙江",
786
- 34: "安徽",
787
- 35: "福建",
788
- 36: "江西",
789
- 37: "山东",
790
- 41: "河南",
791
- 42: "湖北",
792
- 43: "湖南",
793
- 44: "广东",
794
- 45: "广西",
795
- 46: "海南",
796
- 50: "重庆",
797
- 51: "四川",
798
- 52: "贵州",
799
- 53: "云南",
800
- 54: "西藏",
801
- 61: "陕西",
802
- 62: "甘肃",
803
- 63: "青海",
804
- 64: "宁夏",
805
- 65: "新疆",
806
- 71: "台湾",
807
- 81: "香港",
808
- 82: "澳门",
809
- 91: "国外"
810
- }
811
- var iSum = 0;
812
- var info = "";
813
- if (!/^\d{17}(\d|x)$/i.test(sId)) {
814
- return false;
815
- }
816
- sId = sId.replace(/x$/i, "a");
817
- if (aCity[parseInt(sId.substr(0, 2))] == null) {
818
- return false;
819
- }
820
- var sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
821
- var d = new Date(sBirthday.replace(/-/g, "/"));
822
- if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) {
823
- return false;
824
- }
825
- /*身份证号码校验位检查*/
826
- for (var i = 17; i >= 0; i--) {
827
- iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11);
828
- }
829
- if (iSum % 11 != 1) {
830
- return false;
831
- }
832
- return true;
833
- }
834
-
835
- /**
836
- * 只允许数字和大写字母
837
- * @param code
838
- * @returns {boolean}
839
- */
840
- function numAndupperCaseCheck(code) {
841
- code = code.replace(/(^\s*)|(\s*$)/g, "");
842
- if (code == "" || code.length == 0) {
843
- return false;
844
- }
845
- var patrn = /^[0-9A-Z]+$/;
846
- return patrn.test(code);
847
- }
848
-
849
- function numAndLetter(idNumber) {
850
- ///^[0-9a-zA-Z]*$/g;
851
- idNumber = idNumber.replace(/(^\s*)|(\s*$)/g, "");
852
- if (idNumber == "" || idNumber.length == 0) {
853
- return false;
854
- }
855
- var patrn = /^[0-9a-zA-Z]*$/g;
856
- return patrn.test(idNumber);
857
- }
858
-
859
- /**
860
- * 去掉左右空格
861
- */
862
- function removeSpaceFun(param) {
863
- if (param == "" || param == null || param.length == 0) {
864
- return "";
865
- }
866
- return param.replace(/(^\s*)|(\s*$)/g, "");
867
- }
868
-
869
- // 判断是否含有特殊字符
870
- function checkSpecialChar(value) {
871
- if (value != null && value != "") {
872
- if (/[-#\$%\^&\*【】‘;:”“'。,、?<>+=:]+/g.test(value)) {
873
- return true;
874
- }
875
- }
876
- return false;
877
- }
878
- function checkVerificationCode(value){
879
- console.log('验证验证码')
880
- console.log(value)
881
- if (!value || value.trim() === '') {
882
- return {
883
- data: false,
884
- msg: '请输入验证码'
885
- };
886
- }
887
- return {
888
- data: true,
889
- msg: ''
890
- };
891
- }
892
-
893
-
894
- export {
895
- checkAccount,
896
- checkPwd,
897
- checkBankCardLoginPwd,
898
- checkConfirmPwd,
899
- checkName,
900
- checkCid,
901
- checkOrgName,
902
- checkOrgCid,
903
- checkPhone,
904
- checkBankCard,
905
- checkAddr,
906
- checkEmail,
907
- checkIDCard,
908
- removeSpaceFun,
909
- checkHmtPassport,
910
- checkVerificationCode
1
+ /* eslint-disable*/
2
+ /**
3
+ * 检查账号是否合法,只允许字母数字组合
4
+ */
5
+ function checkAccount(userAccount) {
6
+ if (userAccount == null || userAccount == "") {
7
+ return {
8
+ data: false,
9
+ msg: '请输入账号'
10
+ };
11
+ }
12
+ // 长度判断
13
+ if (userAccount.length > 20 || userAccount.length < 6) {
14
+ return {
15
+ data: false,
16
+ msg: '登录账号长度应为6-20'
17
+ };
18
+ }
19
+ // 数字或字母组合
20
+ var reg_num = /^[0-9]{1,}$/;
21
+ var reg_letter = /^[A-Za-z]{1,}$/;
22
+ var reg_num_letter = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{2,}$/
23
+ if (reg_num_letter.test(userAccount) || reg_num.test(userAccount) || reg_letter.test(userAccount)) {
24
+ return {
25
+ data: true,
26
+ msg: '账号可用'
27
+ };
28
+ }
29
+ return {
30
+ data: false,
31
+ msg: '登录账号只允许字母或数字组合'
32
+ };
33
+ }
34
+
35
+ /**
36
+ * 检查输入字符是否合法,不合法,返回false
37
+ */
38
+ function checkInputVal(e) {
39
+ var keyNum;
40
+ if (e.charCode) { //firefox
41
+ keyNum = e.charCode;
42
+ } else if (event) { //IE
43
+ keyNum = event.keyCode;
44
+ }
45
+ if ((48 <= keyNum && keyNum <= 57) ||
46
+ (65 <= keyNum && keyNum <= 90) ||
47
+ (97 <= keyNum && keyNum <= 122)) {
48
+ return true;
49
+ } else {
50
+ return false;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * 检查密码是否合法
56
+ */
57
+ function checkPwd(userPassword) {
58
+ if (userPassword == null || userPassword == "") {
59
+ return {
60
+ data: false,
61
+ msg: '请输入密码'
62
+ };
63
+ }
64
+ if (userPassword.length > 20 || userPassword.length < 8) {
65
+ return {
66
+ data: false,
67
+ msg: '密码长度应为8-20个字符'
68
+ };
69
+ } else {
70
+ var reg_num = /[0-9]{1,}/;
71
+ var reg_letter = /[A-Za-z]{1,}/;
72
+ if (!(reg_num.test(userPassword) && reg_letter.test(userPassword))) {
73
+ return {
74
+ data: false,
75
+ msg: '密码应为8~20个字符,必须包含字母和数字'
76
+ };
77
+ }
78
+ }
79
+ return {
80
+ data: true,
81
+ msg: ''
82
+ };
83
+ }
84
+
85
+ /**
86
+ * 检查确认密码是否合法
87
+ */
88
+ function checkConfirmPwd(userPassword, reUserPassword) {
89
+ if (reUserPassword == "" || reUserPassword == null) {
90
+ return {
91
+ data: false,
92
+ msg: '请再次输入确认密码'
93
+ };
94
+ }
95
+ if (userPassword != reUserPassword) {
96
+ return {
97
+ data: false,
98
+ msg: '两次密码输入不一致'
99
+ };
100
+ }
101
+ return {
102
+ data: true,
103
+ msg: ''
104
+ };
105
+ }
106
+
107
+ /**
108
+ * 检查用户姓名是否合法
109
+ */
110
+ function checkName(userName, cid_type = '111') {
111
+ console.log('checkName ==> cid_type:', cid_type)
112
+
113
+ if (!userName) {
114
+ return {
115
+ data: false,
116
+ msg: '请输入证件上用户姓名'
117
+ };
118
+ }
119
+ var onlyChineseReg = /^[\u2E80-\uFE4F]+$/; // 中文
120
+ var chineseReg = /^[\u2E80-\uFE4F_a-zA-Z_\·•]+$/; // 大陆居民:中文无特殊符号
121
+ var emojiReg = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi;
122
+ // var englishReg = /^[A-Za-z]+$/ // 全英文
123
+ // var chOrEnReg = /^([a-zA-Z\u4E00-\u9FA5]*?)$/ // 英文大小写及中文
124
+ var waiGuoReg = /^[A-Za-z]+(\s|\.|\, )?[A-Za-z]*/ // 全英文大写,中间可能有空格,圆点,逗号
125
+ var patternSep = /[#\$%\^&\*【】‘;:”“'。,、.,?<>+=:]+/g; // 特殊字符判断
126
+
127
+ if (cid_type === '111') {
128
+ // 大陆
129
+ if (userName.length > 30 || userName.length < 1) {
130
+ return {
131
+ data: false,
132
+ msg: '姓名长度在1~30个字符之间'
133
+ };
134
+ }
135
+ if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
136
+ return {
137
+ data: false,
138
+ msg: '输入空格及其他特殊符号无效 '
139
+ };
140
+ }
141
+ } else if (cid_type === '700') {
142
+ // if (onlyChineseReg.test(userName)) {
143
+ // return {
144
+ // data: false,
145
+ // msg: '不能输入中文'
146
+ // };
147
+ // }
148
+ let letterReg = /[a-z]/
149
+ if (letterReg.test(userName)) {
150
+ console.log('输入了小写', userName)
151
+ return {
152
+ data: false,
153
+ msg: '不能输入小写字母'
154
+ }
155
+ }
156
+ }
157
+
158
+ // if (person_type === '10' || person_type === '13') {
159
+ // // 大陆、华侨
160
+ // if (userName.length > 30 || userName.length < 1) {
161
+ // return {
162
+ // data: false,
163
+ // msg: '姓名长度在1~30个字符之间'
164
+ // };
165
+ // }
166
+ // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
167
+ // return {
168
+ // data: false,
169
+ // msg: '输入空格及其他特殊符号无效 '
170
+ // };
171
+ // }
172
+ // } else if (person_type === '11' || person_type === '12') { // 港澳、台湾
173
+ // if (userName.length > 30 || userName.length < 1) {
174
+ // return {
175
+ // data: false,
176
+ // msg: '姓名长度在1~30个字符之间'
177
+ // };
178
+ // }
179
+ // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
180
+ // return {
181
+ // data: false,
182
+ // msg: '输入空格及其他特殊符号无效 '
183
+ // };
184
+ // }
185
+ // } else if (person_type === '14') { // 外国人
186
+ // if (cid_type === '553') { // 外国人永久居留证
187
+ // if (!(chineseReg.test(userName) && !emojiReg.test(userName)) || patternSep.test(userName)) {
188
+ // return {
189
+ // data: false,
190
+ // msg: '输入空格及其他特殊符号无效 '
191
+ // };
192
+ // }
193
+ // } else { // 普通护照
194
+ // if (!waiGuoReg.test(userName)) {
195
+ // return {
196
+ // data: false,
197
+ // msg: '名字应为全英文'
198
+ // };
199
+ // }
200
+ // }
201
+ // }
202
+ return {
203
+ data: true,
204
+ msg: ''
205
+ };
206
+ }
207
+
208
+ /**
209
+ * 检查手机号码是否合法
210
+ */
211
+ function checkPhone(userPhone) {
212
+ if (userPhone == "" || userPhone == null) {
213
+ return {
214
+ data: false,
215
+ msg: '请输入手机号码'
216
+ };
217
+ }
218
+ var telreg = /^(((1[0-9]{1}[0-9]{1}))+\d{8})$/;
219
+ if (!telreg.test(userPhone) || userPhone.length != 11) {
220
+ return {
221
+ data: false,
222
+ msg: '手机号码格式不正确'
223
+ };
224
+ }
225
+ return {
226
+ data: true,
227
+ msg: ''
228
+ };
229
+ }
230
+
231
+ /**
232
+ * 检查证电子邮件是否合法
233
+ */
234
+ function checkEmail(userEmail) {
235
+ if (userEmail == "" || userEmail == null) {
236
+ return {
237
+ data: false,
238
+ msg: '请输入邮箱'
239
+ };
240
+ }
241
+ var mailreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
242
+ if (!mailreg.test(userEmail)) {
243
+ return {
244
+ data: false,
245
+ msg: '电子邮件格式不正确'
246
+ };
247
+ }
248
+ return {
249
+ data: true,
250
+ msg: ''
251
+ };
252
+ }
253
+
254
+ /**
255
+ * 检查联系地址
256
+ */
257
+ function checkAddr(userAddress) {
258
+ if (userAddress == "" || userAddress == null) {
259
+ return {
260
+ data: false,
261
+ msg: '请输入证件上的住址'
262
+ };
263
+ }
264
+ return {
265
+ data: true,
266
+ msg: ''
267
+ };
268
+ }
269
+
270
+ // 组织机构代码
271
+ function checkOrgCid(orgNum, unType) {
272
+ if (orgNum == "" || orgNum == null) {
273
+ return {
274
+ data: false,
275
+ msg: '请输入单位证件号码'
276
+ };
277
+ }
278
+ // 特殊字符判断和汉字
279
+ ///[^\u4e00-\u9fa5]/匹配中文字符,[^\x00-\xff]/匹配双字节字符
280
+ var re = /[^\x00-\xff]/;
281
+ if (/[#\$%\^&\*【】@!!¥?|‘;:”“'。,、?<>+=:]+/g.test(orgNum) || re.test(orgNum)) {
282
+ return {
283
+ data: false,
284
+ msg: '单位证件号码不允许特殊字符或者中文字符'
285
+ };
286
+ }
287
+
288
+ if (unType == 49) {
289
+ // 统一社会信用代码
290
+ var ret = CheckSocialCreditCode(orgNum);
291
+ if (!ret) {
292
+ return {
293
+ data: false,
294
+ msg: '请填写正确的统一社会信用代码'
295
+ };
296
+ }
297
+ } else if (unType == 50) {
298
+ // 组织机构代码
299
+ var ret = checkorgcode(orgNum);
300
+ if (!ret) {
301
+ return {
302
+ data: false,
303
+ msg: '请填写正确的组织机构代码'
304
+ };
305
+ }
306
+ } else if (unType == 51) {
307
+ // 工商营业执照
308
+ var ret = isValidBusCode(orgNum);
309
+ if (!ret) {
310
+ return {
311
+ data: false,
312
+ msg: '请填写正确的工商营业执照'
313
+ };
314
+ }
315
+ } else if (unType == 60) {
316
+ // 税务登记证
317
+ var ret = numAndupperCaseCheck(orgNum);
318
+ if (!ret) {
319
+ return {
320
+ data: false,
321
+ msg: '请填写正确的税务登记证'
322
+ };
323
+ }
324
+ }
325
+ return {
326
+ data: true,
327
+ msg: ''
328
+ };
329
+ }
330
+
331
+ // 组织机构名称
332
+ function checkOrgName(orgName) {
333
+ if (orgName == "" || orgName == null) {
334
+ return {
335
+ data: false,
336
+ msg: '请输入组织机构名称'
337
+ };
338
+ }
339
+ if (orgName.length > 100) {
340
+ return {
341
+ data: false,
342
+ msg: '组织机构名称允许100个字符以内'
343
+ };
344
+ }
345
+ return {
346
+ data: true,
347
+ msg: ''
348
+ };
349
+ }
350
+
351
+ // 证件号码
352
+ function checkCid(cid, ctype, nation, who = '') {
353
+ console.log('校验证件号码', nation)
354
+ cid = removeSpaceFun(cid);
355
+ if (!cid) {
356
+ return {
357
+ data: false,
358
+ msg: '请填写证件号码'
359
+ };
360
+ }
361
+ ctype = +ctype
362
+ if (/.*[\u4e00-\u9fa5]+.*$/.test(cid)) {
363
+ return {
364
+ data: false,
365
+ msg: who + '证件号码不允许使用汉字'
366
+ };
367
+ }
368
+ // 全角字符判断
369
+ if (/[^\x00-\xff]/.test(cid)) {
370
+ return {
371
+ data: false,
372
+ msg: who + '证件号码不允许全角字符'
373
+ };
374
+ }
375
+ // 特殊字符判断
376
+ if (ctype !== 553 && /[#\$%\^&\*【】‘;:”“'。,,、.?<>+=:]+/g.test(cid)) {
377
+ return {
378
+ data: false,
379
+ msg: who + '证件号码不允许\'#$%^&*【】‘;:”“\'。,、.,?<>+=:\'等特殊字符'
380
+ };
381
+ }
382
+
383
+ // 身份证
384
+ if (ctype === 111) {
385
+ if (!checkIDCard(cid)) {
386
+ return {
387
+ data: false,
388
+ msg: who + '证件号码不正确'
389
+ };
390
+ }
391
+ }
392
+
393
+ // 港澳居住证、台湾居住证
394
+ if (ctype === 17 || ctype === 18) {
395
+ console.log('港澳居住证、台湾居住证')
396
+ if (!checkResidenceCid(cid)) {
397
+ return {
398
+ data: false,
399
+ msg: who + '证件号码不正确'
400
+ }
401
+ }
402
+ }
403
+
404
+ // 港澳居民来往内地通行证、台湾居民来往大陆通行证
405
+ if (ctype === 516 || ctype === 511) {
406
+ console.log('港澳居民来往内地通行证、台湾居民来往大陆通行证')
407
+ if (!checkHmtPassport(cid, ctype, nation).data) {
408
+ return {
409
+ data: false,
410
+ msg: who + '证件号码不正确'
411
+ }
412
+ }
413
+ }
414
+
415
+ // 外国护照(银行卡核验时)
416
+ // if (ctype === 700) {
417
+ // // 不能输入大陆身份证和华侨护照
418
+ // if (checkIDCard(cid) || checkCHNPassport(cid)) {
419
+ // return {
420
+ // data: false,
421
+ // msg: who + '证件号码不正确'
422
+ // };
423
+ // }
424
+ // }
425
+
426
+ // 华侨护照
427
+ // if (ctype === 414) {
428
+ // let re1 = /^[EG]{1}[0-9]{8}$/;
429
+ // let re2 = /^[EG]{1}[A-Z]{1}[0-9]{7}$/;
430
+ // if (!re1.test(cid) && !re2.test(cid)) {
431
+ // return {data: false, msg: who + '证件号码不正确'};
432
+ // }
433
+ // }
434
+ // 港澳
435
+ // if (ctype === 516) {
436
+ // let pattern = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
437
+ // if (!pattern.test(cid)) {
438
+ // return {data: false, msg: who + '证件号码不正确'};
439
+ // }
440
+ // }
441
+ // 台湾
442
+ // if (ctype === 511) {
443
+ // let re1 = /^[0-9]{8}[a-zA-Z()]{1,3}$/;
444
+ // let re2 = /^[0-9]{10}[a-zA-Z()]{1,3}$/;
445
+ // if ((!re1.test(cid) && !re2.test(cid))) {
446
+ // return {data: false, msg: who + '证件号码不正确'};
447
+ // }
448
+ // }
449
+ // 外国人永久居留证
450
+ // if (ctype === 553) {
451
+ // if (cid.length !== 15) {
452
+ // return {data: false, msg: who + '证件号码不正确'};
453
+ // }
454
+ // }
455
+ return {
456
+ data: true,
457
+ msg: ''
458
+ };
459
+ }
460
+
461
+ /**
462
+ * 港澳居住证、台湾居住证校验
463
+ * 客户提供
464
+ * 前三位(810/820/830)和位数(18位数)
465
+ */
466
+ function checkResidenceCid(cid) {
467
+ let reg = /^(810|820|830).{15}$/
468
+ return reg.test(cid)
469
+ }
470
+
471
+ /**
472
+ * 港澳台居民来往内地通行证号码校验
473
+ * https://www.nia.gov.cn/n741440/n741547/c1197066/content.html
474
+ * https://www.guiyang.gov.cn/zwgk/zdlyxxgk2024/shsyjzdms/shaq/crjgl/202408/t20240823_85468731.html
475
+ * 港澳-中国籍:"H/M"+8位阿拉伯数字
476
+ * 港澳-外籍:"HA/MA"+7位阿拉伯数字
477
+ * 台湾: 8位阿拉伯数字
478
+ */
479
+ function checkHmtPassport(value, ctype, nation = 'CHN') {
480
+ console.log('港澳台居民来往内地通行证号码校验', nation)
481
+ value = value.replace(/(^\s*)|(\s*$)/g, "")
482
+ ctype = +ctype
483
+
484
+ const isHm = [516,17].includes(ctype) // 港澳
485
+ const isTw = [511,18].includes(ctype) // 台湾
486
+ const hmReg = /^(H|M|h|m)[0-9]{8}$/
487
+ const hmForeignReg = /^[hm]a\d{7}$/i
488
+ const twReg = /^[0-9]{8}$/
489
+
490
+ if (isHm) {
491
+ if (!nation || nation === 'CHN') {
492
+ console.log('中国籍')
493
+ if (!hmReg.test(value)) {
494
+ return {
495
+ data: false,
496
+ msg: '港澳居民来往内地通行证号码不正确'
497
+ }
498
+ }
499
+ } else {
500
+ console.log('外籍')
501
+ if (!hmForeignReg.test(value)) {
502
+ return {
503
+ data: false,
504
+ msg: '港澳居民来往内地通行证号码不正确'
505
+ }
506
+ }
507
+ }
508
+ }
509
+ if (isTw && !twReg.test(value)) {
510
+ return {
511
+ data: false,
512
+ msg: '港澳居民来往内地通行证号码不正确'
513
+ }
514
+ }
515
+ return {
516
+ data: true,
517
+ msg: ''
518
+ }
519
+ }
520
+
521
+ // 华侨护照414校验规则
522
+ function checkCHNPassport(cid) {
523
+ let re1 = /^[EG]{1}[0-9]{8}$/;
524
+ let re2 = /^[EG]{1}[A-Z]{1}[0-9]{7}$/;
525
+ if (!re1.test(cid) && !re2.test(cid)) {
526
+ return false;
527
+ }
528
+ return true
529
+ }
530
+
531
+ // 统一社会信用代码校验规则
532
+ function CheckSocialCreditCode(code) {
533
+ code = code.replace(/(^\s*)|(\s*$)/g, "")
534
+ var testCode = numAndupperCaseCheck(code);
535
+ if ((code.length != 18) || (testCode == false)) {
536
+ return false;
537
+ } else {
538
+ var Ancode; //统一社会信用代码的每一个值
539
+ var Ancodevalue; //统一社会信用代码每一个值的权重
540
+ var total = 0;
541
+ var weightedfactors = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28]; //加权因子
542
+ var str = '0123456789ABCDEFGHJKLMNPQRTUWXY'; //不用I、O、S、V、Z
543
+ for (var i = 0; i < code.length - 1; i++) {
544
+ Ancode = code.substring(i, i + 1);
545
+ Ancodevalue = str.indexOf(Ancode);
546
+ total = total + Ancodevalue * weightedfactors[i]; //权重与加权因子相乘之和
547
+ }
548
+ var logiccheckcode = 31 - total % 31;
549
+ if (logiccheckcode == 31) {
550
+ logiccheckcode = 0;
551
+ }
552
+ var Str = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,T,U,W,X,Y";
553
+ var Array_Str = Str.split(',');
554
+ logiccheckcode = Array_Str[logiccheckcode];
555
+ var checkcode = code.substring(17, 18);
556
+ if (logiccheckcode != checkcode) {
557
+ return false;
558
+ }
559
+ return true;
560
+ }
561
+ }
562
+
563
+ // 组织机构代码校验
564
+ function checkorgcode(orgcode) {
565
+ orgcode = orgcode.replace(/(^\s*)|(\s*$)/g, "");
566
+ if (orgcode.length != 9) {
567
+ return false;
568
+ }
569
+
570
+ var patrn = /^[0-9A-Z]+$/;
571
+
572
+ if (patrn.test(orgcode) == false) {
573
+ return false;
574
+ }
575
+
576
+ var lastpatrn = /^[0-9X]+$/;
577
+ var checkcode = orgcode.substring(8, 9);
578
+ if (lastpatrn.test(checkcode) == false) { //最后的校验为只能是0到9的数字或者大写字母X
579
+ return false;
580
+ }
581
+ var ws = [3, 7, 9, 10, 5, 8, 4, 2];
582
+ var str = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
583
+ var ancode;
584
+ var ancodevalue;
585
+ var total = 0;
586
+ for (var i = 0; i < orgcode.length - 1; i++) {
587
+ ancode = orgcode.substring(i, i + 1);
588
+ ancodevalue = str.indexOf(ancode) * ws[i];
589
+ total = total + ancodevalue;
590
+ }
591
+ var logiccheckcode = 11 - total % 11;
592
+ if (logiccheckcode == 10) {
593
+ logiccheckcode = 'X';
594
+ }
595
+ if (logiccheckcode == 11) {
596
+ logiccheckcode = '0';
597
+ }
598
+
599
+ if (checkcode != logiccheckcode) {
600
+ return false;
601
+ } else {
602
+ return true;
603
+ }
604
+
605
+ }
606
+
607
+ // 工商营业执照
608
+ function isValidBusCode(busCode) {
609
+ busCode = busCode.replace(/(^\s*)|(\s*$)/g, "");
610
+ var ret = false;
611
+ if ("" == busCode || busCode.length == 0) {
612
+ return false;
613
+ }
614
+ var patrn = /^[0-9]+$/;
615
+ if (!patrn.test(busCode)) {
616
+ return false;
617
+ }
618
+ if (busCode.length == 15) {
619
+ var sum = 0;
620
+ var s = [];
621
+ var p = [];
622
+ var a = [];
623
+ var m = 10;
624
+ p[0] = m;
625
+ for (var i = 0; i < busCode.length; i++) {
626
+ a[i] = parseInt(busCode.substring(i, i + 1), m);
627
+ s[i] = (p[i] % (m + 1)) + a[i];
628
+ if (0 == s[i] % m) {
629
+ p[i + 1] = 10 * 2;
630
+ } else {
631
+ p[i + 1] = (s[i] % m) * 2;
632
+ }
633
+ }
634
+ if (1 == (s[14] % m)) {
635
+ //营业执照编号正确!
636
+ ret = true;
637
+ } else {
638
+ //营业执照编号错误!
639
+ ret = false;
640
+
641
+ }
642
+ } else {
643
+ ret = false;
644
+ //alert("营业执照格式不对,必须是15位数的!");
645
+ }
646
+ return ret;
647
+ }
648
+
649
+ // 身份证号码
650
+ function checkIDCard(sId) {
651
+ if (sId == null || sId == "") {
652
+ return false;
653
+ }
654
+ var aCity = {
655
+ 11: "北京",
656
+ 12: "天津",
657
+ 13: "河北",
658
+ 14: "山西",
659
+ 15: "内蒙古",
660
+ 21: "辽宁",
661
+ 22: "吉林",
662
+ 23: "黑龙江",
663
+ 31: "上海",
664
+ 32: "江苏",
665
+ 33: "浙江",
666
+ 34: "安徽",
667
+ 35: "福建",
668
+ 36: "江西",
669
+ 37: "山东",
670
+ 41: "河南",
671
+ 42: "湖北",
672
+ 43: "湖南",
673
+ 44: "广东",
674
+ 45: "广西",
675
+ 46: "海南",
676
+ 50: "重庆",
677
+ 51: "四川",
678
+ 52: "贵州",
679
+ 53: "云南",
680
+ 54: "西藏",
681
+ 61: "陕西",
682
+ 62: "甘肃",
683
+ 63: "青海",
684
+ 64: "宁夏",
685
+ 65: "新疆",
686
+ 71: "台湾",
687
+ 81: "香港",
688
+ 82: "澳门",
689
+ 91: "国外"
690
+ }
691
+ var iSum = 0;
692
+ var info = "";
693
+ if (!/^\d{17}(\d|x)$/i.test(sId)) {
694
+ return false;
695
+ }
696
+ sId = sId.replace(/x$/i, "a");
697
+ if (aCity[parseInt(sId.substr(0, 2))] == null) {
698
+ return false;
699
+ }
700
+ var sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
701
+ var d = new Date(sBirthday.replace(/-/g, "/"));
702
+ if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) {
703
+ return false;
704
+ }
705
+ /*身份证号码校验位检查*/
706
+ for (var i = 17; i >= 0; i--) {
707
+ iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11);
708
+ }
709
+ if (iSum % 11 != 1) {
710
+ return false;
711
+ }
712
+ return true;
713
+ }
714
+
715
+ /**
716
+ * 只允许数字和大写字母
717
+ * @param code
718
+ * @returns {boolean}
719
+ */
720
+ function numAndupperCaseCheck(code) {
721
+ code = code.replace(/(^\s*)|(\s*$)/g, "");
722
+ if (code == "" || code.length == 0) {
723
+ return false;
724
+ }
725
+ var patrn = /^[0-9A-Z]+$/;
726
+ return patrn.test(code);
727
+ }
728
+
729
+ function numAndLetter(idNumber) {
730
+ ///^[0-9a-zA-Z]*$/g;
731
+ idNumber = idNumber.replace(/(^\s*)|(\s*$)/g, "");
732
+ if (idNumber == "" || idNumber.length == 0) {
733
+ return false;
734
+ }
735
+ var patrn = /^[0-9a-zA-Z]*$/g;
736
+ return patrn.test(idNumber);
737
+ }
738
+
739
+ /**
740
+ * 去掉左右空格
741
+ */
742
+ function removeSpaceFun(param) {
743
+ if (param == "" || param == null || param.length == 0) {
744
+ return "";
745
+ }
746
+ return param.replace(/(^\s*)|(\s*$)/g, "");
747
+ }
748
+
749
+ // 判断是否含有特殊字符
750
+ function checkSpecialChar(value) {
751
+ if (value != null && value != "") {
752
+ if (/[-#\$%\^&\*【】‘;:”“'。,、?<>+=:]+/g.test(value)) {
753
+ return true;
754
+ }
755
+ }
756
+ return false;
757
+ }
758
+
759
+ export {
760
+ checkAccount,
761
+ checkPwd,
762
+ checkConfirmPwd,
763
+ checkName,
764
+ checkCid,
765
+ checkOrgName,
766
+ checkOrgCid,
767
+ checkPhone,
768
+ checkAddr,
769
+ checkEmail,
770
+ checkIDCard,
771
+ removeSpaceFun,
772
+ checkHmtPassport
911
773
  }