@10yun/cv-mobile-ui 0.5.29 → 0.5.30
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/package.json +1 -1
- package/plugins/luch-request/adapters/index.js +131 -0
- package/plugins/luch-request/core/InterceptorManager.js +50 -0
- package/plugins/luch-request/core/Request.js +199 -0
- package/plugins/luch-request/core/buildFullPath.js +20 -0
- package/plugins/luch-request/core/defaults.js +32 -0
- package/plugins/luch-request/core/dispatchRequest.js +5 -0
- package/plugins/luch-request/core/mergeConfig.js +125 -0
- package/plugins/luch-request/core/settle.js +16 -0
- package/plugins/luch-request/helpers/buildURL.js +71 -0
- package/plugins/luch-request/helpers/combineURLs.js +12 -0
- package/plugins/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/plugins/luch-request/index.d.ts +197 -0
- package/plugins/luch-request/index.js +2 -0
- package/plugins/luch-request/readme.md +3 -0
- package/plugins/luch-request/utils/clone.js +264 -0
- package/plugins/luch-request/utils.js +131 -0
- package/plugins/request.js +2 -2
- package/ui-cv/components/cv-form-item/cv-form-item.vue +1 -1
- package/ui-fireui/fui-actionsheet/fui-actionsheet.vue +202 -0
- package/ui-fireui/fui-alert/fui-alert.vue +141 -0
- package/ui-fireui/fui-badge/fui-badge.vue +158 -0
- package/ui-fireui/fui-bottom-navigation/fui-bottom-navigation.vue +390 -0
- package/ui-fireui/fui-bottom-popup/fui-bottom-popup.vue +100 -0
- package/ui-fireui/fui-bubble-popup/fui-bubble-popup.vue +236 -0
- package/ui-fireui/fui-button/fui-button.vue +424 -0
- package/ui-fireui/fui-calendar/fui-calendar.js +915 -0
- package/ui-fireui/fui-calendar/fui-calendar.vue +868 -0
- package/ui-fireui/fui-card/fui-card.vue +231 -0
- package/ui-fireui/fui-cascade-selection/fui-cascade-selection.vue +538 -0
- package/ui-fireui/fui-circular-progress/fui-circular-progress.vue +261 -0
- package/ui-fireui/fui-collapse/fui-collapse.vue +179 -0
- package/ui-fireui/fui-countdown/fui-countdown.vue +301 -0
- package/ui-fireui/fui-datetime/fui-datetime.vue +570 -0
- package/ui-fireui/fui-divider/fui-divider.vue +118 -0
- package/ui-fireui/fui-drawer/fui-drawer.vue +103 -0
- package/ui-fireui/fui-dropdown-list/fui-dropdown-list.vue +70 -0
- package/ui-fireui/fui-fab/fui-fab.vue +284 -0
- package/ui-fireui/fui-footer/fui-footer.vue +131 -0
- package/ui-fireui/fui-grid/fui-grid.vue +42 -0
- package/ui-fireui/fui-grid-item/fui-grid-item.vue +142 -0
- package/ui-fireui/fui-icon/fui-icon.vue +820 -0
- package/ui-fireui/fui-image-cropper/fui-image-cropper.vue +1058 -0
- package/ui-fireui/fui-image-group/fui-image-group.vue +149 -0
- package/ui-fireui/fui-keyboard/fui-keyboard.vue +254 -0
- package/ui-fireui/fui-keyboard-input/fui-keyboard-input.vue +78 -0
- package/ui-fireui/fui-list-cell/fui-list-cell.vue +178 -0
- package/ui-fireui/fui-list-view/fui-list-view.vue +87 -0
- package/ui-fireui/fui-loading/fui-loading.vue +78 -0
- package/ui-fireui/fui-loadmore/fui-loadmore.vue +163 -0
- package/ui-fireui/fui-modal/fui-modal.vue +392 -0
- package/ui-fireui/fui-navigation-bar/fui-navigation-bar.vue +180 -0
- package/ui-fireui/fui-no-data/fui-no-data.vue +116 -0
- package/ui-fireui/fui-nomore/fui-nomore.vue +116 -0
- package/ui-fireui/fui-numberbox/fui-numberbox.vue +234 -0
- package/ui-fireui/fui-numberbox-border/fui-numberbox-border.vue +232 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.vue +682 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.wxs +560 -0
- package/ui-fireui/fui-rate/fui-rate.vue +167 -0
- package/ui-fireui/fui-round-progress/fui-round-progress.vue +306 -0
- package/ui-fireui/fui-scroll-top/fui-scroll-top.vue +189 -0
- package/ui-fireui/fui-sharemodel/fui-sharemodel.vue +181 -0
- package/ui-fireui/fui-skeleton/fui-skeleton.vue +248 -0
- package/ui-fireui/fui-steps/fui-steps.vue +214 -0
- package/ui-fireui/fui-sticky/fui-sticky.vue +155 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky-wxs.vue +133 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky.wxs +44 -0
- package/ui-fireui/fui-swipe-action/fui-swipe-action.vue +301 -0
- package/ui-fireui/fui-tabbar/fui-tabbar.vue +283 -0
- package/ui-fireui/fui-tabs/fui-tabs.vue +284 -0
- package/ui-fireui/fui-tabs2/fui-tabs2.vue +284 -0
- package/ui-fireui/fui-tag/fui-tag.vue +374 -0
- package/ui-fireui/fui-time-axis/fui-time-axis.vue +36 -0
- package/ui-fireui/fui-timeaxis-item/fui-timeaxis-item.vue +48 -0
- package/ui-fireui/fui-tips/fui-tips.vue +161 -0
- package/ui-fireui/fui-toast/fui-toast.vue +117 -0
- package/ui-fireui/fui-top-dropdown/fui-top-dropdown.vue +129 -0
- package/ui-fireui/fui-upload/fui-upload.vue +446 -0
- package/ui-fireui/fui-uploadsamll/fui-uploadsamll.vue +472 -0
- package/uview-plus/README.md +1 -1
- package/uview-plus/changelog-wu-tool.md +21 -0
- package/uview-plus/changelog-wu.md +91 -0
- package/uview-plus/components/u-action-sheet/_doc/changelog.md +12 -0
- package/uview-plus/components/u-action-sheet/_doc/package.json +92 -0
- package/uview-plus/components/u-action-sheet/_doc/readme.md +16 -0
- package/uview-plus/components/u-app-update/_doc/changelog.md +26 -0
- package/uview-plus/components/u-app-update/_doc/package.json +89 -0
- package/uview-plus/components/u-app-update/_doc/readme.md +16 -0
- package/uview-plus/components/u-app-update/config.js +120 -0
- package/uview-plus/components/u-app-update/img/act.png +0 -0
- package/uview-plus/components/u-app-update/img/appUploadAlertBoxBg.png +0 -0
- package/uview-plus/components/u-app-update/img/close.png +0 -0
- package/uview-plus/components/u-app-update/js-sdk/checkVersion.js +81 -0
- package/uview-plus/components/u-app-update/js-sdk/silentlyAppUpdate.js +41 -0
- package/uview-plus/components/u-app-update/pages/index.vue +8 -0
- package/uview-plus/components/u-app-update/u-app-update.vue +583 -0
- package/uview-plus/components/u-button-wu/_doc/changelog.md +6 -0
- package/uview-plus/components/u-button-wu/_doc/package.json +89 -0
- package/uview-plus/components/u-button-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-button-wu/u-button-wu.vue +522 -0
- package/uview-plus/components/u-button-wu/vue.scss +81 -0
- package/uview-plus/components/u-calendar-wu/_doc/changelog.md +145 -0
- package/uview-plus/components/u-calendar-wu/_doc/package.json +90 -0
- package/uview-plus/components/u-calendar-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-calendar-wu/calendar.js +664 -0
- package/uview-plus/components/u-calendar-wu/i18n/en.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/index.js +8 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hans.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hant.json +14 -0
- package/uview-plus/components/u-calendar-wu/props.js +166 -0
- package/uview-plus/components/u-calendar-wu/style.css +196 -0
- package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +921 -0
- package/uview-plus/components/u-calendar-wu/util.js +552 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/props.js +73 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/wu-calendar-block.vue +122 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/props.js +55 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/wu-calendar-item.vue +293 -0
- package/uview-plus/components/u-cell/_doc/changelog.md +6 -0
- package/uview-plus/components/u-cell/_doc/package.json +89 -0
- package/uview-plus/components/u-cell/_doc/readme.md +25 -0
- package/uview-plus/components/u-checkbox/_doc/changelog.md +8 -0
- package/uview-plus/components/u-checkbox/_doc/package.json +88 -0
- package/uview-plus/components/u-checkbox/_doc/readme.md +25 -0
- package/uview-plus/components/u-code/_doc/changelog.md +6 -0
- package/uview-plus/components/u-code/_doc/package.json +86 -0
- package/uview-plus/components/u-code/_doc/readme.md +16 -0
- package/uview-plus/components/u-drag-sort/_doc/changelog.md +0 -0
- package/uview-plus/components/u-drag-sort/_doc/package.json +85 -0
- package/uview-plus/components/u-drag-sort/_doc/readme.md +16 -0
- package/uview-plus/components/u-drag-sort/u-drag-sort.vue +3 -0
- package/uview-plus/components/u-empty/u-empty.vue +27 -1
- package/uview-plus/components/u-gap/_doc/changelog.md +4 -0
- package/uview-plus/components/u-gap/_doc/package.json +86 -0
- package/uview-plus/components/u-gap/_doc/readme.md +22 -0
- package/uview-plus/components/u-icon/_doc/changelog.md +10 -0
- package/uview-plus/components/u-icon/_doc/package.json +85 -0
- package/uview-plus/components/u-icon/_doc/readme.md +10 -0
- package/uview-plus/components/u-icon/icon.js +23 -25
- package/uview-plus/components/u-icon/icons.js +213 -213
- package/uview-plus/components/u-icon/style.css +3 -3
- package/uview-plus/components/u-icon/u-icon2.vue +149 -0
- package/uview-plus/components/u-image-wu/_doc/changelog.md +21 -0
- package/uview-plus/components/u-image-wu/_doc/package.json +88 -0
- package/uview-plus/components/u-image-wu/_doc/readme.md +11 -0
- package/uview-plus/components/u-image-wu/props.js +94 -0
- package/uview-plus/components/u-image-wu/u-image-wu.vue +243 -0
- package/uview-plus/components/u-input/_doc/changelog.md +6 -0
- package/uview-plus/components/u-input/_doc/package.json +88 -0
- package/uview-plus/components/u-input/_doc/readme.md +16 -0
- package/uview-plus/components/u-line/_doc/changelog.md +8 -0
- package/uview-plus/components/u-line/_doc/package.json +86 -0
- package/uview-plus/components/u-line/_doc/readme.md +16 -0
- package/uview-plus/components/u-link/_doc/changelog.md +8 -0
- package/uview-plus/components/u-link/_doc/package.json +86 -0
- package/uview-plus/components/u-link/_doc/readme.md +20 -0
- package/uview-plus/components/u-loading-icon/_doc/changelog.md +12 -0
- package/uview-plus/components/u-loading-icon/_doc/package.json +86 -0
- package/uview-plus/components/u-loading-icon/_doc/readme.md +16 -0
- package/uview-plus/components/u-loading-icon/props.js +1 -1
- package/uview-plus/components/u-navbar/_doc/changelog.md +6 -0
- package/uview-plus/components/u-navbar/_doc/package.json +89 -0
- package/uview-plus/components/u-navbar/_doc/readme.md +16 -0
- package/uview-plus/components/u-navbar-wu/props.js +102 -0
- package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +196 -0
- package/uview-plus/components/u-number-box/_doc/changelog.md +19 -0
- package/uview-plus/components/u-number-box/_doc/package.json +88 -0
- package/uview-plus/components/u-number-box/_doc/readme.md +16 -0
- package/uview-plus/components/u-overlay/_doc/changelog.md +4 -0
- package/uview-plus/components/u-overlay/_doc/package.json +88 -0
- package/uview-plus/components/u-overlay/_doc/readme.md +16 -0
- package/uview-plus/components/u-popup/_doc/changelog.md +4 -0
- package/uview-plus/components/u-popup/_doc/package.json +92 -0
- package/uview-plus/components/u-popup/_doc/readme.md +16 -0
- package/uview-plus/components/u-popup-wu/keypress.js +45 -0
- package/uview-plus/components/u-popup-wu/u-popup-wu.vue +519 -0
- package/uview-plus/components/u-radio/_doc/changelog.md +6 -0
- package/uview-plus/components/u-radio/_doc/package.json +88 -0
- package/uview-plus/components/u-radio/_doc/readme.md +25 -0
- package/uview-plus/components/u-row/_doc/changelog.md +8 -0
- package/uview-plus/components/u-row/_doc/package.json +86 -0
- package/uview-plus/components/u-row/_doc/readme.md +16 -0
- package/uview-plus/components/u-safe-bottom/_doc/changelog.md +6 -0
- package/uview-plus/components/u-safe-bottom/_doc/package.json +86 -0
- package/uview-plus/components/u-safe-bottom/_doc/readme.md +16 -0
- package/uview-plus/components/u-sku-wu/_doc/changelog.md +27 -0
- package/uview-plus/components/u-sku-wu/_doc/package.json +93 -0
- package/uview-plus/components/u-sku-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-sku-wu/props.js +86 -0
- package/uview-plus/components/u-sku-wu/style.css +271 -0
- package/uview-plus/components/u-sku-wu/u-sku-wu.vue +864 -0
- package/uview-plus/components/u-status-bar/_doc/changelog.md +4 -0
- package/uview-plus/components/u-status-bar/_doc/package.json +86 -0
- package/uview-plus/components/u-status-bar/_doc/readme.md +16 -0
- package/uview-plus/components/u-text/_doc/changelog.md +10 -0
- package/uview-plus/components/u-text/_doc/package.json +89 -0
- package/uview-plus/components/u-text/_doc/readme.md +20 -0
- package/uview-plus/components/u-textarea/_doc/changelog.md +6 -0
- package/uview-plus/components/u-textarea/_doc/package.json +86 -0
- package/uview-plus/components/u-textarea/_doc/readme.md +25 -0
- package/uview-plus/components/u-transition/_doc/changelog.md +14 -0
- package/uview-plus/components/u-transition/_doc/package.json +86 -0
- package/uview-plus/components/u-transition/_doc/readme.md +16 -0
- package/uview-plus/components/u-transition-wu/createAnimation.js +148 -0
- package/uview-plus/components/u-transition-wu/props.js +32 -0
- package/uview-plus/components/u-transition-wu/u-transition.vue +300 -0
- package/uview-plus/components/u-verification-code/u-verification-code.vue +161 -0
- package/uview-plus/index.js +107 -94
- package/uview-plus/libs/config/config.js +46 -48
- package/uview-plus/libs/css/color.scss +32 -311
- package/uview-plus/libs/css/components-wu.scss +30 -0
- package/uview-plus/libs/css/vue.scss +10 -10
- package/uview-plus/libs/function/calc.js +61 -55
- package/uview-plus/libs/function/cc.js +66 -0
- package/uview-plus/libs/function/color/color-convert/CHANGELOG.md +54 -0
- package/uview-plus/libs/function/color/color-convert/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-convert/README.md +68 -0
- package/uview-plus/libs/function/color/color-convert/conversions.js +839 -0
- package/uview-plus/libs/function/color/color-convert/index.js +81 -0
- package/uview-plus/libs/function/color/color-convert/package.json +48 -0
- package/uview-plus/libs/function/color/color-convert/route.js +97 -0
- package/uview-plus/libs/function/color/color-name/LICENSE +8 -0
- package/uview-plus/libs/function/color/color-name/README.md +11 -0
- package/uview-plus/libs/function/color/color-name/index.js +152 -0
- package/uview-plus/libs/function/color/color-name/package.json +28 -0
- package/uview-plus/libs/function/color/color-string/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-string/README.md +62 -0
- package/uview-plus/libs/function/color/color-string/index.js +244 -0
- package/uview-plus/libs/function/color/color-string/package.json +39 -0
- package/uview-plus/libs/function/color/color.js +496 -0
- package/uview-plus/libs/function/color/index.js +158 -0
- package/uview-plus/libs/function/color/is-arrayish/LICENSE +21 -0
- package/uview-plus/libs/function/color/is-arrayish/README.md +16 -0
- package/uview-plus/libs/function/color/is-arrayish/index.js +9 -0
- package/uview-plus/libs/function/color/is-arrayish/package.json +45 -0
- package/uview-plus/libs/function/color/is-arrayish/yarn-error.log +1443 -0
- package/uview-plus/libs/function/color/simple-swizzle/LICENSE +21 -0
- package/uview-plus/libs/function/color/simple-swizzle/README.md +39 -0
- package/uview-plus/libs/function/color/simple-swizzle/index.js +29 -0
- package/uview-plus/libs/function/color/simple-swizzle/package.json +36 -0
- package/uview-plus/libs/function/colorGradient.js +108 -106
- package/uview-plus/libs/function/debounce.js +17 -17
- package/uview-plus/libs/function/digit.js +1 -3
- package/uview-plus/libs/function/http.js +3 -3
- package/uview-plus/libs/function/index-wu.js +231 -0
- package/uview-plus/libs/function/index.js +579 -566
- package/uview-plus/libs/function/platform.js +18 -18
- package/uview-plus/libs/function/test.js +135 -137
- package/uview-plus/libs/function/throttle.js +17 -17
- package/uview-plus/libs/luch-request/core/Request.js +199 -199
- package/uview-plus/libs/mixin/mpMixin.js +1 -0
- package/uview-plus/libs/mixin/openType.js +33 -0
- package/uview-plus/libs/util/async-validator.js +1343 -1343
- package/uview-plus/libs/util/dayjs.js +404 -0
- package/uview-plus/libs/util/route.js +101 -105
- package/uview-plus/package-wu-tool.json +84 -0
- package/uview-plus/package-wu.json +112 -0
- package/uview-plus/package.json +106 -95
- package/uview-plus/readme-wu.md +148 -0
- package/uview-ui/index.js +51 -52
- package/plugins/uni-upgrade.js +0 -294
|
@@ -6,70 +6,70 @@
|
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
let platform = 'none'
|
|
9
|
+
let platform = 'none';
|
|
10
10
|
|
|
11
11
|
// #ifdef VUE3
|
|
12
|
-
platform = 'vue3'
|
|
12
|
+
platform = 'vue3';
|
|
13
13
|
// #endif
|
|
14
14
|
|
|
15
15
|
// #ifdef VUE2
|
|
16
|
-
platform = 'vue2'
|
|
16
|
+
platform = 'vue2';
|
|
17
17
|
// #endif
|
|
18
18
|
|
|
19
19
|
// #ifdef APP-PLUS
|
|
20
|
-
platform = 'plus'
|
|
20
|
+
platform = 'plus';
|
|
21
21
|
// #endif
|
|
22
22
|
|
|
23
23
|
// #ifdef APP-NVUE
|
|
24
|
-
platform = 'nvue'
|
|
24
|
+
platform = 'nvue';
|
|
25
25
|
// #endif
|
|
26
26
|
|
|
27
27
|
// #ifdef H5
|
|
28
|
-
platform = 'h5'
|
|
28
|
+
platform = 'h5';
|
|
29
29
|
// #endif
|
|
30
30
|
|
|
31
31
|
// #ifdef MP
|
|
32
|
-
platform = 'mp'
|
|
32
|
+
platform = 'mp';
|
|
33
33
|
// #endif
|
|
34
34
|
|
|
35
35
|
// #ifdef MP-WEIXIN
|
|
36
|
-
platform = 'weixin'
|
|
36
|
+
platform = 'weixin';
|
|
37
37
|
// #endif
|
|
38
38
|
|
|
39
39
|
// #ifdef MP-ALIPAY
|
|
40
|
-
platform = 'alipay'
|
|
40
|
+
platform = 'alipay';
|
|
41
41
|
// #endif
|
|
42
42
|
|
|
43
43
|
// #ifdef MP-BAIDU
|
|
44
|
-
platform = 'baidu'
|
|
44
|
+
platform = 'baidu';
|
|
45
45
|
// #endif
|
|
46
46
|
|
|
47
47
|
// #ifdef MP-TOUTIAO
|
|
48
|
-
platform = 'toutiao'
|
|
48
|
+
platform = 'toutiao';
|
|
49
49
|
// #endif
|
|
50
50
|
|
|
51
51
|
// #ifdef MP-QQ
|
|
52
|
-
platform = 'qq'
|
|
52
|
+
platform = 'qq';
|
|
53
53
|
// #endif
|
|
54
54
|
|
|
55
55
|
// #ifdef MP-KUAISHOU
|
|
56
|
-
platform = 'kuaishou'
|
|
56
|
+
platform = 'kuaishou';
|
|
57
57
|
// #endif
|
|
58
58
|
|
|
59
59
|
// #ifdef MP-360
|
|
60
|
-
platform = '360'
|
|
60
|
+
platform = '360';
|
|
61
61
|
// #endif
|
|
62
62
|
|
|
63
63
|
// #ifdef QUICKAPP-WEBVIEW
|
|
64
|
-
platform = 'quickapp-webview'
|
|
64
|
+
platform = 'quickapp-webview';
|
|
65
65
|
// #endif
|
|
66
66
|
|
|
67
67
|
// #ifdef QUICKAPP-WEBVIEW-HUAWEI
|
|
68
|
-
platform = 'quickapp-webview-huawei'
|
|
68
|
+
platform = 'quickapp-webview-huawei';
|
|
69
69
|
// #endif
|
|
70
70
|
|
|
71
71
|
// #ifdef QUICKAPP-WEBVIEW-UNION
|
|
72
|
-
platform = 'quckapp-webview-union'
|
|
72
|
+
platform = 'quckapp-webview-union';
|
|
73
73
|
// #endif
|
|
74
74
|
|
|
75
|
-
export default platform
|
|
75
|
+
export default platform;
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
* 验证电子邮箱格式
|
|
3
3
|
*/
|
|
4
4
|
export function email(value) {
|
|
5
|
-
|
|
5
|
+
return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 验证手机格式
|
|
10
10
|
*/
|
|
11
11
|
export function mobile(value) {
|
|
12
|
-
|
|
12
|
+
return /^1[23456789]\d{9}$/.test(value);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* 验证URL格式
|
|
17
17
|
*/
|
|
18
18
|
export function url(value) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(
|
|
20
|
+
value
|
|
21
|
+
);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -25,223 +26,220 @@ export function url(value) {
|
|
|
25
26
|
* @param {number | string} value yyyy-mm-dd hh:mm:ss 或 时间戳
|
|
26
27
|
*/
|
|
27
28
|
export function date(value) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
return !isNaN(new Date(value).getTime());
|
|
29
|
+
if (!value) return false;
|
|
30
|
+
// number类型,判断是否是时间戳
|
|
31
|
+
if (typeof value === 'number') {
|
|
32
|
+
// len === 10 秒级时间戳 len === 13 毫秒级时间戳
|
|
33
|
+
if (value.toString().length !== 10 && value.toString().length !== 13) {
|
|
34
|
+
return false;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// 非时间戳,且长度在yyyy-mm-dd 至 yyyy-mm-dd hh:mm:ss 之间
|
|
49
|
-
if (value.length < 10 || value.length > 19) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
const dateRegex =
|
|
53
|
-
/^\d{4}[-\/]\d{2}[-\/]\d{2}( \d{1,2}:\d{2}(:\d{2})?)?$/;
|
|
54
|
-
if (!dateRegex.test(value)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
// 检查是否为有效日期
|
|
58
|
-
const dateValue = new Date(value);
|
|
59
|
-
return !isNaN(dateValue.getTime());
|
|
36
|
+
return !isNaN(new Date(value).getTime());
|
|
37
|
+
}
|
|
38
|
+
if (typeof value === 'string') {
|
|
39
|
+
// 是否为string类型时间戳
|
|
40
|
+
const numV = Number(value);
|
|
41
|
+
if (!isNaN(numV)) {
|
|
42
|
+
if (numV.toString().length === 10 || numV.toString().length === 13) {
|
|
43
|
+
return !isNaN(new Date(numV).getTime());
|
|
44
|
+
}
|
|
60
45
|
}
|
|
61
|
-
//
|
|
62
|
-
|
|
46
|
+
// 非时间戳,且长度在yyyy-mm-dd 至 yyyy-mm-dd hh:mm:ss 之间
|
|
47
|
+
if (value.length < 10 || value.length > 19) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const dateRegex = /^\d{4}[-\/]\d{2}[-\/]\d{2}( \d{1,2}:\d{2}(:\d{2})?)?$/;
|
|
51
|
+
if (!dateRegex.test(value)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
// 检查是否为有效日期
|
|
55
|
+
const dateValue = new Date(value);
|
|
56
|
+
return !isNaN(dateValue.getTime());
|
|
57
|
+
}
|
|
58
|
+
// 非number和string类型,不做校验
|
|
59
|
+
return false;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
/**
|
|
66
63
|
* 验证ISO类型的日期格式
|
|
67
64
|
*/
|
|
68
65
|
export function dateISO(value) {
|
|
69
|
-
|
|
66
|
+
return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
/**
|
|
73
70
|
* 验证十进制数字
|
|
74
71
|
*/
|
|
75
72
|
export function number(value) {
|
|
76
|
-
|
|
73
|
+
return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value);
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
/**
|
|
80
77
|
* 验证字符串
|
|
81
78
|
*/
|
|
82
79
|
export function string(value) {
|
|
83
|
-
|
|
80
|
+
return typeof value === 'string';
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
/**
|
|
87
84
|
* 验证整数
|
|
88
85
|
*/
|
|
89
86
|
export function digits(value) {
|
|
90
|
-
|
|
87
|
+
return /^\d+$/.test(value);
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
/**
|
|
94
91
|
* 验证身份证号码
|
|
95
92
|
*/
|
|
96
93
|
export function idCard(value) {
|
|
97
|
-
|
|
98
|
-
value
|
|
99
|
-
)
|
|
94
|
+
return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value);
|
|
100
95
|
}
|
|
101
96
|
|
|
102
97
|
/**
|
|
103
98
|
* 是否车牌号
|
|
104
99
|
*/
|
|
105
100
|
export function carNo(value) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
// 新能源车牌
|
|
102
|
+
const xreg =
|
|
103
|
+
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
|
|
104
|
+
// 旧车牌
|
|
105
|
+
const creg =
|
|
106
|
+
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
|
|
107
|
+
if (value.length === 7) {
|
|
108
|
+
return creg.test(value);
|
|
109
|
+
}
|
|
110
|
+
if (value.length === 8) {
|
|
111
|
+
return xreg.test(value);
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
116
114
|
}
|
|
117
115
|
|
|
118
116
|
/**
|
|
119
117
|
* 金额,只允许2位小数
|
|
120
118
|
*/
|
|
121
119
|
export function amount(value) {
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
// 金额,只允许保留两位小数
|
|
121
|
+
return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
|
|
124
122
|
}
|
|
125
123
|
|
|
126
124
|
/**
|
|
127
125
|
* 中文
|
|
128
126
|
*/
|
|
129
127
|
export function chinese(value) {
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
const reg = /^[\u4e00-\u9fa5]+$/gi;
|
|
129
|
+
return reg.test(value);
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
/**
|
|
135
133
|
* 只能输入字母
|
|
136
134
|
*/
|
|
137
135
|
export function letter(value) {
|
|
138
|
-
|
|
136
|
+
return /^[a-zA-Z]*$/.test(value);
|
|
139
137
|
}
|
|
140
138
|
|
|
141
139
|
/**
|
|
142
140
|
* 只能是字母或者数字
|
|
143
141
|
*/
|
|
144
142
|
export function enOrNum(value) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
// 英文或者数字
|
|
144
|
+
const reg = /^[0-9a-zA-Z]*$/g;
|
|
145
|
+
return reg.test(value);
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
/**
|
|
151
149
|
* 验证是否包含某个值
|
|
152
150
|
*/
|
|
153
151
|
export function contains(value, param) {
|
|
154
|
-
|
|
152
|
+
return value.indexOf(param) >= 0;
|
|
155
153
|
}
|
|
156
154
|
|
|
157
155
|
/**
|
|
158
156
|
* 验证一个值范围[min, max]
|
|
159
157
|
*/
|
|
160
158
|
export function range(value, param) {
|
|
161
|
-
|
|
159
|
+
return value >= param[0] && value <= param[1];
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
/**
|
|
165
163
|
* 验证一个长度范围[min, max]
|
|
166
164
|
*/
|
|
167
165
|
export function rangeLength(value, param) {
|
|
168
|
-
|
|
166
|
+
return value.length >= param[0] && value.length <= param[1];
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
/**
|
|
172
170
|
* 是否固定电话
|
|
173
171
|
*/
|
|
174
172
|
export function landline(value) {
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
const reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
|
|
174
|
+
return reg.test(value);
|
|
177
175
|
}
|
|
178
176
|
|
|
179
177
|
/**
|
|
180
178
|
* 判断是否为空
|
|
181
179
|
*/
|
|
182
180
|
export function empty(value) {
|
|
183
|
-
|
|
181
|
+
switch (typeof value) {
|
|
184
182
|
case 'undefined':
|
|
185
|
-
|
|
183
|
+
return true;
|
|
186
184
|
case 'string':
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
|
|
186
|
+
break;
|
|
189
187
|
case 'boolean':
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
if (!value) return true;
|
|
189
|
+
break;
|
|
192
190
|
case 'number':
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
if (value === 0 || isNaN(value)) return true;
|
|
192
|
+
break;
|
|
195
193
|
case 'object':
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
if (value === null || value.length === 0) return true;
|
|
195
|
+
for (const i in value) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
/**
|
|
206
204
|
* 是否json字符串
|
|
207
205
|
*/
|
|
208
206
|
export function jsonString(value) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
207
|
+
if (typeof value === 'string') {
|
|
208
|
+
try {
|
|
209
|
+
const obj = JSON.parse(value);
|
|
210
|
+
if (typeof obj === 'object' && obj) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
} catch (e) {
|
|
215
|
+
return false;
|
|
219
216
|
}
|
|
220
|
-
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
221
219
|
}
|
|
222
220
|
|
|
223
221
|
/**
|
|
224
222
|
* 是否数组
|
|
225
223
|
*/
|
|
226
224
|
export function array(value) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
if (typeof Array.isArray === 'function') {
|
|
226
|
+
return Array.isArray(value);
|
|
227
|
+
}
|
|
228
|
+
return Object.prototype.toString.call(value) === '[object Array]';
|
|
231
229
|
}
|
|
232
230
|
|
|
233
231
|
/**
|
|
234
232
|
* 是否对象
|
|
235
233
|
*/
|
|
236
234
|
export function object(value) {
|
|
237
|
-
|
|
235
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
238
236
|
}
|
|
239
237
|
|
|
240
238
|
/**
|
|
241
239
|
* 是否短信验证码
|
|
242
240
|
*/
|
|
243
241
|
export function code(value, len = 6) {
|
|
244
|
-
|
|
242
|
+
return new RegExp(`^\\d{${len}}$`).test(value);
|
|
245
243
|
}
|
|
246
244
|
|
|
247
245
|
/**
|
|
@@ -249,7 +247,7 @@ export function code(value, len = 6) {
|
|
|
249
247
|
* @param {Object} value
|
|
250
248
|
*/
|
|
251
249
|
export function func(value) {
|
|
252
|
-
|
|
250
|
+
return typeof value === 'function';
|
|
253
251
|
}
|
|
254
252
|
|
|
255
253
|
/**
|
|
@@ -257,16 +255,16 @@ export function func(value) {
|
|
|
257
255
|
* @param {Object} value
|
|
258
256
|
*/
|
|
259
257
|
export function promise(value) {
|
|
260
|
-
|
|
258
|
+
return object(value) && func(value.then) && func(value.catch);
|
|
261
259
|
}
|
|
262
260
|
|
|
263
261
|
/** 是否图片格式
|
|
264
262
|
* @param {Object} value
|
|
265
263
|
*/
|
|
266
264
|
export function image(value) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
const newValue = value.split('?')[0];
|
|
266
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
|
267
|
+
return IMAGE_REGEXP.test(newValue);
|
|
270
268
|
}
|
|
271
269
|
|
|
272
270
|
/**
|
|
@@ -274,8 +272,8 @@ export function image(value) {
|
|
|
274
272
|
* @param {Object} value
|
|
275
273
|
*/
|
|
276
274
|
export function video(value) {
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i;
|
|
276
|
+
return VIDEO_REGEXP.test(value);
|
|
279
277
|
}
|
|
280
278
|
|
|
281
279
|
/**
|
|
@@ -284,37 +282,37 @@ export function video(value) {
|
|
|
284
282
|
* @return {Boolean}
|
|
285
283
|
*/
|
|
286
284
|
export function regExp(o) {
|
|
287
|
-
|
|
285
|
+
return o && Object.prototype.toString.call(o) === '[object RegExp]';
|
|
288
286
|
}
|
|
289
287
|
|
|
290
288
|
export default {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
289
|
+
email,
|
|
290
|
+
mobile,
|
|
291
|
+
url,
|
|
292
|
+
date,
|
|
293
|
+
dateISO,
|
|
294
|
+
number,
|
|
295
|
+
digits,
|
|
296
|
+
idCard,
|
|
297
|
+
carNo,
|
|
298
|
+
amount,
|
|
299
|
+
chinese,
|
|
300
|
+
letter,
|
|
301
|
+
enOrNum,
|
|
302
|
+
contains,
|
|
303
|
+
range,
|
|
304
|
+
rangeLength,
|
|
305
|
+
empty,
|
|
306
|
+
isEmpty: empty,
|
|
307
|
+
jsonString,
|
|
308
|
+
landline,
|
|
309
|
+
object,
|
|
310
|
+
array,
|
|
311
|
+
code,
|
|
312
|
+
func,
|
|
313
|
+
promise,
|
|
314
|
+
video,
|
|
315
|
+
image,
|
|
316
|
+
regExp,
|
|
317
|
+
string
|
|
318
|
+
};
|
|
@@ -9,22 +9,22 @@ let flag;
|
|
|
9
9
|
* @return null
|
|
10
10
|
*/
|
|
11
11
|
export function throttle(func, wait = 500, immediate = true) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
} else if (!flag) {
|
|
22
|
-
flag = true
|
|
23
|
-
// 如果是非立即执行,则在wait毫秒内的结束处执行
|
|
24
|
-
timer = setTimeout(() => {
|
|
25
|
-
flag = false
|
|
26
|
-
typeof func === 'function' && func()
|
|
27
|
-
}, wait)
|
|
12
|
+
if (immediate) {
|
|
13
|
+
if (!flag) {
|
|
14
|
+
flag = true;
|
|
15
|
+
// 如果是立即执行,则在wait毫秒内开始时执行
|
|
16
|
+
typeof func === 'function' && func();
|
|
17
|
+
timer = setTimeout(() => {
|
|
18
|
+
flag = false;
|
|
19
|
+
}, wait);
|
|
28
20
|
}
|
|
21
|
+
} else if (!flag) {
|
|
22
|
+
flag = true;
|
|
23
|
+
// 如果是非立即执行,则在wait毫秒内的结束处执行
|
|
24
|
+
timer = setTimeout(() => {
|
|
25
|
+
flag = false;
|
|
26
|
+
typeof func === 'function' && func();
|
|
27
|
+
}, wait);
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
|
-
export default throttle
|
|
30
|
+
export default throttle;
|