fusions-ui 1.2.7 → 1.2.8
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/LICENSE +1 -1
- package/changelog.md +2 -0
- package/components/avatar/index.ts +1 -0
- package/components/avatar/src/avatar.ts +131 -0
- package/components/avatar/src/avatar.vue +104 -0
- package/components/avatar/src/composables/index.ts +1 -0
- package/components/avatar/src/composables/use-avatar.ts +61 -0
- package/components/avatar-group/index.ts +1 -0
- package/components/avatar-group/src/avatar-group.ts +86 -0
- package/components/{fu-avatar-group/fu-avatar-group.vue → avatar-group/src/avatar-group.vue} +27 -34
- package/components/avatar-group/src/composables/index.ts +1 -0
- package/components/avatar-group/src/composables/use-avatar-group.ts +17 -0
- package/components/badge/index.ts +1 -0
- package/components/badge/src/badge.ts +126 -0
- package/components/{fu-badge/fu-badge.vue → badge/src/badge.vue} +26 -62
- package/components/badge/src/composables/badge-custom.ts +51 -0
- package/components/badge/src/composables/index.ts +1 -0
- package/components/banner-arc/index.ts +1 -0
- package/components/banner-arc/src/banner-arc.ts +41 -0
- package/components/banner-arc/src/banner-arc.vue +49 -0
- package/components/banner-arc/src/composables/banner-arc-custom.ts +19 -0
- package/components/banner-arc/src/composables/index.ts +1 -0
- package/components/button/index.ts +1 -0
- package/components/button/src/button.ts +332 -0
- package/components/{fu-button/fu-button.vue → button/src/button.vue} +57 -163
- package/components/button/src/composables/button-custom.ts +90 -0
- package/components/button/src/composables/index.ts +2 -0
- package/components/button/src/composables/use-button.ts +137 -0
- package/components/cell/index.ts +1 -0
- package/components/cell/src/cell.ts +167 -0
- package/components/{fu-cell/fu-cell.vue → cell/src/cell.vue} +29 -38
- package/components/cell/src/composables/index.ts +1 -0
- package/components/cell/src/composables/use-cell.ts +20 -0
- package/components/cell-group/index.ts +1 -0
- package/components/cell-group/src/cell-group.ts +23 -0
- package/components/{fu-cell-group/fu-cell-group.vue → cell-group/src/cell-group.vue} +8 -13
- package/components/checkbox/index.ts +1 -0
- package/components/checkbox/src/checkbox.ts +144 -0
- package/components/checkbox/src/checkbox.vue +270 -0
- package/components/checkbox/src/composables/checkbox-custom.ts +15 -0
- package/components/checkbox/src/composables/index.ts +2 -0
- package/components/checkbox/src/composables/use-checkbox.ts +200 -0
- package/components/code-input/index.ts +1 -0
- package/components/code-input/src/code-input.ts +157 -0
- package/components/code-input/src/code-input.vue +158 -0
- package/components/code-input/src/composables/code-input-custom.ts +74 -0
- package/components/code-input/src/composables/index.ts +2 -0
- package/components/code-input/src/composables/use-code-input.ts +67 -0
- package/components/code-verify/index.ts +1 -0
- package/components/code-verify/src/code-verify.ts +160 -0
- package/components/code-verify/src/code-verify.vue +87 -0
- package/components/code-verify/src/composables/code-verify-custom.ts +23 -0
- package/components/code-verify/src/composables/index.ts +2 -0
- package/components/code-verify/src/composables/use-code-verify.ts +132 -0
- package/components/collapse/index.ts +1 -0
- package/components/collapse/src/collapse.ts +41 -0
- package/components/collapse/src/collapse.vue +48 -0
- package/components/collapse/src/composables/index.ts +1 -0
- package/components/collapse/src/composables/use-collapse.ts +150 -0
- package/components/collapse-item/index.ts +1 -0
- package/components/collapse-item/src/collapse-item.ts +102 -0
- package/components/{fu-collapse-item/fu-collapse-item.vue → collapse-item/src/collapse-item.vue} +20 -159
- package/components/collapse-item/src/composables/index.ts +1 -0
- package/components/collapse-item/src/composables/use-collapse-item.ts +139 -0
- package/components/countdown/index.ts +1 -0
- package/components/countdown/src/composables/index.ts +1 -0
- package/components/countdown/src/composables/use-countdown.ts +133 -0
- package/components/countdown/src/countdown.ts +63 -0
- package/components/countdown/src/countdown.vue +60 -0
- package/components/{fu-countdown/util.js → countdown/src/util.ts} +5 -5
- package/components/datetime-picker/index.ts +1 -0
- package/components/datetime-picker/src/composables/index.ts +1 -0
- package/components/datetime-picker/src/composables/use-datetime-picker.ts +325 -0
- package/components/datetime-picker/src/datetime-picker.ts +223 -0
- package/components/datetime-picker/src/datetime-picker.vue +96 -0
- package/components/form/index.ts +1 -0
- package/components/form/src/composables/index.ts +1 -0
- package/components/form/src/composables/use-form.ts +256 -0
- package/components/form/src/form.ts +108 -0
- package/components/form/src/form.vue +64 -0
- package/components/{fu-form/utils.js → form/src/utils.ts} +49 -42
- package/components/{fu-form/validate.js → form/src/validate.ts} +58 -49
- package/components/form-item/index.ts +1 -0
- package/components/form-item/src/composables/index.ts +1 -0
- package/components/form-item/src/composables/use-form-item.ts +292 -0
- package/components/form-item/src/form-item.ts +81 -0
- package/components/form-item/src/form-item.vue +229 -0
- package/components/fusions-ui/src/fusions-ui.vue +8 -0
- package/components/grid/index.ts +1 -0
- package/components/grid/src/composables/index.ts +1 -0
- package/components/grid/src/composables/use-grid.ts +67 -0
- package/components/grid/src/grid.ts +54 -0
- package/components/grid/src/grid.vue +69 -0
- package/components/grid-item/index.ts +1 -0
- package/components/grid-item/src/composables/grid-item-custom.ts +16 -0
- package/components/grid-item/src/composables/index.ts +2 -0
- package/components/grid-item/src/composables/use-grid-item.ts +55 -0
- package/components/grid-item/src/grid-item.ts +15 -0
- package/components/grid-item/src/grid-item.vue +102 -0
- package/components/icon/index.ts +1 -0
- package/components/icon/src/composables/icon-custom.ts +41 -0
- package/components/icon/src/composables/index.ts +2 -0
- package/components/icon/src/composables/use-icon.ts +14 -0
- package/components/{fu-icon → icon/src}/fuicon.css +584 -584
- package/components/icon/src/fuicon.ts +1023 -0
- package/components/icon/src/icon.ts +84 -0
- package/components/icon/src/icon.vue +92 -0
- package/components/image/index.ts +1 -0
- package/components/image/src/composables/image-custom.ts +36 -0
- package/components/image/src/composables/index.ts +2 -0
- package/components/image/src/composables/use-image.ts +135 -0
- package/components/image/src/image.ts +185 -0
- package/components/image/src/image.vue +152 -0
- package/components/index-anchor/index.ts +1 -0
- package/components/index-anchor/src/composables/index.ts +1 -0
- package/components/index-anchor/src/composables/use-index-anchor.ts +44 -0
- package/components/index-anchor/src/index-anchor.ts +45 -0
- package/components/index-anchor/src/index-anchor.vue +60 -0
- package/components/index-item/index.ts +1 -0
- package/components/index-item/src/composables/index.ts +1 -0
- package/components/index-item/src/composables/use-index-item.ts +75 -0
- package/components/index-item/src/index-item.ts +13 -0
- package/components/index-item/src/index-item.vue +32 -0
- package/components/index-list/index.ts +1 -0
- package/components/index-list/src/composables/index.ts +1 -0
- package/components/index-list/src/composables/use-index-list.ts +297 -0
- package/components/index-list/src/index-list.ts +52 -0
- package/components/index-list/src/index-list.vue +178 -0
- package/components/index.ts +62 -0
- package/components/input/index.ts +1 -0
- package/components/input/src/composables/index.ts +2 -0
- package/components/input/src/composables/input-custom.ts +69 -0
- package/components/input/src/composables/use-input.ts +117 -0
- package/components/input/src/input.ts +360 -0
- package/components/input/src/input.vue +241 -0
- package/components/keyboard/index.ts +1 -0
- package/components/keyboard/src/composables/index.ts +3 -0
- package/components/keyboard/src/composables/use-keyboard-car.ts +99 -0
- package/components/keyboard/src/composables/use-keyboard-number.ts +81 -0
- package/components/keyboard/src/composables/use-keyboard.ts +61 -0
- package/components/keyboard/src/keyboard-car.ts +53 -0
- package/components/{fu-keyboard → keyboard/src}/keyboard-car.vue +37 -199
- package/components/keyboard/src/keyboard-number.ts +44 -0
- package/components/keyboard/src/keyboard-number.vue +108 -0
- package/components/keyboard/src/keyboard.ts +174 -0
- package/components/{fu-keyboard/fu-keyboard.vue → keyboard/src/keyboard.vue} +38 -63
- package/components/line/index.ts +1 -0
- package/components/line/src/composables/index.ts +1 -0
- package/components/line/src/composables/line-custom.ts +30 -0
- package/components/line/src/line.ts +82 -0
- package/components/line/src/line.vue +44 -0
- package/components/link/index.ts +1 -0
- package/components/link/src/composables/index.ts +2 -0
- package/components/link/src/composables/link-custom.ts +19 -0
- package/components/link/src/composables/use-link.ts +33 -0
- package/components/link/src/link.ts +61 -0
- package/components/link/src/link.vue +62 -0
- package/components/loading/index.ts +1 -0
- package/{libs/function/colorGradient.js → components/loading/src/composables/colorGradient.ts} +4 -4
- package/components/loading/src/composables/index.ts +2 -0
- package/components/loading/src/composables/loading-custom.ts +21 -0
- package/components/loading/src/composables/use-loading.ts +100 -0
- package/components/loading/src/loading.ts +77 -0
- package/components/{fu-loading/fu-loading.vue → loading/src/loading.vue} +23 -119
- package/components/loading-more/index.ts +1 -0
- package/components/loading-more/src/loading-more.ts +75 -0
- package/components/{fu-loading-more/fu-loading-more.vue → loading-more/src/loading-more.vue} +18 -19
- package/components/modal/index.ts +1 -0
- package/components/modal/src/composables/index.ts +2 -0
- package/components/modal/src/composables/modal-custom.ts +17 -0
- package/components/modal/src/composables/use-modal.ts +56 -0
- package/components/modal/src/modal.ts +152 -0
- package/components/{fu-modal/fu-modal.vue → modal/src/modal.vue} +41 -69
- package/components/navbar/index.ts +1 -0
- package/components/navbar/src/composables/index.ts +2 -0
- package/components/navbar/src/composables/navbar-custom.ts +62 -0
- package/components/navbar/src/composables/use-navbar.ts +42 -0
- package/components/navbar/src/navbar.ts +151 -0
- package/components/navbar/src/navbar.vue +249 -0
- package/components/notice-bar/index.ts +3 -0
- package/components/notice-bar/src/composables/index.ts +5 -0
- package/components/notice-bar/src/composables/notice-column-custom.ts +43 -0
- package/components/notice-bar/src/composables/notice-row-custom.ts +26 -0
- package/components/notice-bar/src/composables/use-notice-bar.ts +34 -0
- package/components/notice-bar/src/composables/use-notice-column.ts +31 -0
- package/components/notice-bar/src/composables/use-notice-row.ts +88 -0
- package/components/notice-bar/src/notice-bar.ts +197 -0
- package/components/{fu-notice-bar/fu-notice-bar.vue → notice-bar/src/notice-bar.vue} +28 -41
- package/components/notice-bar/src/notice-column.ts +172 -0
- package/components/notice-bar/src/notice-column.vue +129 -0
- package/components/notice-bar/src/notice-row.ts +155 -0
- package/components/notice-bar/src/notice-row.vue +135 -0
- package/components/number-box/index.ts +1 -0
- package/components/number-box/src/composables/index.ts +2 -0
- package/components/number-box/src/composables/number-box-custom.ts +16 -0
- package/components/number-box/src/composables/use-number-box.ts +84 -0
- package/components/number-box/src/number-box.ts +98 -0
- package/components/number-box/src/number-box.vue +123 -0
- package/components/parse/index.ts +1 -0
- package/components/parse/src/app-plus/html/js/handler.js +254 -0
- package/components/parse/src/app-plus/html/js/uni.webview.min.js +188 -0
- package/components/parse/src/app-plus/html/local.html +32 -0
- package/components/parse/src/composables/index.ts +1 -0
- package/components/parse/src/composables/use-parse.ts +428 -0
- package/components/parse/src/node/node.vue +635 -0
- package/components/parse/src/parse.ts +156 -0
- package/components/parse/src/parse.vue +131 -0
- package/components/parse/src/parser.ts +1402 -0
- package/components/picker/index.ts +1 -0
- package/components/picker/src/composables/index.ts +2 -0
- package/components/picker/src/composables/picker-custom.ts +40 -0
- package/components/picker/src/composables/use-picker.ts +179 -0
- package/components/picker/src/picker.ts +172 -0
- package/components/picker/src/picker.vue +197 -0
- package/components/popup/index.ts +1 -0
- package/components/popup/src/composables/index.ts +1 -0
- package/components/popup/src/composables/use-popup.ts +346 -0
- package/components/popup/src/keypress.ts +55 -0
- package/components/popup/src/popup.ts +101 -0
- package/components/popup/src/popup.vue +204 -0
- package/components/progress/index.ts +1 -0
- package/components/progress/src/composables/index.ts +2 -0
- package/components/progress/src/composables/progress-custom.ts +24 -0
- package/components/progress/src/composables/use-progress.ts +159 -0
- package/components/progress/src/progress.ts +84 -0
- package/components/progress/src/progress.vue +150 -0
- package/components/rate/index.ts +1 -0
- package/components/rate/src/composables/index.ts +1 -0
- package/components/rate/src/composables/use-rate.ts +196 -0
- package/components/rate/src/rate.ts +114 -0
- package/components/rate/src/rate.vue +113 -0
- package/components/read-more/index.ts +1 -0
- package/components/read-more/src/composables/index.ts +2 -0
- package/components/read-more/src/composables/read-more-custom.ts +46 -0
- package/components/read-more/src/composables/use-read-more.ts +72 -0
- package/components/read-more/src/read-more.ts +102 -0
- package/components/read-more/src/read-more.vue +104 -0
- package/components/safe-bottom/index.ts +1 -0
- package/components/safe-bottom/src/composables/index.ts +2 -0
- package/components/safe-bottom/src/composables/safe-bottom-custom.ts +18 -0
- package/components/safe-bottom/src/composables/use-safe-bottom.ts +17 -0
- package/components/safe-bottom/src/safe-bottom.ts +8 -0
- package/components/safe-bottom/src/safe-bottom.vue +43 -0
- package/components/scroll-list/index.ts +1 -0
- package/components/scroll-list/src/composables/index.ts +2 -0
- package/components/scroll-list/src/composables/scroll-list-custom.ts +41 -0
- package/components/scroll-list/src/composables/use-scroll-list.ts +126 -0
- package/components/scroll-list/src/scroll-list.ts +57 -0
- package/components/scroll-list/src/scroll-list.vue +143 -0
- package/components/{fu-scroll-list/scrollWxs.wxs → scroll-list/src/scroll-wxs.wxs} +2 -2
- package/components/search/index.ts +1 -0
- package/components/search/src/composables/index.ts +2 -0
- package/components/search/src/composables/search-custom.ts +25 -0
- package/components/search/src/composables/use-search.ts +106 -0
- package/components/search/src/search.ts +186 -0
- package/components/{fu-search/fu-search.vue → search/src/search.vue} +42 -154
- package/components/section/index.ts +1 -0
- package/components/section/src/composables/index.ts +1 -0
- package/components/section/src/composables/use-section.ts +19 -0
- package/components/section/src/section.ts +83 -0
- package/components/{fu-section/fu-section.vue → section/src/section.vue} +36 -35
- package/components/sign-board/index.ts +1 -0
- package/components/sign-board/src/composables/index.ts +1 -0
- package/components/sign-board/src/composables/use-sign-board.ts +552 -0
- package/components/sign-board/src/sign-board.ts +48 -0
- package/components/sign-board/src/sign-board.vue +191 -0
- package/components/skeleton/index.ts +1 -0
- package/components/skeleton/src/composables/index.ts +2 -0
- package/components/skeleton/src/composables/skeleton-custom.ts +23 -0
- package/components/skeleton/src/composables/use-skeleton.ts +102 -0
- package/components/skeleton/src/skeleton.ts +37 -0
- package/components/skeleton/src/skeleton.vue +147 -0
- package/components/status-bar/src/composables/index.ts +1 -0
- package/components/status-bar/src/composables/use-status-bar.ts +29 -0
- package/components/status-bar/src/status-bar.vue +21 -0
- package/components/steps/index.ts +1 -0
- package/components/steps/src/composables/index.ts +1 -0
- package/components/steps/src/composables/use-steps.ts +27 -0
- package/components/steps/src/steps.ts +65 -0
- package/components/steps/src/steps.vue +46 -0
- package/components/steps-item/index.ts +1 -0
- package/components/steps-item/src/composables/index.ts +2 -0
- package/components/steps-item/src/composables/steps-item-custom.ts +81 -0
- package/components/steps-item/src/composables/use-steps-item.ts +87 -0
- package/components/steps-item/src/steps-item.ts +38 -0
- package/components/steps-item/src/steps-item.vue +224 -0
- package/components/sticky/index.ts +1 -0
- package/components/sticky/src/composables/index.ts +2 -0
- package/components/sticky/src/composables/sticky-custom.ts +57 -0
- package/components/sticky/src/composables/use-sticky.ts +152 -0
- package/components/sticky/src/sticky.ts +62 -0
- package/components/sticky/src/sticky.vue +65 -0
- package/components/subsection/index.ts +1 -0
- package/components/subsection/src/composables/index.ts +2 -0
- package/components/subsection/src/composables/subsection-custom.ts +71 -0
- package/components/subsection/src/composables/use-subsection.ts +85 -0
- package/components/subsection/src/subsection.ts +107 -0
- package/components/subsection/src/subsection.vue +165 -0
- package/components/swipe-action/src/composables/index.ts +1 -0
- package/components/swipe-action/src/composables/use-swipe-action.ts +58 -0
- package/components/swipe-action/src/swipe-action.vue +81 -0
- package/components/swipe-action-item/index.ts +1 -0
- package/components/{fu-swipe-action-item/mpwxs.js → swipe-action-item/src/mpwxs.ts} +22 -27
- package/components/swipe-action-item/src/swipe-action-item.ts +68 -0
- package/components/{fu-swipe-action-item/fu-swipe-action-item.vue → swipe-action-item/src/swipe-action-item.vue} +24 -17
- package/components/{fu-swipe-action-item → swipe-action-item/src}/wx.wxs +2 -2
- package/components/swiper/index.ts +1 -0
- package/components/swiper/src/composables/index.ts +2 -0
- package/components/swiper/src/composables/swiper-custom.ts +40 -0
- package/components/swiper/src/composables/use-swiper.ts +75 -0
- package/components/swiper/src/swiper.ts +189 -0
- package/components/{fu-swiper/fu-swiper.vue → swiper/src/swiper.vue} +49 -118
- package/components/switch/index.ts +1 -0
- package/components/switch/src/composables/index.ts +2 -0
- package/components/switch/src/composables/switch-custom.ts +32 -0
- package/components/switch/src/composables/use-switch.ts +38 -0
- package/components/switch/src/switch.ts +115 -0
- package/components/{fu-switch/fu-switch.vue → switch/src/switch.vue} +25 -73
- package/components/tabs/index.ts +1 -0
- package/components/tabs/src/composables/index.ts +2 -0
- package/components/tabs/src/composables/tabs-custom.ts +43 -0
- package/components/tabs/src/composables/use-tabs.ts +210 -0
- package/components/tabs/src/tabs.ts +123 -0
- package/components/tabs/src/tabs.vue +153 -0
- package/components/tag/index.ts +1 -0
- package/components/tag/src/composables/index.ts +2 -0
- package/components/tag/src/composables/tag-custom.ts +61 -0
- package/components/tag/src/composables/use-tag.ts +23 -0
- package/components/tag/src/tag.ts +159 -0
- package/components/{fu-tag/fu-tag.vue → tag/src/tag.vue} +53 -93
- package/components/text/index.ts +1 -0
- package/components/text/src/composables/index.ts +2 -0
- package/components/text/src/composables/text-custom.ts +120 -0
- package/components/text/src/composables/use-text.ts +83 -0
- package/components/text/src/text.ts +261 -0
- package/components/text/src/text.vue +186 -0
- package/components/textarea/index.ts +1 -0
- package/components/textarea/src/composables/index.ts +2 -0
- package/components/textarea/src/composables/textarea-custom.ts +50 -0
- package/components/textarea/src/composables/use-textarea.ts +88 -0
- package/components/textarea/src/textarea.ts +250 -0
- package/components/textarea/src/textarea.vue +162 -0
- package/components/{fu-timeaxis/fu-timeaxis.vue → timeaxis/src/timeaxis.vue} +3 -9
- package/components/timeaxis-item/index.ts +1 -0
- package/components/timeaxis-item/src/timeaxis-item.ts +20 -0
- package/components/timeaxis-item/src/timeaxis-item.vue +50 -0
- package/components/transition/index.ts +1 -0
- package/components/transition/src/composables/createAnimation.ts +171 -0
- package/components/transition/src/composables/index.ts +2 -0
- package/components/transition/src/composables/transform-custom.ts +18 -0
- package/components/transition/src/composables/use-transition.ts +251 -0
- package/components/transition/src/transition.ts +64 -0
- package/components/transition/src/transition.vue +70 -0
- package/components/upload/index.ts +1 -0
- package/components/upload/src/composables/index.ts +5 -0
- package/components/upload/src/composables/upload-file-custom.ts +68 -0
- package/components/upload/src/composables/upload-image-custom.ts +76 -0
- package/components/upload/src/composables/use-upload-file.ts +27 -0
- package/components/upload/src/composables/use-upload-image.ts +38 -0
- package/components/upload/src/composables/use-upload.ts +388 -0
- package/components/upload/src/upload-file.ts +84 -0
- package/components/upload/src/upload-file.vue +193 -0
- package/components/upload/src/upload-image.ts +90 -0
- package/components/upload/src/upload-image.vue +158 -0
- package/components/upload/src/upload.ts +196 -0
- package/components/upload/src/upload.vue +151 -0
- package/components/{fu-upload/utils.js → upload/src/utils.ts} +12 -12
- package/components/vtabs/index.ts +1 -0
- package/components/vtabs/src/composables/index.ts +2 -0
- package/components/vtabs/src/composables/use-vtabs.ts +276 -0
- package/components/vtabs/src/composables/vtabs-custom.ts +54 -0
- package/components/vtabs/src/vtabs.ts +130 -0
- package/components/vtabs/src/vtabs.vue +189 -0
- package/components/vtabs-item/index.ts +1 -0
- package/components/vtabs-item/src/composables/index.ts +1 -0
- package/components/vtabs-item/src/composables/use-vtabs-item.ts +60 -0
- package/components/vtabs-item/src/vtabs-item.ts +10 -0
- package/components/vtabs-item/src/vtabs-item.vue +20 -0
- package/components/waterfall/index.ts +1 -0
- package/components/waterfall/src/composables/index.ts +2 -0
- package/components/waterfall/src/composables/use-waterfall.ts +139 -0
- package/components/waterfall/src/composables/waterfall-custom.ts +18 -0
- package/components/waterfall/src/waterfall.ts +114 -0
- package/components/waterfall/src/waterfall.vue +104 -0
- package/{libs/config/config.js → config/config.ts} +13 -7
- package/constants/images.ts +18 -0
- package/constants/index.ts +6 -0
- package/constants/open-types.ts +33 -0
- package/constants/props.ts +18 -0
- package/constants/shapes.ts +6 -0
- package/constants/types.ts +10 -0
- package/constants/z-index.ts +27 -0
- package/global.d.ts +103 -0
- package/hooks/index.ts +25 -0
- package/index.scss +3 -5
- package/index.ts +56 -0
- package/package.json +1 -1
- package/{libs/route/min.route.config.js → route/min.route.config.ts} +62 -23
- package/route/route.config.ts +93 -0
- package/style/color.scss +26 -0
- package/{libs/style → style}/common.scss +1 -14
- package/{libs/function/applyEven.js → utils/applyEven.ts} +21 -12
- package/utils/check.ts +276 -0
- package/{libs/function/chooseUploadFile.js → utils/chooseUploadFile.ts} +22 -26
- package/utils/common.ts +609 -0
- package/{libs/function/digit.js → utils/digit.ts} +63 -33
- package/{components/fu-swipe-action-item/isPC.js → utils/isPC.ts} +1 -1
- package/utils/toast.ts +42 -0
- package/components/fu-avatar/fu-avatar.vue +0 -157
- package/components/fu-avatar/props.js +0 -117
- package/components/fu-avatar-group/props.js +0 -74
- package/components/fu-badge/props.js +0 -112
- package/components/fu-banner-arc/fu-banner-arc.vue +0 -58
- package/components/fu-banner-arc/props.js +0 -35
- package/components/fu-button/props.js +0 -228
- package/components/fu-cell/props.js +0 -108
- package/components/fu-cell-group/props.js +0 -19
- package/components/fu-checkbox/fu-checkbox.vue +0 -469
- package/components/fu-checkbox/props.js +0 -126
- package/components/fu-code-input/fu-code-input.vue +0 -269
- package/components/fu-code-input/props.js +0 -136
- package/components/fu-code-verify/fu-code-verify.vue +0 -221
- package/components/fu-code-verify/props.js +0 -136
- package/components/fu-collapse/fu-collapse.vue +0 -143
- package/components/fu-collapse/props.js +0 -29
- package/components/fu-collapse-item/props.js +0 -101
- package/components/fu-countdown/fu-countdown.vue +0 -164
- package/components/fu-countdown/props.js +0 -35
- package/components/fu-datetime-picker/fu-datetime-picker.vue +0 -375
- package/components/fu-datetime-picker/props.js +0 -194
- package/components/fu-form/fu-form.vue +0 -284
- package/components/fu-form/props.js +0 -74
- package/components/fu-form-item/fu-form-item.vue +0 -535
- package/components/fu-form-item/props.js +0 -66
- package/components/fu-grid/fu-grid.vue +0 -113
- package/components/fu-grid/props.js +0 -44
- package/components/fu-grid-item/fu-grid-item.vue +0 -136
- package/components/fu-grid-item/props.js +0 -27
- package/components/fu-icon/fu-icon.vue +0 -110
- package/components/fu-icon/fuicon.js +0 -1031
- package/components/fu-icon/props.js +0 -55
- package/components/fu-image/fu-image.vue +0 -268
- package/components/fu-image/props.js +0 -145
- package/components/fu-index-anchor/fu-index-anchor.vue +0 -91
- package/components/fu-index-anchor/props.js +0 -43
- package/components/fu-index-item/fu-index-item.vue +0 -79
- package/components/fu-index-list/fu-index-list.vue +0 -426
- package/components/fu-index-list/props.js +0 -42
- package/components/fu-input/fu-input.vue +0 -393
- package/components/fu-input/props.js +0 -291
- package/components/fu-keyboard/keyboard-number.vue +0 -195
- package/components/fu-keyboard/props.js +0 -138
- package/components/fu-line/fu-line.vue +0 -64
- package/components/fu-line/props.js +0 -58
- package/components/fu-link/fu-link.vue +0 -91
- package/components/fu-link/props.js +0 -49
- package/components/fu-loading/props.js +0 -60
- package/components/fu-loading-more/props.js +0 -59
- package/components/fu-modal/props.js +0 -128
- package/components/fu-navbar/fu-navbar.vue +0 -271
- package/components/fu-navbar/props.js +0 -72
- package/components/fu-navbar/status-bar.vue +0 -27
- package/components/fu-notice-bar/notice-column.vue +0 -313
- package/components/fu-notice-bar/notice-row.vue +0 -363
- package/components/fu-notice-bar/props.js +0 -173
- package/components/fu-number-box/fu-number-box.vue +0 -210
- package/components/fu-number-box/props.js +0 -79
- package/components/fu-parse/fu-parse.vue +0 -508
- package/components/fu-parse/node/node.vue +0 -576
- package/components/fu-parse/parser.js +0 -1335
- package/components/fu-picker/fu-picker.vue +0 -347
- package/components/fu-picker/props.js +0 -150
- package/components/fu-popup/fu-popup.vue +0 -475
- package/components/fu-popup/keypress.js +0 -45
- package/components/fu-popup/props.js +0 -83
- package/components/fu-progress/fu-progress.vue +0 -292
- package/components/fu-progress/props.js +0 -76
- package/components/fu-rate/fu-rate.vue +0 -301
- package/components/fu-rate/props.js +0 -103
- package/components/fu-read-more/fu-read-more.vue +0 -191
- package/components/fu-read-more/props.js +0 -72
- package/components/fu-ribbon/fu-ribbon.vue +0 -106
- package/components/fu-ribbon/props.js +0 -35
- package/components/fu-safe-area/fu-safe-area.vue +0 -61
- package/components/fu-scroll-list/fu-scroll-list.vue +0 -196
- package/components/fu-scroll-list/nvue.js +0 -28
- package/components/fu-scroll-list/props.js +0 -43
- package/components/fu-search/props.js +0 -149
- package/components/fu-section/props.js +0 -59
- package/components/fu-sign-board/fu-sign-board.vue +0 -730
- package/components/fu-sign-board/props.js +0 -34
- package/components/fu-skeleton/fu-skeleton.vue +0 -238
- package/components/fu-skeleton/props.js +0 -35
- package/components/fu-steps/fu-steps.vue +0 -81
- package/components/fu-steps/props.js +0 -55
- package/components/fu-steps-item/fu-steps-item.vue +0 -274
- package/components/fu-steps-item/props.js +0 -34
- package/components/fu-sticky/fu-sticky.vue +0 -232
- package/components/fu-sticky/props.js +0 -54
- package/components/fu-subsection/fu-subsection.vue +0 -288
- package/components/fu-subsection/props.js +0 -88
- package/components/fu-swipe-action/fu-swipe-action.vue +0 -64
- package/components/fu-swipe-action-item/props.js +0 -54
- package/components/fu-swiper/props.js +0 -163
- package/components/fu-switch/props.js +0 -102
- package/components/fu-tabs/fu-tabs.vue +0 -361
- package/components/fu-tabs/props.js +0 -109
- package/components/fu-tag/props.js +0 -135
- package/components/fu-text/button.js +0 -13
- package/components/fu-text/fu-text.vue +0 -254
- package/components/fu-text/openType.js +0 -47
- package/components/fu-text/props.js +0 -173
- package/components/fu-text/value.js +0 -88
- package/components/fu-textarea/fu-textarea.vue +0 -288
- package/components/fu-textarea/props.js +0 -206
- package/components/fu-timeaxis-item/fu-timeaxis-item.vue +0 -68
- package/components/fu-transition/createAnimation.js +0 -131
- package/components/fu-transition/fu-transition.vue +0 -292
- package/components/fu-transition/props.js +0 -21
- package/components/fu-upload/fu-upload.vue +0 -563
- package/components/fu-upload/props.js +0 -171
- package/components/fu-upload/upload-file.vue +0 -332
- package/components/fu-upload/upload-image.vue +0 -304
- package/components/fu-vtabs/fu-vtabs.vue +0 -443
- package/components/fu-vtabs/props.js +0 -114
- package/components/fu-vtabs-item/fu-vtabs-item.vue +0 -71
- package/components/fu-waterfall/fu-waterfall.vue +0 -238
- package/components/fu-waterfall/props.js +0 -85
- package/index.js +0 -71
- package/libs/function/check.js +0 -215
- package/libs/function/common.js +0 -527
- package/libs/function/message.js +0 -47
- package/libs/mixin/button.js +0 -85
- package/libs/mixin/mixin.js +0 -94
- package/libs/mixin/mpMixin.js +0 -8
- package/libs/mixin/mpShare.js +0 -15
- package/libs/route/route.config.js +0 -66
- package/libs/style/color.scss +0 -24
- /package/components/{fu-icon → icon/src}/fuicon.ttf +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/bindingx.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpalipay.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpother.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/render.js +0 -0
- /package/{libs/style → style}/components.scss +0 -0
- /package/{libs/style → style}/style.h5.scss +0 -0
- /package/{libs/style → style}/style.mp.scss +0 -0
- /package/{libs/function → utils}/dayjs.js +0 -0
|
@@ -1,730 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="fu-sign-board-class fu-sign-board" :style="{top: `${customBarHeight}px`, height: `calc(100% - ${customBarHeight}px)`}" v-if="show">
|
|
3
|
-
<!-- 签名canvas -->
|
|
4
|
-
<view class="fu-sign-board__content">
|
|
5
|
-
<view class="fu-sign-board__content__wrapper">
|
|
6
|
-
<canvas class="fu-sign-board__content__canvas" :canvas-id="canvasId" :disableScroll="true" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd"></canvas>
|
|
7
|
-
</view>
|
|
8
|
-
</view>
|
|
9
|
-
|
|
10
|
-
<!-- 底部工具栏 -->
|
|
11
|
-
<view class="fu-sign-board__tools">
|
|
12
|
-
<!-- 可选颜色 -->
|
|
13
|
-
<view class="fu-sign-board__tools__color">
|
|
14
|
-
<view class="fu-sign-board__tools__color__item"
|
|
15
|
-
:class="[{'fu-sign-board__tools__color__item--active': currentSelectColor === item}]"
|
|
16
|
-
:style="{backgroundColor: item}" v-for="(item, index) in signSelectColor" :key="index"
|
|
17
|
-
@tap="colorSwitch(item)"></view>
|
|
18
|
-
</view>
|
|
19
|
-
|
|
20
|
-
<!-- 按钮 -->
|
|
21
|
-
<view class="fu-sign-board__tools__button">
|
|
22
|
-
<view class="fu-sign-board__tools__button__item fu-bg-red" @tap="reDraw">清除</view>
|
|
23
|
-
<view class="fu-sign-board__tools__button__item fu-bg-blue" @tap="save">保存</view>
|
|
24
|
-
<view class="fu-sign-board__tools__button__item fu-bg-indigo" @tap="previewImage">预览</view>
|
|
25
|
-
<view class="fu-sign-board__tools__button__item fu-bg-orange" @tap="closeBoard">关闭</view>
|
|
26
|
-
</view>
|
|
27
|
-
</view>
|
|
28
|
-
|
|
29
|
-
<!-- 伪全屏生成旋转图片canvas容器,不在页面上展示 -->
|
|
30
|
-
<view style="position: fixed; left: -2000px;width: 0;height: 0;overflow: hidden;">
|
|
31
|
-
<canvas canvas-id="temp-fu-sign-canvas" :style="{width: `${canvasHeight}px`, height: `${canvasHeight}px`}"></canvas>
|
|
32
|
-
</view>
|
|
33
|
-
</view>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
38
|
-
import mixin from '../../libs/mixin/mixin.js'
|
|
39
|
-
import props from './props.js'
|
|
40
|
-
/**
|
|
41
|
-
* @description SignBoard签名板
|
|
42
|
-
* @property {Boolean} show = [true|false] 是否显示(默认 false)
|
|
43
|
-
* @property {Array} signSelectColor 可选签名颜色(默认 ['#060606', '#ec3930'])
|
|
44
|
-
* @property {Boolean} rotate 是否旋转输出图片(默认 true)
|
|
45
|
-
* @property {String,Number} customBarHeight 自定义顶栏的高度(默认 0)
|
|
46
|
-
*
|
|
47
|
-
* @event {Function} save 保存时触发
|
|
48
|
-
* @event {Function} close 关闭时触发
|
|
49
|
-
*/
|
|
50
|
-
export default {
|
|
51
|
-
name: 'FuSignBoard',
|
|
52
|
-
emits: ['save', 'close'],
|
|
53
|
-
mixins: [mpMixin, mixin, props],
|
|
54
|
-
data() {
|
|
55
|
-
const canvasId = this.$fu.uuid();
|
|
56
|
-
return {
|
|
57
|
-
canvasId,
|
|
58
|
-
ctx: null,
|
|
59
|
-
canvasWidth: 0,
|
|
60
|
-
canvasHeight: 0,
|
|
61
|
-
currentSelectColor: this.signSelectColor[0],
|
|
62
|
-
// 第一次触摸
|
|
63
|
-
firstTouch: false,
|
|
64
|
-
// 透明度
|
|
65
|
-
transparent: 1,
|
|
66
|
-
// 笔迹倍数
|
|
67
|
-
lineSize: 1.5,
|
|
68
|
-
// 最小画笔半径
|
|
69
|
-
minLine: 0.5,
|
|
70
|
-
// 最大画笔半径
|
|
71
|
-
maxLine: 4,
|
|
72
|
-
// 画笔压力
|
|
73
|
-
pressure: 1,
|
|
74
|
-
// 顺滑度,用60的距离来计算速度
|
|
75
|
-
smoothness: 60,
|
|
76
|
-
// 当前触摸的点
|
|
77
|
-
currentPoint: {},
|
|
78
|
-
// 当前线条
|
|
79
|
-
currentLine: [],
|
|
80
|
-
// 画笔圆半径
|
|
81
|
-
radius: 1,
|
|
82
|
-
// 裁剪区域
|
|
83
|
-
cutArea: {
|
|
84
|
-
top: 0,
|
|
85
|
-
right: 0,
|
|
86
|
-
bottom: 0,
|
|
87
|
-
left: 0
|
|
88
|
-
},
|
|
89
|
-
// 上一个点
|
|
90
|
-
lastPoint: 0,
|
|
91
|
-
// 笔迹
|
|
92
|
-
chirography: [],
|
|
93
|
-
// 画线轨迹,生成线条的实际点
|
|
94
|
-
linePrack: []
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
created() {
|
|
98
|
-
// 创建canvas
|
|
99
|
-
this.ctx = uni.createCanvasContext(this.canvasId, this);
|
|
100
|
-
},
|
|
101
|
-
methods: {
|
|
102
|
-
// 获取画板的相关信息
|
|
103
|
-
getCanvasInfo() {
|
|
104
|
-
this.$fuGetRect('.fu-sign-board__content__canvas').then(res => {
|
|
105
|
-
this.canvasWidth = res.width;
|
|
106
|
-
this.canvasHeight = res.height;
|
|
107
|
-
|
|
108
|
-
// 初始化Canvas
|
|
109
|
-
this.$nextTick(() => {
|
|
110
|
-
this.initCanvas('#FFFFFF')
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
// 初始化Canvas
|
|
116
|
-
initCanvas(color) {
|
|
117
|
-
/* 将canvas背景设置为 白底,不设置 导出的canvas的背景为透明 */
|
|
118
|
-
// rect() 参数说明 矩形路径左上角的横坐标,左上角的纵坐标, 矩形路径的宽度, 矩形路径的高度
|
|
119
|
-
// 矩形的宽高需要减去边框的宽度
|
|
120
|
-
this.ctx.rect(0, 0, this.canvasWidth - uni.upx2px(4), this.canvasHeight - uni.upx2px(4))
|
|
121
|
-
this.ctx.setFillStyle(color)
|
|
122
|
-
this.ctx.fill()
|
|
123
|
-
this.ctx.draw()
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
// 开始画
|
|
127
|
-
onTouchStart(e) {
|
|
128
|
-
// #ifdef APP
|
|
129
|
-
if(e.type != 'onTouchstart') return false
|
|
130
|
-
// #endif
|
|
131
|
-
// #ifdef MP-ALIPAY
|
|
132
|
-
if(e.type != 'touchStart') return false
|
|
133
|
-
// #endif
|
|
134
|
-
// #ifndef APP || MP-ALIPAY
|
|
135
|
-
if (e.type != 'touchstart') return false
|
|
136
|
-
// #endif
|
|
137
|
-
|
|
138
|
-
// 设置线条颜色
|
|
139
|
-
this.ctx.setFillStyle(this.currentSelectColor)
|
|
140
|
-
// 设置透明度
|
|
141
|
-
this.ctx.setGlobalAlpha(this.transparent)
|
|
142
|
-
let currentPoint = {
|
|
143
|
-
x: e.touches[0].x,
|
|
144
|
-
y: e.touches[0].y
|
|
145
|
-
}
|
|
146
|
-
let currentLine = this.currentLine;
|
|
147
|
-
currentLine.unshift({
|
|
148
|
-
time: new Date().getTime(),
|
|
149
|
-
dis: 0,
|
|
150
|
-
x: currentPoint.x,
|
|
151
|
-
y: currentPoint.y
|
|
152
|
-
})
|
|
153
|
-
this.currentPoint = currentPoint;
|
|
154
|
-
|
|
155
|
-
if (this.firstTouch) {
|
|
156
|
-
this.cutArea = {
|
|
157
|
-
top: currentPoint.y,
|
|
158
|
-
right: currentPoint.x,
|
|
159
|
-
bottom: currentPoint.y,
|
|
160
|
-
left: currentPoint.x
|
|
161
|
-
}
|
|
162
|
-
this.firstTouch = false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
this.pointToLine(currentLine)
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
// 正在画
|
|
169
|
-
onTouchMove(e) {
|
|
170
|
-
// #ifdef APP
|
|
171
|
-
if(e.type != 'onTouchmove') return false
|
|
172
|
-
// #endif
|
|
173
|
-
// #ifdef MP-ALIPAY
|
|
174
|
-
if(e.type != 'touchMove') return false
|
|
175
|
-
// #endif
|
|
176
|
-
// #ifndef APP || MP-ALIPAY
|
|
177
|
-
if (e.type != 'touchmove') return false
|
|
178
|
-
// #endif
|
|
179
|
-
if (e.cancelable) {
|
|
180
|
-
// 判断默认行为是否已经被禁用
|
|
181
|
-
if (!e.defaultPrevented) {
|
|
182
|
-
e.preventDefault()
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
let point = {
|
|
186
|
-
x: e.touches[0].x,
|
|
187
|
-
y: e.touches[0].y
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
if (point.y < this.cutArea.top) {
|
|
191
|
-
this.cutArea.top = point.y;
|
|
192
|
-
}
|
|
193
|
-
if (point.y < 0) this.cutArea.top = 0
|
|
194
|
-
|
|
195
|
-
if (point.x < this.cutArea.right) {
|
|
196
|
-
this.cutArea.right = point.x;
|
|
197
|
-
}
|
|
198
|
-
if (this.canvasWidth - point.x <= 0) {
|
|
199
|
-
this.cutArea.right = this.canvasWidth;
|
|
200
|
-
}
|
|
201
|
-
if (point.y > this.cutArea.bottom) {
|
|
202
|
-
this.cutArea.bottom = this.canvasHeight;
|
|
203
|
-
}
|
|
204
|
-
if (this.canvasHeight - point.y <= 0) {
|
|
205
|
-
this.cutArea.bottom = this.canvasHeight;
|
|
206
|
-
}
|
|
207
|
-
if (point.x < this.cutArea.left) {
|
|
208
|
-
this.cutArea.left = point.x;
|
|
209
|
-
}
|
|
210
|
-
if (point.x < 0) this.cutArea.left = 0
|
|
211
|
-
|
|
212
|
-
this.lastPoint = this.currentPoint;
|
|
213
|
-
this.currentPoint = point;
|
|
214
|
-
|
|
215
|
-
let currentLine = this.currentLine;
|
|
216
|
-
currentLine.unshift({
|
|
217
|
-
time: new Date().getTime(),
|
|
218
|
-
dis: this.distance(this.currentPoint, this.lastPoint),
|
|
219
|
-
x: point.x,
|
|
220
|
-
y: point.y
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
this.pointToLine(currentLine)
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
// 移动结束
|
|
227
|
-
onTouchEnd(e) {
|
|
228
|
-
// #ifdef APP
|
|
229
|
-
if(e.type != 'onTouchend') return false
|
|
230
|
-
// #endif
|
|
231
|
-
// #ifdef MP-ALIPAY
|
|
232
|
-
if(e.type != 'touchEnd') return false
|
|
233
|
-
// #endif
|
|
234
|
-
// #ifndef APP || MP-ALIPAY
|
|
235
|
-
if (e.type != 'touchend') return false
|
|
236
|
-
// #endif
|
|
237
|
-
let point = {
|
|
238
|
-
x: e.changedTouches[0].x,
|
|
239
|
-
y: e.changedTouches[0].y
|
|
240
|
-
}
|
|
241
|
-
this.lastPoint = this.currentPoint;
|
|
242
|
-
this.currentPoint = point;
|
|
243
|
-
|
|
244
|
-
let currentLine = this.currentLine;
|
|
245
|
-
currentLine.unshift({
|
|
246
|
-
time: new Date().getTime(),
|
|
247
|
-
dis: this.distance(this.currentPoint, this.lastPoint),
|
|
248
|
-
x: point.x,
|
|
249
|
-
y: point.y
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
//一笔结束,保存笔迹的坐标点,清空,当前笔迹
|
|
253
|
-
//增加判断是否在手写区域
|
|
254
|
-
this.pointToLine(currentLine)
|
|
255
|
-
let currentChirography = {
|
|
256
|
-
lineSize: this.lineSize,
|
|
257
|
-
lineColor: this.currentSelectColor
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
let chirography = this.chirography;
|
|
261
|
-
chirography.unshift(currentChirography)
|
|
262
|
-
this.chirography = chirography;
|
|
263
|
-
|
|
264
|
-
let linePrack = this.linePrack;
|
|
265
|
-
linePrack.unshift(this.currentLine)
|
|
266
|
-
this.linePrack = linePrack;
|
|
267
|
-
this.currentLine = [];
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
// 重置绘画板
|
|
271
|
-
reDraw() {
|
|
272
|
-
this.initCanvas('#FFFFFF')
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
// 保存
|
|
276
|
-
save() {
|
|
277
|
-
// 在组件内使用需要第二个参数this
|
|
278
|
-
uni.canvasToTempFilePath({
|
|
279
|
-
canvasId: this.canvasId,
|
|
280
|
-
fileType: 'png',
|
|
281
|
-
quality: 1,
|
|
282
|
-
success: (res) => {
|
|
283
|
-
if (this.rotate) {
|
|
284
|
-
this.getRotateImage(res.tempFilePath).then((res) => {
|
|
285
|
-
this.$emit('save', res)
|
|
286
|
-
}).catch(err => {
|
|
287
|
-
this.$fu.toast('旋转图片失败')
|
|
288
|
-
})
|
|
289
|
-
} else {
|
|
290
|
-
this.$emit('save', res.tempFilePath)
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
fail: () => {
|
|
294
|
-
this.$fu.toast('保存失败')
|
|
295
|
-
}
|
|
296
|
-
}, this)
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
// 预览图片
|
|
300
|
-
previewImage() {
|
|
301
|
-
// 在组件内使用需要第二个参数this
|
|
302
|
-
uni.canvasToTempFilePath({
|
|
303
|
-
canvasId: this.canvasId,
|
|
304
|
-
fileType: 'png',
|
|
305
|
-
quality: 1,
|
|
306
|
-
success: (res) => {
|
|
307
|
-
const tempFilePath = res.tempFilePath;
|
|
308
|
-
const previewImage = (urls) => {
|
|
309
|
-
uni.previewImage({
|
|
310
|
-
urls: urls
|
|
311
|
-
});
|
|
312
|
-
};
|
|
313
|
-
if (this.rotate) {
|
|
314
|
-
this.getRotateImage(tempFilePath).then(ret => previewImage([ret])).catch(err => {
|
|
315
|
-
this.$fu.toast('旋转图片失败');
|
|
316
|
-
});
|
|
317
|
-
} else {
|
|
318
|
-
previewImage([tempFilePath]);
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
fail: (e) => {
|
|
322
|
-
this.$fu.toast('预览失败')
|
|
323
|
-
}
|
|
324
|
-
}, this)
|
|
325
|
-
},
|
|
326
|
-
|
|
327
|
-
// 关闭签名板
|
|
328
|
-
closeBoard() {
|
|
329
|
-
uni.showModal({
|
|
330
|
-
title: '提示信息',
|
|
331
|
-
content: '关闭后内容将被清除,是否确认关闭?',
|
|
332
|
-
success: res => {
|
|
333
|
-
if (res.confirm) {
|
|
334
|
-
this.$emit('close')
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
})
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
// 切换画笔颜色
|
|
341
|
-
colorSwitch(color) {
|
|
342
|
-
this.currentSelectColor = color;
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
// 绘制两点之间的线条
|
|
346
|
-
pointToLine(line) {
|
|
347
|
-
this.calcBethelLine(line)
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
// 计算插值,让线条更加圆滑
|
|
351
|
-
calcBethelLine(line) {
|
|
352
|
-
if (line.length <= 1) {
|
|
353
|
-
line[0].r = this.radius;
|
|
354
|
-
return
|
|
355
|
-
}
|
|
356
|
-
let x0,
|
|
357
|
-
x1,
|
|
358
|
-
x2,
|
|
359
|
-
y0,
|
|
360
|
-
y1,
|
|
361
|
-
y2,
|
|
362
|
-
r0,
|
|
363
|
-
r1,
|
|
364
|
-
r2,
|
|
365
|
-
len,
|
|
366
|
-
lastRadius,
|
|
367
|
-
dis = 0,
|
|
368
|
-
time = 0,
|
|
369
|
-
curveValue = 0.5;
|
|
370
|
-
if (line.length <= 2) {
|
|
371
|
-
x0 = line[1].x;
|
|
372
|
-
y0 = line[1].y;
|
|
373
|
-
x2 = line[1].x + (line[0].x - line[1].x) * curveValue;
|
|
374
|
-
y2 = line[1].y + (line[0].y - line[1].y) * curveValue;
|
|
375
|
-
x1 = x0 + (x2 - x0) * curveValue;
|
|
376
|
-
y1 = y0 + (y2 - y0) * curveValue;
|
|
377
|
-
} else {
|
|
378
|
-
x0 = line[2].x + (line[1].x - line[2].x) * curveValue;
|
|
379
|
-
y0 = line[2].y + (line[1].y - line[2].y) * curveValue;
|
|
380
|
-
x1 = line[1].x;
|
|
381
|
-
y1 = line[1].y;
|
|
382
|
-
x2 = x1 + (line[0].x - x1) * curveValue;
|
|
383
|
-
y2 = y1 + (line[0].y - y1) * curveValue;
|
|
384
|
-
}
|
|
385
|
-
// 三个点分别是(x0,y0),(x1,y1),(x2,y2) ;(x1,y1)这个是控制点,控制点不会落在曲线上;实际上,这个点还会手写获取的实际点,却落在曲线上
|
|
386
|
-
len = this.distance({
|
|
387
|
-
x: x2,
|
|
388
|
-
y: y2
|
|
389
|
-
}, {
|
|
390
|
-
x: x0,
|
|
391
|
-
y: y0
|
|
392
|
-
});
|
|
393
|
-
lastRadius = this.radius;
|
|
394
|
-
for (let i = 0; i < line.length - 1; i++) {
|
|
395
|
-
dis += line[i].dis;
|
|
396
|
-
time += line[i].time - line[i + 1].time;
|
|
397
|
-
if (dis > this.smoothness) break
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
this.radius = Math.min((time / len) * this.pressure + this.minLine, this.maxLine) * this.lineSize;
|
|
401
|
-
line[0].r = this.radius;
|
|
402
|
-
// 计算笔迹半径
|
|
403
|
-
if (line.length <= 2) {
|
|
404
|
-
r0 = (lastRadius + this.radius) / 2;
|
|
405
|
-
r1 = r0;
|
|
406
|
-
r2 = r1;
|
|
407
|
-
} else {
|
|
408
|
-
r0 = (line[2].r + line[1].r) / 2;
|
|
409
|
-
r1 = line[1].r;
|
|
410
|
-
r2 = (line[1].r + line[0].r) / 2;
|
|
411
|
-
}
|
|
412
|
-
let n = 5;
|
|
413
|
-
let point = [];
|
|
414
|
-
for (let i = 0; i < n; i++) {
|
|
415
|
-
let t = i / (n - 1);
|
|
416
|
-
let x = (1 - t) * (1 - t) * x0 + 2 * t * (1 - t) * x1 + t * t * x2;
|
|
417
|
-
let y = (1 - t) * (1 - t) * y0 + 2 * t * (1 - t) * y1 + t * t * y2;
|
|
418
|
-
let r = lastRadius + ((this.radius - lastRadius) / n) * i;
|
|
419
|
-
point.push({
|
|
420
|
-
x,
|
|
421
|
-
y,
|
|
422
|
-
r
|
|
423
|
-
})
|
|
424
|
-
if (point.length === 3) {
|
|
425
|
-
let a = this.ctaCalc(point[0].x, point[0].y, point[0].r, point[1].x, point[1].y, point[1].r, point[
|
|
426
|
-
2].x, point[2].y, point[2].r)
|
|
427
|
-
a[0].color = this.currentSelectColor
|
|
428
|
-
|
|
429
|
-
this.drawBethel(a, true)
|
|
430
|
-
point = [{
|
|
431
|
-
x,
|
|
432
|
-
y,
|
|
433
|
-
r
|
|
434
|
-
}]
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
this.currentLine = line;
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
// 求两点之间的距离
|
|
441
|
-
distance(a, b) {
|
|
442
|
-
let x = b.x - a.x;
|
|
443
|
-
let y = b.y - a.y;
|
|
444
|
-
return Math.sqrt(x * x + y * y)
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
// 计算点信息
|
|
448
|
-
ctaCalc(x0, y0, r0, x1, y1, r1, x2, y2, r2) {
|
|
449
|
-
let a = [],
|
|
450
|
-
vx01,
|
|
451
|
-
vy01,
|
|
452
|
-
norm,
|
|
453
|
-
n_x0,
|
|
454
|
-
n_y0,
|
|
455
|
-
vx21,
|
|
456
|
-
vy21,
|
|
457
|
-
n_x2,
|
|
458
|
-
n_y2;
|
|
459
|
-
vx01 = x1 - x0;
|
|
460
|
-
vy01 = y1 - y0;
|
|
461
|
-
norm = Math.sqrt(vx01 * vx01 + vy01 * vy01 + 0.0001) * 2;
|
|
462
|
-
vx01 = (vx01 / norm) * r0;
|
|
463
|
-
vy01 = (vy01 / norm) * r0;
|
|
464
|
-
n_x0 = vy01;
|
|
465
|
-
n_y0 = -vx01;
|
|
466
|
-
vx21 = x1 - x2;
|
|
467
|
-
vy21 = y1 - y2;
|
|
468
|
-
norm = Math.sqrt(vx21 * vx21 + vy21 * vy21 + 0.0001) * 2;
|
|
469
|
-
vx21 = (vx21 / norm) * r2;
|
|
470
|
-
vy21 = (vy21 / norm) * r2;
|
|
471
|
-
n_x2 = -vy21;
|
|
472
|
-
n_y2 = vx21;
|
|
473
|
-
a.push({
|
|
474
|
-
mx: x0 + n_x0,
|
|
475
|
-
my: y0 + n_y0,
|
|
476
|
-
color: '#080808'
|
|
477
|
-
})
|
|
478
|
-
a.push({
|
|
479
|
-
c1x: x1 + n_x0,
|
|
480
|
-
c1y: y1 + n_y0,
|
|
481
|
-
c2x: x1 + n_x2,
|
|
482
|
-
c2y: y1 + n_y2,
|
|
483
|
-
ex: x2 + n_x2,
|
|
484
|
-
ey: y2 + n_y2
|
|
485
|
-
})
|
|
486
|
-
a.push({
|
|
487
|
-
c1x: x2 + n_x2 - vx21,
|
|
488
|
-
c1y: y2 + n_y2 - vy21,
|
|
489
|
-
c2x: x2 - n_x2 - vx21,
|
|
490
|
-
c2y: y2 - n_y2 - vy21,
|
|
491
|
-
ex: x2 - n_x2,
|
|
492
|
-
ey: y2 - n_y2
|
|
493
|
-
})
|
|
494
|
-
a.push({
|
|
495
|
-
c1x: x1 - n_x2,
|
|
496
|
-
c1y: y1 - n_y2,
|
|
497
|
-
c2x: x1 - n_x0,
|
|
498
|
-
c2y: y1 - n_y0,
|
|
499
|
-
ex: x0 - n_x0,
|
|
500
|
-
ey: y0 - n_y0
|
|
501
|
-
})
|
|
502
|
-
a.push({
|
|
503
|
-
c1x: x0 - n_x0 - vx01,
|
|
504
|
-
c1y: y0 - n_y0 - vy01,
|
|
505
|
-
c2x: x0 + n_x0 - vx01,
|
|
506
|
-
c2y: y0 + n_y0 - vy01,
|
|
507
|
-
ex: x0 + n_x0,
|
|
508
|
-
ey: y0 + n_y0
|
|
509
|
-
})
|
|
510
|
-
a[0].mx = a[0].mx.toFixed(1);
|
|
511
|
-
a[0].mx = parseFloat(a[0].mx);
|
|
512
|
-
a[0].my = a[0].my.toFixed(1);
|
|
513
|
-
a[0].my = parseFloat(a[0].my);
|
|
514
|
-
for (let i = 1; i < a.length; i++) {
|
|
515
|
-
a[i].c1x = a[i].c1x.toFixed(1);
|
|
516
|
-
a[i].c1x = parseFloat(a[i].c1x);
|
|
517
|
-
a[i].c1y = a[i].c1y.toFixed(1);
|
|
518
|
-
a[i].c1y = parseFloat(a[i].c1y);
|
|
519
|
-
a[i].c2x = a[i].c2x.toFixed(1);
|
|
520
|
-
a[i].c2x = parseFloat(a[i].c2x);
|
|
521
|
-
a[i].c2y = a[i].c2y.toFixed(1);
|
|
522
|
-
a[i].c2y = parseFloat(a[i].c2y);
|
|
523
|
-
a[i].ex = a[i].ex.toFixed(1);
|
|
524
|
-
a[i].ex = parseFloat(a[i].ex);
|
|
525
|
-
a[i].ey = a[i].ey.toFixed(1);
|
|
526
|
-
a[i].ey = parseFloat(a[i].ey);
|
|
527
|
-
}
|
|
528
|
-
return a
|
|
529
|
-
},
|
|
530
|
-
|
|
531
|
-
// 绘制贝塞尔曲线
|
|
532
|
-
drawBethel(point, is_fill, color) {
|
|
533
|
-
this.ctx.beginPath()
|
|
534
|
-
this.ctx.moveTo(point[0].mx, point[0].my)
|
|
535
|
-
if (color != undefined) {
|
|
536
|
-
this.ctx.setFillStyle(color)
|
|
537
|
-
this.ctx.setStrokeStyle(color)
|
|
538
|
-
} else {
|
|
539
|
-
this.ctx.setFillStyle(point[0].color)
|
|
540
|
-
this.ctx.setStrokeStyle(point[0].color)
|
|
541
|
-
}
|
|
542
|
-
for (let i = 1; i < point.length; i++) {
|
|
543
|
-
this.ctx.bezierCurveTo(point[i].c1x, point[i].c1y, point[i].c2x, point[i].c2y, point[i].ex, point[i].ey)
|
|
544
|
-
}
|
|
545
|
-
this.ctx.stroke()
|
|
546
|
-
if (is_fill != undefined) {
|
|
547
|
-
//填充图形 ( 后绘制的图形会覆盖前面的图形, 绘制时注意先后顺序 )
|
|
548
|
-
this.ctx.fill()
|
|
549
|
-
}
|
|
550
|
-
this.ctx.draw(true)
|
|
551
|
-
},
|
|
552
|
-
|
|
553
|
-
// 旋转图片
|
|
554
|
-
async getRotateImage(dataUrl) {
|
|
555
|
-
// const url = await this.base64ToPath(dataUrl)
|
|
556
|
-
const url = dataUrl;
|
|
557
|
-
// 创建新画布
|
|
558
|
-
const tempCtx = uni.createCanvasContext('temp-fu-sign-canvas', this);
|
|
559
|
-
const width = this.canvasWidth;
|
|
560
|
-
const height = this.canvasHeight;
|
|
561
|
-
tempCtx.restore()
|
|
562
|
-
tempCtx.save()
|
|
563
|
-
tempCtx.translate(0, height)
|
|
564
|
-
tempCtx.rotate(270 * Math.PI / 180)
|
|
565
|
-
tempCtx.drawImage(url, 0, 0, width, height)
|
|
566
|
-
tempCtx.draw()
|
|
567
|
-
return new Promise((resolve, reject) => {
|
|
568
|
-
setTimeout(() => {
|
|
569
|
-
uni.canvasToTempFilePath({
|
|
570
|
-
canvasId: 'temp-fu-sign-canvas',
|
|
571
|
-
fileType: 'png',
|
|
572
|
-
x: 0,
|
|
573
|
-
y: height - width,
|
|
574
|
-
width: height,
|
|
575
|
-
height: width,
|
|
576
|
-
success: res => resolve(res.tempFilePath),
|
|
577
|
-
fail: reject
|
|
578
|
-
}, this)
|
|
579
|
-
}, 50)
|
|
580
|
-
})
|
|
581
|
-
},
|
|
582
|
-
|
|
583
|
-
// 将base64转换为本地
|
|
584
|
-
base64ToPath(dataUrl) {
|
|
585
|
-
return new Promise((resolve, reject) => {
|
|
586
|
-
// 判断地址是否包含bas64字样,不包含直接返回
|
|
587
|
-
if (dataUrl.indexOf('base64') !== -1) {
|
|
588
|
-
const data = uni.base64ToArrayBuffer(dataUrl.replace(/^data:image\/\w+;base64,/, ''));
|
|
589
|
-
// #ifdef MP-WEIXIN
|
|
590
|
-
const filePath = `${wx.env.USER_DATA_PATH}/${new Date().getTime()}-${Math.random().toString(32).slice(2)}.png`;
|
|
591
|
-
// #endif
|
|
592
|
-
// #ifndef MP-WEIXIN
|
|
593
|
-
const filePath = `${new Date().getTime()}-${Math.random().toString(32).slice(2)}.png`;
|
|
594
|
-
// #endif
|
|
595
|
-
uni.getFileSystemManager().writeFile({
|
|
596
|
-
filePath,
|
|
597
|
-
data,
|
|
598
|
-
encoding: 'base64',
|
|
599
|
-
success: () => resolve(filePath),
|
|
600
|
-
fail: reject
|
|
601
|
-
})
|
|
602
|
-
} else {
|
|
603
|
-
resolve(dataUrl)
|
|
604
|
-
}
|
|
605
|
-
})
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
watch: {
|
|
609
|
-
show(value) {
|
|
610
|
-
if (value && this.canvasWidth === 0 && this.canvasHeight === 0) {
|
|
611
|
-
// 获取画板的相关信息
|
|
612
|
-
this.$nextTick(() => {
|
|
613
|
-
this.getCanvasInfo()
|
|
614
|
-
})
|
|
615
|
-
}
|
|
616
|
-
},
|
|
617
|
-
signSelectColor(value) {
|
|
618
|
-
if (value.length > 0) {
|
|
619
|
-
this.currentSelectColor = value[0];
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
</script>
|
|
625
|
-
|
|
626
|
-
<style lang="scss" scoped>
|
|
627
|
-
.fu-sign-board {
|
|
628
|
-
position: fixed;
|
|
629
|
-
top: 0;
|
|
630
|
-
left: 0;
|
|
631
|
-
right: 0;
|
|
632
|
-
bottom: 0;
|
|
633
|
-
width: 100%;
|
|
634
|
-
height: 100%;
|
|
635
|
-
background-color: #E6E6E6;
|
|
636
|
-
z-index: 997;
|
|
637
|
-
display: flex;
|
|
638
|
-
flex-direction: row-reverse;
|
|
639
|
-
|
|
640
|
-
&__content {
|
|
641
|
-
width: 84%;
|
|
642
|
-
height: 100%;
|
|
643
|
-
|
|
644
|
-
&__wrapper {
|
|
645
|
-
width: calc(100% - 60rpx);
|
|
646
|
-
height: calc(100% - 60rpx);
|
|
647
|
-
margin: 30rpx;
|
|
648
|
-
border-radius: 20rpx;
|
|
649
|
-
border: 2rpx dotted #AAAAAA;
|
|
650
|
-
overflow: hidden;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
&__canvas {
|
|
654
|
-
width: 100%;
|
|
655
|
-
height: 100%;
|
|
656
|
-
background-color: #FFFFFF;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
&__tools {
|
|
661
|
-
width: 16%;
|
|
662
|
-
height: 100%;
|
|
663
|
-
display: flex;
|
|
664
|
-
flex-direction: column;
|
|
665
|
-
align-items: center;
|
|
666
|
-
justify-content: space-between;
|
|
667
|
-
|
|
668
|
-
&__color {
|
|
669
|
-
margin-top: 30rpx;
|
|
670
|
-
|
|
671
|
-
&__item {
|
|
672
|
-
width: 70rpx;
|
|
673
|
-
height: 70rpx;
|
|
674
|
-
border-radius: 100rpx;
|
|
675
|
-
margin: 20rpx auto;
|
|
676
|
-
|
|
677
|
-
&--active {
|
|
678
|
-
position: relative;
|
|
679
|
-
|
|
680
|
-
&::after {
|
|
681
|
-
content: '';
|
|
682
|
-
position: absolute;
|
|
683
|
-
top: 50%;
|
|
684
|
-
left: 50%;
|
|
685
|
-
width: 40%;
|
|
686
|
-
height: 40%;
|
|
687
|
-
border-radius: 100rpx;
|
|
688
|
-
background-color: #FFFFFF;
|
|
689
|
-
transform: translate(-50%, -50%);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
&__button {
|
|
696
|
-
margin-bottom: 30rpx;
|
|
697
|
-
display: flex;
|
|
698
|
-
flex-direction: column;
|
|
699
|
-
|
|
700
|
-
&__item {
|
|
701
|
-
width: 130rpx;
|
|
702
|
-
height: 60rpx;
|
|
703
|
-
line-height: 60rpx;
|
|
704
|
-
text-align: center;
|
|
705
|
-
margin: 60rpx auto;
|
|
706
|
-
border-radius: 10rpx;
|
|
707
|
-
color: #FFFFFF;
|
|
708
|
-
transform-origin: center center;
|
|
709
|
-
transform: rotateZ(90deg);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
.fu-bg-red {
|
|
716
|
-
background-color: #E83A30;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
.fu-bg-blue {
|
|
720
|
-
background-color: #3D7EFF;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
.fu-bg-indigo {
|
|
724
|
-
background-color: #31C9E8;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
.fu-bg-orange {
|
|
728
|
-
background-color: #FFA726;
|
|
729
|
-
}
|
|
730
|
-
</style>
|