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.
- package/README.md +1 -1
- package/app.json +33 -41
- package/package.json +21 -21
- package/sdk.js +309 -320
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
- package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
- package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -182
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +236 -241
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -214
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -47
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -11
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
- package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
- package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
- package/weapps-plugin-jingtong-verify/i18n/rules.js +262 -403
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1558 -1812
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +504 -522
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -185
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +120 -110
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +864 -854
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
- package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -331
- package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
- package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
- package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
- package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
- package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
- package/weapps-plugin-jingtong-verify/utils/request.js +1 -670
- package/weapps-plugin-jingtong-verify/utils/rules.js +301 -405
- package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
- package/weapps-plugin-jingtong-verify/utils/validate.js +772 -910
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.js +0 -41
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.json +0 -4
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxml +0 -20
- package/weapps-plugin-jingtong-verify/components/custom-steps/custom-steps.wxss +0 -112
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.js +0 -73
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.json +0 -4
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxml +0 -19
- package/weapps-plugin-jingtong-verify/components/to-other-modal/to-other-modal.wxss +0 -72
- package/weapps-plugin-jingtong-verify/images/bank-card-verify.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chek_right.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chevron-down.png +0 -0
- package/weapps-plugin-jingtong-verify/images/chevron-up.png +0 -0
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.js +0 -506
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.json +0 -8
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxml +0 -79
- package/weapps-plugin-jingtong-verify/pages/bank-card-login/bank-card-login.wxss +0 -212
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.js +0 -1392
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.json +0 -10
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxml +0 -247
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-face-setting/bank-card-login-forgot-face-setting.wxss +0 -397
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.js +0 -66
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-forgot-sms-setting/bank-card-login-forgot-sms-setting.wxml +0 -2
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.js +0 -463
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.json +0 -8
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxml +0 -69
- package/weapps-plugin-jingtong-verify/pages/bank-card-login-pwd-setting/bank-card-login-pwd-setting.wxss +0 -232
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.js +0 -984
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.json +0 -12
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxml +0 -157
- package/weapps-plugin-jingtong-verify/pages/bank-card-verify/bank-card-verify.wxss +0 -258
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.js +0 -147
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.json +0 -4
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxml +0 -48
- package/weapps-plugin-jingtong-verify/pages/login-help/login-help.wxss +0 -166
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.js +0 -189
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.json +0 -4
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxml +0 -19
- package/weapps-plugin-jingtong-verify/pages/login-manage-setting/login-manage-setting.wxss +0 -69
- package/weapps-plugin-jingtong-verify/utils/constantVal.js +0 -75
- package/weapps-plugin-jingtong-verify/utils/md5.js +0 -184
|
@@ -1,306 +1,306 @@
|
|
|
1
|
-
const validate = require('./validate.js')
|
|
2
|
-
|
|
3
|
-
// 处理异步函数
|
|
4
|
-
export function awaitTo(promise) {
|
|
5
|
-
return promise.then(data => [null, data]).catch(err => [err, undefined])
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// 比对oldObj所有key值对应的value值,在newObj中是否相等
|
|
9
|
-
function objIsEqual(newObj, oldObj) {
|
|
10
|
-
const oldObjKeys = Object.keys(oldObj)
|
|
11
|
-
|
|
12
|
-
for (let key of oldObjKeys) {
|
|
13
|
-
if (oldObj[key] !== newObj[key]) {
|
|
14
|
-
return false
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// 证件号码的脱敏
|
|
22
|
-
// 身份证号默认显示前2位和后2位,其它用*号代替;
|
|
23
|
-
// 其他证件显示前1/3和后1/3段字节,其他用*号代替;
|
|
24
|
-
function hideIdCard(id, cidType) {
|
|
25
|
-
const idCard = validate.removeSpaceFun(id)
|
|
26
|
-
if (!idCard) {
|
|
27
|
-
return idCard
|
|
28
|
-
}
|
|
29
|
-
let digits = cidType === '111' ? 2 : parseInt(idCard.length/3)
|
|
30
|
-
let reg = new RegExp(`(^\\w{${digits}})(\\w+)(\\w{${digits}}$)`, 'g')
|
|
31
|
-
|
|
32
|
-
return idCard.replace(reg, function (...args) {
|
|
33
|
-
let tempStr = ''
|
|
34
|
-
|
|
35
|
-
if (args[2] && args[2].length) {
|
|
36
|
-
for (let i = 0, len = args[2].length; i < len; i++) {
|
|
37
|
-
tempStr += '*'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return args[1] + tempStr + args[3]
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// 姓名脱敏: 显示姓名中的第一个字,其它用*号代替
|
|
46
|
-
function hideName(_name) {
|
|
47
|
-
const name = validate.removeSpaceFun(_name)
|
|
48
|
-
if (!name) {
|
|
49
|
-
return name
|
|
50
|
-
}
|
|
51
|
-
return name.replace(/(^.{1})(.+)$/g, (...args) => {
|
|
52
|
-
let tempStr = '';
|
|
53
|
-
if (args[2] && args[2].length) {
|
|
54
|
-
tempStr = Array.from({
|
|
55
|
-
length: args[2].length + 1,
|
|
56
|
-
}).join('*');
|
|
57
|
-
}
|
|
58
|
-
return args[1] + tempStr;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 银行卡卡号脱敏: 显示前3位+ *(实际位数)+后4位
|
|
63
|
-
function hideBankAccount(bankAccount) {
|
|
64
|
-
let reg = /(\d{3})(\d+)(\d{4})/
|
|
65
|
-
var strLength = bankAccount.match(reg)[2].length;
|
|
66
|
-
let strValue = ''
|
|
67
|
-
for(let i = 0; i < strLength; i++) {
|
|
68
|
-
strValue+='*'
|
|
69
|
-
}
|
|
70
|
-
return bankAccount.replace(reg, "$1" + strValue + "$3")
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 手机号码脱敏: 显示前3位+****+后4位
|
|
74
|
-
function hidePhone(phone) {
|
|
75
|
-
let reg = /(\d{3})\d*(\d{4})/
|
|
76
|
-
return phone ? phone.replace(reg, '$1****$2') : ''
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// 比较版本
|
|
80
|
-
function compareVersion(version1, version2) {
|
|
81
|
-
const v1 = version1.split('.');
|
|
82
|
-
const v2 = version2.split('.');
|
|
83
|
-
const len = Math.max(v1.length, v2.length);
|
|
84
|
-
while (v1.length < len) {
|
|
85
|
-
v1.push('0');
|
|
86
|
-
}
|
|
87
|
-
while (v2.length < len) {
|
|
88
|
-
v2.push('0');
|
|
89
|
-
}
|
|
90
|
-
for (let i = 0; i < len; i++) {
|
|
91
|
-
const num1 = parseInt(v1[i], 10);
|
|
92
|
-
const num2 = parseInt(v2[i], 10);
|
|
93
|
-
if (num1 > num2) {
|
|
94
|
-
return 1;
|
|
95
|
-
}
|
|
96
|
-
else if (num1 < num2) {
|
|
97
|
-
return -1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// 比较两个时间: time1,time2均为日期类型
|
|
104
|
-
// 判断两个时间段是否相差m个月
|
|
105
|
-
function completeDate(time1, m) {
|
|
106
|
-
console.log('判断两个时间段是否相差m个月', time1, m)
|
|
107
|
-
var diffyear = new Date().getFullYear() - time1.getFullYear() ;
|
|
108
|
-
var diffmonth = diffyear * 12 + new Date().getMonth() - time1.getMonth() ;
|
|
109
|
-
if(diffmonth < 0 ){
|
|
110
|
-
return false ;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
var diffDay = new Date().getDate() - time1.getDate() ;
|
|
114
|
-
|
|
115
|
-
if(diffmonth < m || (diffmonth == m && diffDay <= 0)){
|
|
116
|
-
|
|
117
|
-
if(diffmonth == m && diffDay == 0){
|
|
118
|
-
var timeA = time1.getHours()*3600+60*time1.getMinutes()+time1.getSeconds();
|
|
119
|
-
var timeB = new Date().getHours()*3600+60*new Date().getMinutes()+new Date().getSeconds();
|
|
120
|
-
if(timeB-timeA > 0){
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return true ;
|
|
125
|
-
}
|
|
126
|
-
return false ;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 打开线上文件
|
|
131
|
-
* @param {string} url 路径
|
|
132
|
-
* @param {string} fileType 文件类型
|
|
133
|
-
* @param {string} name 文件名
|
|
134
|
-
*/
|
|
135
|
-
function openDoc({ url, fileType, name, successFn }) {
|
|
136
|
-
wx.downloadFile({
|
|
137
|
-
url,
|
|
138
|
-
filePath: wx.env.USER_DATA_PATH + '/' + name + '.pdf',
|
|
139
|
-
success(res) {
|
|
140
|
-
const filePath = res.filePath || res.tempFilePath
|
|
141
|
-
wx.openDocument({
|
|
142
|
-
filePath,
|
|
143
|
-
fileType,
|
|
144
|
-
success: function (res) {
|
|
145
|
-
console.log('打开文档成功', res)
|
|
146
|
-
successFn()
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
},
|
|
150
|
-
fail(err) {
|
|
151
|
-
console.log('打开文档失败', err)
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// 根据身份证号码取性别和年龄
|
|
157
|
-
function parseIDCard(idCard) {
|
|
158
|
-
const len = idCard.length
|
|
159
|
-
let sex = ''
|
|
160
|
-
let yearBirth = ''
|
|
161
|
-
let monthBirth = ''
|
|
162
|
-
let dayBirth = ''
|
|
163
|
-
|
|
164
|
-
if (len === 15) {
|
|
165
|
-
sex = ['2', '1'][idCard.charAt(14) % 2]
|
|
166
|
-
yearBirth = '19' + idCard.substring(6, 8)
|
|
167
|
-
monthBirth = idCard.substring(8, 10)
|
|
168
|
-
dayBirth = idCard.substring(10, 12)
|
|
169
|
-
} else if (len === 18) {
|
|
170
|
-
sex = ['2', '1'][idCard.charAt(16) % 2]
|
|
171
|
-
yearBirth = idCard.substring(6, 10)
|
|
172
|
-
monthBirth = idCard.substring(10, 12)
|
|
173
|
-
dayBirth = idCard.substring(12, 14)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// 获取当前年月日并计算年龄
|
|
177
|
-
const nowDate = new Date()
|
|
178
|
-
const monthNow = nowDate.getMonth() + 1
|
|
179
|
-
const dayNow = nowDate.getDate()
|
|
180
|
-
let age = nowDate.getFullYear() - yearBirth
|
|
181
|
-
|
|
182
|
-
if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
|
|
183
|
-
age--
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
let sexMap = {
|
|
187
|
-
0: '未知',
|
|
188
|
-
1: '男',
|
|
189
|
-
2: '女'
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
age,
|
|
194
|
-
sex,
|
|
195
|
-
sexZh: sexMap[sex]
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 根据出生日期计算年龄
|
|
200
|
-
function birthdayParseAge(birth) {
|
|
201
|
-
if (birth) {
|
|
202
|
-
let birthArr = birth.split('-')
|
|
203
|
-
let yearBirth = birthArr[0]
|
|
204
|
-
let monthBirth = birthArr[1]
|
|
205
|
-
let dayBirth = birthArr[2]
|
|
206
|
-
|
|
207
|
-
// 获取当前年月日并计算年龄
|
|
208
|
-
const nowDate = new Date()
|
|
209
|
-
const monthNow = nowDate.getMonth() + 1
|
|
210
|
-
const dayNow = nowDate.getDate()
|
|
211
|
-
let age = nowDate.getFullYear() - yearBirth
|
|
212
|
-
|
|
213
|
-
if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
|
|
214
|
-
age--
|
|
215
|
-
}
|
|
216
|
-
return age
|
|
217
|
-
} else {
|
|
218
|
-
return ''
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// 判断传入的时间是否大于当前时间
|
|
223
|
-
function greaterCurrentTime(date) {
|
|
224
|
-
const currentTimestamp = new Date().getTime()
|
|
225
|
-
console.log('当前时间', currentTimestamp)
|
|
226
|
-
|
|
227
|
-
date = date.replace(/-/g, "/")
|
|
228
|
-
const time = `${date} 23:59:00`
|
|
229
|
-
let timestamp = Math.floor(Date.parse(time));
|
|
230
|
-
console.log('传入的时间', timestamp);
|
|
231
|
-
|
|
232
|
-
if (timestamp > 0 && timestamp > currentTimestamp) {
|
|
233
|
-
return true
|
|
234
|
-
}
|
|
235
|
-
return false
|
|
236
|
-
|
|
237
|
-
// const timeDiff = Math.abs(currentDate.getTime() - date1.getTime());
|
|
238
|
-
// const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
|
239
|
-
// return daysDiff;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const formatNumber = n => {
|
|
243
|
-
n = n.toString()
|
|
244
|
-
return n[1] ? n : '0' + n
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// 获取当前时间 yyyy-MM-dd HH:mm:ss
|
|
248
|
-
function getCurrentTime() {
|
|
249
|
-
const date = new Date()
|
|
250
|
-
const year = date.getFullYear()
|
|
251
|
-
const month = date.getMonth() + 1
|
|
252
|
-
const day = date.getDate()
|
|
253
|
-
const hour = date.getHours()
|
|
254
|
-
const minute = date.getMinutes()
|
|
255
|
-
const second = date.getSeconds()
|
|
256
|
-
|
|
257
|
-
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// 获取当前日期 yyyy-MM-dd
|
|
261
|
-
function getCurrentDate() {
|
|
262
|
-
const date = new Date()
|
|
263
|
-
const year = date.getFullYear()
|
|
264
|
-
const month = date.getMonth() + 1
|
|
265
|
-
const day = date.getDate()
|
|
266
|
-
|
|
267
|
-
return [year, month, day].map(formatNumber).join('-')
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// 根据身份证号码获取出生日期 yyyy-MM-dd
|
|
271
|
-
function getBirthByIDCard(idCard) {
|
|
272
|
-
const len = idCard.length
|
|
273
|
-
let yearBirth = ''
|
|
274
|
-
let monthBirth = ''
|
|
275
|
-
let dayBirth = ''
|
|
276
|
-
|
|
277
|
-
if (len === 15) {
|
|
278
|
-
yearBirth = '19' + idCard.substring(6, 8)
|
|
279
|
-
monthBirth = idCard.substring(8, 10)
|
|
280
|
-
dayBirth = idCard.substring(10, 12)
|
|
281
|
-
} else if (len === 18) {
|
|
282
|
-
yearBirth = idCard.substring(6, 10)
|
|
283
|
-
monthBirth = idCard.substring(10, 12)
|
|
284
|
-
dayBirth = idCard.substring(12, 14)
|
|
285
|
-
}
|
|
286
|
-
return `${yearBirth}-${monthBirth}-${dayBirth}`
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
module.exports = {
|
|
290
|
-
validate,
|
|
291
|
-
awaitTo,
|
|
292
|
-
objIsEqual,
|
|
293
|
-
hideIdCard,
|
|
294
|
-
hideName,
|
|
295
|
-
hideBankAccount,
|
|
296
|
-
hidePhone,
|
|
297
|
-
compareVersion,
|
|
298
|
-
completeDate,
|
|
299
|
-
openDoc,
|
|
300
|
-
parseIDCard,
|
|
301
|
-
birthdayParseAge,
|
|
302
|
-
greaterCurrentTime,
|
|
303
|
-
getCurrentTime,
|
|
304
|
-
getBirthByIDCard,
|
|
305
|
-
getCurrentDate
|
|
306
|
-
}
|
|
1
|
+
const validate = require('./validate.js')
|
|
2
|
+
|
|
3
|
+
// 处理异步函数
|
|
4
|
+
export function awaitTo(promise) {
|
|
5
|
+
return promise.then(data => [null, data]).catch(err => [err, undefined])
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// 比对oldObj所有key值对应的value值,在newObj中是否相等
|
|
9
|
+
function objIsEqual(newObj, oldObj) {
|
|
10
|
+
const oldObjKeys = Object.keys(oldObj)
|
|
11
|
+
|
|
12
|
+
for (let key of oldObjKeys) {
|
|
13
|
+
if (oldObj[key] !== newObj[key]) {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 证件号码的脱敏
|
|
22
|
+
// 身份证号默认显示前2位和后2位,其它用*号代替;
|
|
23
|
+
// 其他证件显示前1/3和后1/3段字节,其他用*号代替;
|
|
24
|
+
function hideIdCard(id, cidType) {
|
|
25
|
+
const idCard = validate.removeSpaceFun(id)
|
|
26
|
+
if (!idCard) {
|
|
27
|
+
return idCard
|
|
28
|
+
}
|
|
29
|
+
let digits = cidType === '111' ? 2 : parseInt(idCard.length/3)
|
|
30
|
+
let reg = new RegExp(`(^\\w{${digits}})(\\w+)(\\w{${digits}}$)`, 'g')
|
|
31
|
+
|
|
32
|
+
return idCard.replace(reg, function (...args) {
|
|
33
|
+
let tempStr = ''
|
|
34
|
+
|
|
35
|
+
if (args[2] && args[2].length) {
|
|
36
|
+
for (let i = 0, len = args[2].length; i < len; i++) {
|
|
37
|
+
tempStr += '*'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return args[1] + tempStr + args[3]
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 姓名脱敏: 显示姓名中的第一个字,其它用*号代替
|
|
46
|
+
function hideName(_name) {
|
|
47
|
+
const name = validate.removeSpaceFun(_name)
|
|
48
|
+
if (!name) {
|
|
49
|
+
return name
|
|
50
|
+
}
|
|
51
|
+
return name.replace(/(^.{1})(.+)$/g, (...args) => {
|
|
52
|
+
let tempStr = '';
|
|
53
|
+
if (args[2] && args[2].length) {
|
|
54
|
+
tempStr = Array.from({
|
|
55
|
+
length: args[2].length + 1,
|
|
56
|
+
}).join('*');
|
|
57
|
+
}
|
|
58
|
+
return args[1] + tempStr;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 银行卡卡号脱敏: 显示前3位+ *(实际位数)+后4位
|
|
63
|
+
function hideBankAccount(bankAccount) {
|
|
64
|
+
let reg = /(\d{3})(\d+)(\d{4})/
|
|
65
|
+
var strLength = bankAccount.match(reg)[2].length;
|
|
66
|
+
let strValue = ''
|
|
67
|
+
for(let i = 0; i < strLength; i++) {
|
|
68
|
+
strValue+='*'
|
|
69
|
+
}
|
|
70
|
+
return bankAccount.replace(reg, "$1" + strValue + "$3")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 手机号码脱敏: 显示前3位+****+后4位
|
|
74
|
+
function hidePhone(phone) {
|
|
75
|
+
let reg = /(\d{3})\d*(\d{4})/
|
|
76
|
+
return phone ? phone.replace(reg, '$1****$2') : ''
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 比较版本
|
|
80
|
+
function compareVersion(version1, version2) {
|
|
81
|
+
const v1 = version1.split('.');
|
|
82
|
+
const v2 = version2.split('.');
|
|
83
|
+
const len = Math.max(v1.length, v2.length);
|
|
84
|
+
while (v1.length < len) {
|
|
85
|
+
v1.push('0');
|
|
86
|
+
}
|
|
87
|
+
while (v2.length < len) {
|
|
88
|
+
v2.push('0');
|
|
89
|
+
}
|
|
90
|
+
for (let i = 0; i < len; i++) {
|
|
91
|
+
const num1 = parseInt(v1[i], 10);
|
|
92
|
+
const num2 = parseInt(v2[i], 10);
|
|
93
|
+
if (num1 > num2) {
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
else if (num1 < num2) {
|
|
97
|
+
return -1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 比较两个时间: time1,time2均为日期类型
|
|
104
|
+
// 判断两个时间段是否相差m个月
|
|
105
|
+
function completeDate(time1, m) {
|
|
106
|
+
console.log('判断两个时间段是否相差m个月', time1, m)
|
|
107
|
+
var diffyear = new Date().getFullYear() - time1.getFullYear() ;
|
|
108
|
+
var diffmonth = diffyear * 12 + new Date().getMonth() - time1.getMonth() ;
|
|
109
|
+
if(diffmonth < 0 ){
|
|
110
|
+
return false ;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var diffDay = new Date().getDate() - time1.getDate() ;
|
|
114
|
+
|
|
115
|
+
if(diffmonth < m || (diffmonth == m && diffDay <= 0)){
|
|
116
|
+
|
|
117
|
+
if(diffmonth == m && diffDay == 0){
|
|
118
|
+
var timeA = time1.getHours()*3600+60*time1.getMinutes()+time1.getSeconds();
|
|
119
|
+
var timeB = new Date().getHours()*3600+60*new Date().getMinutes()+new Date().getSeconds();
|
|
120
|
+
if(timeB-timeA > 0){
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return true ;
|
|
125
|
+
}
|
|
126
|
+
return false ;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 打开线上文件
|
|
131
|
+
* @param {string} url 路径
|
|
132
|
+
* @param {string} fileType 文件类型
|
|
133
|
+
* @param {string} name 文件名
|
|
134
|
+
*/
|
|
135
|
+
function openDoc({ url, fileType, name, successFn }) {
|
|
136
|
+
wx.downloadFile({
|
|
137
|
+
url,
|
|
138
|
+
filePath: wx.env.USER_DATA_PATH + '/' + name + '.pdf',
|
|
139
|
+
success(res) {
|
|
140
|
+
const filePath = res.filePath || res.tempFilePath
|
|
141
|
+
wx.openDocument({
|
|
142
|
+
filePath,
|
|
143
|
+
fileType,
|
|
144
|
+
success: function (res) {
|
|
145
|
+
console.log('打开文档成功', res)
|
|
146
|
+
successFn()
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
fail(err) {
|
|
151
|
+
console.log('打开文档失败', err)
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 根据身份证号码取性别和年龄
|
|
157
|
+
function parseIDCard(idCard) {
|
|
158
|
+
const len = idCard.length
|
|
159
|
+
let sex = ''
|
|
160
|
+
let yearBirth = ''
|
|
161
|
+
let monthBirth = ''
|
|
162
|
+
let dayBirth = ''
|
|
163
|
+
|
|
164
|
+
if (len === 15) {
|
|
165
|
+
sex = ['2', '1'][idCard.charAt(14) % 2]
|
|
166
|
+
yearBirth = '19' + idCard.substring(6, 8)
|
|
167
|
+
monthBirth = idCard.substring(8, 10)
|
|
168
|
+
dayBirth = idCard.substring(10, 12)
|
|
169
|
+
} else if (len === 18) {
|
|
170
|
+
sex = ['2', '1'][idCard.charAt(16) % 2]
|
|
171
|
+
yearBirth = idCard.substring(6, 10)
|
|
172
|
+
monthBirth = idCard.substring(10, 12)
|
|
173
|
+
dayBirth = idCard.substring(12, 14)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 获取当前年月日并计算年龄
|
|
177
|
+
const nowDate = new Date()
|
|
178
|
+
const monthNow = nowDate.getMonth() + 1
|
|
179
|
+
const dayNow = nowDate.getDate()
|
|
180
|
+
let age = nowDate.getFullYear() - yearBirth
|
|
181
|
+
|
|
182
|
+
if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
|
|
183
|
+
age--
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
let sexMap = {
|
|
187
|
+
0: '未知',
|
|
188
|
+
1: '男',
|
|
189
|
+
2: '女'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
age,
|
|
194
|
+
sex,
|
|
195
|
+
sexZh: sexMap[sex]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 根据出生日期计算年龄
|
|
200
|
+
function birthdayParseAge(birth) {
|
|
201
|
+
if (birth) {
|
|
202
|
+
let birthArr = birth.split('-')
|
|
203
|
+
let yearBirth = birthArr[0]
|
|
204
|
+
let monthBirth = birthArr[1]
|
|
205
|
+
let dayBirth = birthArr[2]
|
|
206
|
+
|
|
207
|
+
// 获取当前年月日并计算年龄
|
|
208
|
+
const nowDate = new Date()
|
|
209
|
+
const monthNow = nowDate.getMonth() + 1
|
|
210
|
+
const dayNow = nowDate.getDate()
|
|
211
|
+
let age = nowDate.getFullYear() - yearBirth
|
|
212
|
+
|
|
213
|
+
if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
|
|
214
|
+
age--
|
|
215
|
+
}
|
|
216
|
+
return age
|
|
217
|
+
} else {
|
|
218
|
+
return ''
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 判断传入的时间是否大于当前时间
|
|
223
|
+
function greaterCurrentTime(date) {
|
|
224
|
+
const currentTimestamp = new Date().getTime()
|
|
225
|
+
console.log('当前时间', currentTimestamp)
|
|
226
|
+
|
|
227
|
+
date = date.replace(/-/g, "/")
|
|
228
|
+
const time = `${date} 23:59:00`
|
|
229
|
+
let timestamp = Math.floor(Date.parse(time));
|
|
230
|
+
console.log('传入的时间', timestamp);
|
|
231
|
+
|
|
232
|
+
if (timestamp > 0 && timestamp > currentTimestamp) {
|
|
233
|
+
return true
|
|
234
|
+
}
|
|
235
|
+
return false
|
|
236
|
+
|
|
237
|
+
// const timeDiff = Math.abs(currentDate.getTime() - date1.getTime());
|
|
238
|
+
// const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
|
239
|
+
// return daysDiff;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const formatNumber = n => {
|
|
243
|
+
n = n.toString()
|
|
244
|
+
return n[1] ? n : '0' + n
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// 获取当前时间 yyyy-MM-dd HH:mm:ss
|
|
248
|
+
function getCurrentTime() {
|
|
249
|
+
const date = new Date()
|
|
250
|
+
const year = date.getFullYear()
|
|
251
|
+
const month = date.getMonth() + 1
|
|
252
|
+
const day = date.getDate()
|
|
253
|
+
const hour = date.getHours()
|
|
254
|
+
const minute = date.getMinutes()
|
|
255
|
+
const second = date.getSeconds()
|
|
256
|
+
|
|
257
|
+
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// 获取当前日期 yyyy-MM-dd
|
|
261
|
+
function getCurrentDate() {
|
|
262
|
+
const date = new Date()
|
|
263
|
+
const year = date.getFullYear()
|
|
264
|
+
const month = date.getMonth() + 1
|
|
265
|
+
const day = date.getDate()
|
|
266
|
+
|
|
267
|
+
return [year, month, day].map(formatNumber).join('-')
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 根据身份证号码获取出生日期 yyyy-MM-dd
|
|
271
|
+
function getBirthByIDCard(idCard) {
|
|
272
|
+
const len = idCard.length
|
|
273
|
+
let yearBirth = ''
|
|
274
|
+
let monthBirth = ''
|
|
275
|
+
let dayBirth = ''
|
|
276
|
+
|
|
277
|
+
if (len === 15) {
|
|
278
|
+
yearBirth = '19' + idCard.substring(6, 8)
|
|
279
|
+
monthBirth = idCard.substring(8, 10)
|
|
280
|
+
dayBirth = idCard.substring(10, 12)
|
|
281
|
+
} else if (len === 18) {
|
|
282
|
+
yearBirth = idCard.substring(6, 10)
|
|
283
|
+
monthBirth = idCard.substring(10, 12)
|
|
284
|
+
dayBirth = idCard.substring(12, 14)
|
|
285
|
+
}
|
|
286
|
+
return `${yearBirth}-${monthBirth}-${dayBirth}`
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
module.exports = {
|
|
290
|
+
validate,
|
|
291
|
+
awaitTo,
|
|
292
|
+
objIsEqual,
|
|
293
|
+
hideIdCard,
|
|
294
|
+
hideName,
|
|
295
|
+
hideBankAccount,
|
|
296
|
+
hidePhone,
|
|
297
|
+
compareVersion,
|
|
298
|
+
completeDate,
|
|
299
|
+
openDoc,
|
|
300
|
+
parseIDCard,
|
|
301
|
+
birthdayParseAge,
|
|
302
|
+
greaterCurrentTime,
|
|
303
|
+
getCurrentTime,
|
|
304
|
+
getBirthByIDCard,
|
|
305
|
+
getCurrentDate
|
|
306
|
+
}
|