weapps-plugin-jingtong-verify 1.6.1 → 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 (183) hide show
  1. package/README.md +1 -2
  2. package/app.json +33 -33
  3. package/package.json +20 -20
  4. package/sdk.js +309 -289
  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 -179
  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 -236
  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 -206
  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 -39
  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 -9
  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 -262
  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 +1557 -1547
  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 -504
  146. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -133
  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 -120
  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 -328
  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/rules.js +301 -301
  182. package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
  183. package/weapps-plugin-jingtong-verify/utils/validate.js +772 -772
@@ -1,773 +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
- */
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
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
773
773
  }