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