@10yun/cv-mobile-ui 0.5.53 → 0.5.55
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/build/parse-create.js +17 -5
- package/build/parse-pages-pkg.js +14 -5
- package/js-sdk/Sansnn-uQRCode/uqrcode.js +150 -75
- package/js-sdk/clipboard.min.js +9 -0
- package/js-sdk/gprint/encoding-indexes.js +47 -0
- package/js-sdk/gprint/encoding.js +3312 -0
- package/js-sdk/gprint/esc.js +548 -0
- package/js-sdk/gprint/tsc.js +222 -0
- package/js-sdk/ican-H5Api/ican-H5Api.js +68 -666
- package/other/api-set-tabbar.nvue +0 -3
- package/other/lime-painter/changelog.md +225 -0
- package/other/lime-painter/components/common/relation.js +150 -0
- package/other/lime-painter/components/l-painter/l-painter.vue +482 -0
- package/other/lime-painter/components/l-painter/nvue.js +203 -0
- package/other/lime-painter/components/l-painter/painter.js +1 -0
- package/other/lime-painter/components/l-painter/props.js +56 -0
- package/other/lime-painter/components/l-painter/single.js +1 -0
- package/other/lime-painter/components/l-painter/utils.js +382 -0
- package/other/lime-painter/components/l-painter-image/l-painter-image.vue +23 -0
- package/other/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue +22 -0
- package/other/lime-painter/components/l-painter-text/l-painter-text.vue +32 -0
- package/other/lime-painter/components/l-painter-view/l-painter-view.vue +28 -0
- package/other/lime-painter/components/lime-painter/lime-painter.vue +259 -0
- package/other/lime-painter/hybrid/html/index.html +117 -0
- package/other/lime-painter/hybrid/html/painter.js +1 -0
- package/other/lime-painter/hybrid/html/uni.webview.1.5.3.js +1 -0
- package/other/lime-painter/package.json +93 -0
- package/other/lime-painter/parser.js +388 -0
- package/other/lime-painter/readme.md +961 -0
- package/other/lime-painter2/README2.md +576 -0
- package/other/lime-painter2/changelog.md +225 -0
- package/other/lime-painter2/components/lime-painter/canvas.js +57 -0
- package/other/lime-painter2/components/lime-painter/draw.js +654 -0
- package/other/lime-painter2/components/lime-painter/draw2.js +709 -0
- package/other/lime-painter2/components/lime-painter/gradient.js +119 -0
- package/other/lime-painter2/components/lime-painter/index.vue +344 -0
- package/other/lime-painter2/components/lime-painter/index2.vue +197 -0
- package/other/lime-painter2/components/lime-painter/layout.js +374 -0
- package/other/lime-painter2/components/lime-painter/utils.js +420 -0
- package/other/lime-painter2/package.json +93 -0
- package/other/lime-painter2/readme.md +758 -0
- package/other/lime-painter2/test.md +45 -0
- package/other/mpvue-echarts/src/echarts.vue +116 -103
- package/other/mpvue-echarts/src/style.css +0 -6
- package/other/product.vue +45 -1
- package/other/qiun-data-charts/qiun-data-charts.vue +1618 -0
- package/other/u-parse-2019/components/wxParseAudio.vue +29 -0
- package/other/u-parse-2019/components/wxParseImg.vue +87 -0
- package/other/u-parse-2019/components/wxParseTemplate0.vue +105 -0
- package/other/u-parse-2019/components/wxParseTemplate1.vue +96 -0
- package/other/u-parse-2019/components/wxParseTemplate10.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate11.vue +84 -0
- package/other/u-parse-2019/components/wxParseTemplate2.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate3.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate4.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate5.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate6.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate7.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate8.vue +95 -0
- package/other/u-parse-2019/components/wxParseTemplate9.vue +95 -0
- package/other/u-parse-2019/components/wxParseVideo.vue +15 -0
- package/other/u-parse-2019/libs/html2json.js +258 -0
- package/other/u-parse-2019/libs/htmlparser.js +163 -0
- package/other/u-parse-2019/libs/wxDiscode.js +195 -0
- package/other/u-parse-2019/readme.md +99 -0
- package/other/u-parse-2019/u-parse.css +240 -0
- package/other/u-parse-2019/u-parse.vue +114 -0
- package/other/u-parse2026/components/wxParseAudio.vue +29 -0
- package/other/u-parse2026/components/wxParseImg.vue +90 -0
- package/other/u-parse2026/components/wxParseTable.vue +51 -0
- package/other/u-parse2026/components/wxParseTemplate0.vue +93 -0
- package/other/u-parse2026/components/wxParseTemplate1.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate10.vue +82 -0
- package/other/u-parse2026/components/wxParseTemplate11.vue +79 -0
- package/other/u-parse2026/components/wxParseTemplate2.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate3.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate4.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate5.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate6.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate7.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate8.vue +92 -0
- package/other/u-parse2026/components/wxParseTemplate9.vue +82 -0
- package/other/u-parse2026/components/wxParseVideo.vue +15 -0
- package/other/u-parse2026/libs/html2json.js +258 -0
- package/other/u-parse2026/libs/htmlparser.js +163 -0
- package/other/u-parse2026/libs/wxDiscode.js +195 -0
- package/other/u-parse2026/readme.md +99 -0
- package/other/u-parse2026/u-parse.css +283 -0
- package/other/u-parse2026/u-parse.vue +114 -0
- package/other/uParse/components/wxParseVideo.vue +2 -1
- package/other/xt-parse/changelog.md +41 -0
- package/other/xt-parse/node/node.vue +752 -0
- package/other/xt-parse/package.json +129 -0
- package/other/xt-parse/parser.js +1461 -0
- package/other/xt-parse/props.js +49 -0
- package/other/xt-parse/readme.md +145 -0
- package/other/xt-parse/static/app-plus/u-parse/js/handler.js +1 -0
- package/other/xt-parse/static/app-plus/u-parse/js/handler2.js +224 -0
- package/other/xt-parse/static/app-plus/u-parse/js/uni.webview.min.js +1 -0
- package/other/xt-parse/static/app-plus/u-parse/js/uni.webview.min2.js +186 -0
- package/other/xt-parse/static/app-plus/u-parse/local.html +37 -0
- package/other/xt-parse/u-parse.vue +510 -0
- package/other/z-paging/changelog.md +52 -0
- package/other/z-paging/components/z-paging/components/z-paging-load-more.vue +182 -0
- package/other/z-paging/components/z-paging/components/z-paging-refresh.vue +214 -0
- package/other/z-paging/components/z-paging/config/index.js +3 -0
- package/other/z-paging/components/z-paging/css/z-paging-main.css +241 -0
- package/other/z-paging/components/z-paging/css/z-paging-static.css +50 -0
- package/other/z-paging/components/z-paging/i18n/en.json +23 -0
- package/other/z-paging/components/z-paging/i18n/index.js +8 -0
- package/other/z-paging/components/z-paging/i18n/zh-Hans.json +23 -0
- package/other/z-paging/components/z-paging/i18n/zh-Hant.json +23 -0
- package/other/z-paging/components/z-paging/js/hooks/useZPaging.js +25 -0
- package/other/z-paging/components/z-paging/js/hooks/useZPagingComp.js +25 -0
- package/other/z-paging/components/z-paging/js/modules/back-to-top.js +125 -0
- package/other/z-paging/components/z-paging/js/modules/chat-record-mode.js +149 -0
- package/other/z-paging/components/z-paging/js/modules/common-layout.js +152 -0
- package/other/z-paging/components/z-paging/js/modules/data-handle.js +736 -0
- package/other/z-paging/components/z-paging/js/modules/empty.js +144 -0
- package/other/z-paging/components/z-paging/js/modules/i18n.js +113 -0
- package/other/z-paging/components/z-paging/js/modules/load-more.js +374 -0
- package/other/z-paging/components/z-paging/js/modules/loading.js +95 -0
- package/other/z-paging/components/z-paging/js/modules/nvue.js +268 -0
- package/other/z-paging/components/z-paging/js/modules/refresher.js +831 -0
- package/other/z-paging/components/z-paging/js/modules/scroller.js +550 -0
- package/other/z-paging/components/z-paging/js/modules/virtual-list.js +555 -0
- package/other/z-paging/components/z-paging/js/z-paging-constant.js +19 -0
- package/other/z-paging/components/z-paging/js/z-paging-enum.js +45 -0
- package/other/z-paging/components/z-paging/js/z-paging-interceptor.js +97 -0
- package/other/z-paging/components/z-paging/js/z-paging-main.js +515 -0
- package/other/z-paging/components/z-paging/js/z-paging-mixin.js +22 -0
- package/other/z-paging/components/z-paging/js/z-paging-static.js +13 -0
- package/other/z-paging/components/z-paging/js/z-paging-utils.js +302 -0
- package/other/z-paging/components/z-paging/wxs/z-paging-renderjs.js +67 -0
- package/other/z-paging/components/z-paging/wxs/z-paging-wxs.wxs +382 -0
- package/other/z-paging/components/z-paging/z-paging.vue +538 -0
- package/other/z-paging/components/z-paging-cell/z-paging-cell.vue +47 -0
- package/other/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue +209 -0
- package/other/z-paging/components/z-paging-swiper/z-paging-swiper.vue +176 -0
- package/other/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue +171 -0
- package/other/z-paging/package.json +89 -0
- package/other/z-paging/readme.md +57 -0
- package/other/z-paging/types/comps/_common.d.ts +9 -0
- package/other/z-paging/types/comps/z-paging-cell.d.ts +29 -0
- package/other/z-paging/types/comps/z-paging-empty-view.d.ts +95 -0
- package/other/z-paging/types/comps/z-paging-swiper-item.d.ts +95 -0
- package/other/z-paging/types/comps/z-paging-swiper.d.ts +89 -0
- package/other/z-paging/types/comps/z-paging.d.ts +2083 -0
- package/other/z-paging/types/comps.d.ts +11 -0
- package/other/z-paging/types/index.d.ts +24 -0
- package/package.json +7 -7
- package/plugins/tui-validation.js +279 -0
- package/plugins/uni-async.js +28 -0
- package/ui-cv/components/cv-draw-gesture-lock/cv-draw-gesture-lock.vue +39 -1
- package/ui-cv/components/cv-draw-qrcode/cv-draw-qrcode.vue +18 -14
- package/ui-cv/components/cv-geo-region/mpvueCityPicker.vue +77 -1
- package/ui-cv/components/cv-lists-base/cv-lists-base.vue +2 -2
- package/ui-cv/components/cv-tab-lists/cv-tab-lists.vue +2 -2
- package/ui-fireui/components/u-icon/u-icon.vue +63 -1
- package/ui-sdks/qiun-data-charts/changelog.md +320 -0
- package/ui-sdks/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue +1618 -0
- package/ui-sdks/qiun-data-charts/components/qiun-error/qiun-error.vue +46 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/loading1.vue +162 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/loading2.vue +170 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/loading3.vue +173 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/loading4.vue +222 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/loading5.vue +229 -0
- package/ui-sdks/qiun-data-charts/components/qiun-loading/qiun-loading.vue +36 -0
- package/ui-sdks/qiun-data-charts/js_sdk/u-charts/config-echarts.js +422 -0
- package/ui-sdks/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +606 -0
- package/ui-sdks/qiun-data-charts/js_sdk/u-charts/readme.md +5 -0
- package/ui-sdks/qiun-data-charts/js_sdk/u-charts/u-charts.js +7706 -0
- package/ui-sdks/qiun-data-charts/js_sdk/u-charts/u-charts.min.js +18 -0
- package/ui-sdks/qiun-data-charts/license.md +201 -0
- package/ui-sdks/qiun-data-charts/package.json +80 -0
- package/ui-sdks/qiun-data-charts/readme.md +84 -0
- package/ui-sdks/qiun-data-charts/static/app-plus/echarts.min.js +23 -0
- package/ui-sdks/qiun-data-charts/static/h5/echarts.min.js +23 -0
- package/ui-sdks/tui-clipboard/tui-clipboard.js +53 -0
- package/uni-ui/lib/uni-badge/changelog.md +33 -0
- package/uni-ui/lib/uni-badge/package.json +107 -0
- package/uni-ui/lib/uni-badge/readme.md +8 -0
- package/uni-ui/lib/uni-badge/uni-badge.vue +87 -4
- package/uni-ui/lib/uni-breadcrumb/changelog.md +6 -0
- package/uni-ui/lib/uni-breadcrumb/package.json +104 -0
- package/uni-ui/lib/uni-breadcrumb/readme.md +66 -0
- package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +8 -1
- package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +38 -1
- package/uni-ui/lib/uni-calendar/calendar.js +0 -2
- package/uni-ui/lib/uni-calendar/changelog.md +30 -0
- package/uni-ui/lib/uni-calendar/package.json +105 -0
- package/uni-ui/lib/uni-calendar/readme.md +103 -0
- package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +83 -1
- package/uni-ui/lib/uni-calendar/uni-calendar.vue +206 -8
- package/uni-ui/lib/uni-calendar/util.js +1 -1
- package/uni-ui/lib/uni-card/changelog.md +26 -0
- package/uni-ui/lib/uni-card/package.json +107 -0
- package/uni-ui/lib/uni-card/readme.md +10 -0
- package/uni-ui/lib/uni-card/uni-card.vue +127 -4
- package/uni-ui/lib/uni-col/uni-col.vue +2155 -2
- package/uni-ui/lib/uni-collapse/changelog.md +48 -0
- package/uni-ui/lib/uni-collapse/package.json +106 -0
- package/uni-ui/lib/uni-collapse/readme.md +11 -0
- package/uni-ui/lib/uni-collapse/uni-collapse.vue +13 -1
- package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +127 -2
- package/uni-ui/lib/uni-combox/changelog.md +17 -0
- package/uni-ui/lib/uni-combox/package.json +107 -0
- package/uni-ui/lib/uni-combox/readme.md +10 -0
- package/uni-ui/lib/uni-combox/uni-combox.vue +145 -19
- package/uni-ui/lib/uni-countdown/changelog.md +30 -0
- package/uni-ui/lib/uni-countdown/package.json +105 -0
- package/uni-ui/lib/uni-countdown/readme.md +9 -0
- package/uni-ui/lib/uni-countdown/uni-countdown.vue +43 -16
- package/uni-ui/lib/uni-data-checkbox/changelog.md +51 -0
- package/uni-ui/lib/uni-data-checkbox/package.json +107 -0
- package/uni-ui/lib/uni-data-checkbox/readme.md +17 -0
- package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +326 -5
- package/uni-ui/lib/uni-data-picker/changelog.md +81 -0
- package/uni-ui/lib/uni-data-picker/package.json +109 -0
- package/uni-ui/lib/uni-data-picker/readme.md +21 -0
- package/uni-ui/lib/uni-data-picker/uni-data-picker.uvue +380 -0
- package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +52 -4
- package/uni-ui/lib/uni-data-pickerview/loading.uts +1 -0
- package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +150 -157
- package/uni-ui/lib/uni-data-pickerview/uni-data-picker.uts +693 -0
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +76 -0
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.uvue +69 -0
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +163 -1
- package/uni-ui/lib/uni-data-select/changelog.md +51 -0
- package/uni-ui/lib/uni-data-select/package.json +106 -0
- package/uni-ui/lib/uni-data-select/readme.md +7 -0
- package/uni-ui/lib/uni-data-select/uni-data-select.vue +555 -45
- package/uni-ui/lib/uni-dateformat/changelog.md +10 -0
- package/uni-ui/lib/uni-dateformat/package.json +107 -0
- package/uni-ui/lib/uni-dateformat/readme.md +10 -0
- package/uni-ui/lib/uni-dateformat/uni-dateformat.vue +2 -0
- package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +113 -1
- package/uni-ui/lib/uni-datetime-picker/calendar.vue +340 -20
- package/uni-ui/lib/uni-datetime-picker/changelog.md +177 -0
- package/uni-ui/lib/uni-datetime-picker/keypress.js +45 -0
- package/uni-ui/lib/uni-datetime-picker/package.json +107 -0
- package/uni-ui/lib/uni-datetime-picker/readme.md +20 -0
- package/uni-ui/lib/uni-datetime-picker/time-picker.vue +200 -8
- package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +287 -9
- package/uni-ui/lib/uni-datetime-picker/util.js +102 -85
- package/uni-ui/lib/uni-drawer/changelog.md +13 -0
- package/uni-ui/lib/uni-drawer/package.json +106 -0
- package/uni-ui/lib/uni-drawer/readme.md +9 -0
- package/uni-ui/lib/uni-drawer/uni-drawer.vue +72 -2
- package/uni-ui/lib/uni-easyinput/changelog.md +121 -0
- package/uni-ui/lib/uni-easyinput/common.js +0 -2
- package/uni-ui/lib/uni-easyinput/package.json +107 -0
- package/uni-ui/lib/uni-easyinput/readme.md +10 -0
- package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +247 -5
- package/uni-ui/lib/uni-fab/changelog.md +25 -0
- package/uni-ui/lib/uni-fab/package.json +107 -0
- package/uni-ui/lib/uni-fab/readme.md +8 -0
- package/uni-ui/lib/uni-fab/uni-fab.vue +255 -2
- package/uni-ui/lib/uni-fav/changelog.md +19 -0
- package/uni-ui/lib/uni-fav/package.json +106 -0
- package/uni-ui/lib/uni-fav/readme.md +9 -0
- package/uni-ui/lib/uni-fav/uni-fav.vue +45 -1
- package/uni-ui/lib/uni-file-picker/changelog.md +91 -0
- package/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +67 -4
- package/uni-ui/lib/uni-file-picker/package.json +105 -0
- package/uni-ui/lib/uni-file-picker/readme.md +10 -0
- package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +42 -22
- package/uni-ui/lib/uni-file-picker/upload-file.vue +152 -1
- package/uni-ui/lib/uni-file-picker/upload-image.vue +107 -5
- package/uni-ui/lib/uni-forms/changelog.md +100 -0
- package/uni-ui/lib/uni-forms/package.json +107 -0
- package/uni-ui/lib/uni-forms/readme.md +22 -0
- package/uni-ui/lib/uni-forms/uni-forms.vue +30 -3
- package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +181 -6
- package/uni-ui/lib/uni-goods-nav/changelog.md +18 -0
- package/uni-ui/lib/uni-goods-nav/package.json +105 -0
- package/uni-ui/lib/uni-goods-nav/readme.md +9 -0
- package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +124 -1
- package/uni-ui/lib/uni-grid/changelog.md +13 -0
- package/uni-ui/lib/uni-grid/package.json +106 -0
- package/uni-ui/lib/uni-grid/readme.md +10 -0
- package/uni-ui/lib/uni-grid/uni-grid.vue +36 -2
- package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +57 -2
- package/uni-ui/lib/uni-group/changelog.md +16 -0
- package/uni-ui/lib/uni-group/package.json +106 -0
- package/uni-ui/lib/uni-group/readme.md +8 -0
- package/uni-ui/lib/uni-group/uni-group.vue +50 -1
- package/uni-ui/lib/uni-icons/changelog.md +22 -0
- package/uni-ui/lib/uni-icons/package.json +77 -8
- package/uni-ui/lib/uni-icons/readme.md +0 -1
- package/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
- package/uni-ui/lib/uni-icons/uni-icons.vue +37 -13
- package/uni-ui/lib/uni-icons/uniicons.css +32 -31
- package/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
- package/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
- package/uni-ui/lib/uni-indexed-list/changelog.md +19 -0
- package/uni-ui/lib/uni-indexed-list/package.json +107 -0
- package/uni-ui/lib/uni-indexed-list/readme.md +10 -0
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +90 -2
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +91 -3
- package/uni-ui/lib/uni-link/changelog.md +17 -0
- package/uni-ui/lib/uni-link/package.json +106 -0
- package/uni-ui/lib/uni-link/readme.md +10 -0
- package/uni-ui/lib/uni-link/uni-link.vue +3 -0
- package/uni-ui/lib/uni-list/changelog.md +52 -0
- package/uni-ui/lib/uni-list/package.json +108 -0
- package/uni-ui/lib/uni-list/readme.md +44 -0
- package/uni-ui/lib/uni-list/uni-list.vue +44 -1
- package/uni-ui/lib/uni-list/uni-refresh.vue +2 -0
- package/uni-ui/lib/uni-list/uni-refresh.wxs +1 -1
- package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +33 -1
- package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +265 -1
- package/uni-ui/lib/uni-list-item/uni-list-item.vue +185 -1
- package/uni-ui/lib/uni-load-more/changelog.md +27 -0
- package/uni-ui/lib/uni-load-more/package.json +105 -0
- package/uni-ui/lib/uni-load-more/readme.md +12 -0
- package/uni-ui/lib/uni-load-more/uni-load-more.vue +252 -1
- package/uni-ui/lib/uni-nav-bar/changelog.md +64 -0
- package/uni-ui/lib/uni-nav-bar/package.json +106 -0
- package/uni-ui/lib/uni-nav-bar/readme.md +13 -0
- package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +199 -5
- package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +11 -1
- package/uni-ui/lib/uni-notice-bar/changelog.md +22 -0
- package/uni-ui/lib/uni-notice-bar/package.json +107 -0
- package/uni-ui/lib/uni-notice-bar/readme.md +11 -0
- package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +136 -8
- package/uni-ui/lib/uni-number-box/changelog.md +39 -0
- package/uni-ui/lib/uni-number-box/package.json +104 -0
- package/uni-ui/lib/uni-number-box/readme.md +11 -0
- package/uni-ui/lib/uni-number-box/uni-number-box.vue +73 -4
- package/uni-ui/lib/uni-pagination/changelog.md +27 -0
- package/uni-ui/lib/uni-pagination/package.json +106 -0
- package/uni-ui/lib/uni-pagination/readme.md +10 -0
- package/uni-ui/lib/uni-pagination/uni-pagination.vue +157 -1
- package/uni-ui/lib/uni-popup/changelog.md +102 -0
- package/uni-ui/lib/uni-popup/package.json +107 -0
- package/uni-ui/lib/uni-popup/readme.md +15 -0
- package/uni-ui/lib/uni-popup/uni-popup.uvue +90 -0
- package/uni-ui/lib/uni-popup/uni-popup.vue +108 -15
- package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +167 -11
- package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +70 -1
- package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +87 -6
- package/uni-ui/lib/uni-rate/changelog.md +27 -0
- package/uni-ui/lib/uni-rate/package.json +106 -0
- package/uni-ui/lib/uni-rate/readme.md +11 -0
- package/uni-ui/lib/uni-rate/uni-rate.vue +64 -29
- package/uni-ui/lib/uni-row/changelog.md +10 -0
- package/uni-ui/lib/uni-row/package.json +106 -0
- package/uni-ui/lib/uni-row/readme.md +9 -0
- package/uni-ui/lib/uni-row/uni-row.vue +66 -1
- package/uni-ui/lib/uni-row/uni-row2.vue +144 -0
- package/uni-ui/lib/uni-scss/package.json +56 -39
- package/uni-ui/lib/uni-scss/readme.md +0 -1
- package/uni-ui/lib/uni-search-bar/changelog.md +47 -0
- package/uni-ui/lib/uni-search-bar/package.json +106 -0
- package/uni-ui/lib/uni-search-bar/readme.md +12 -0
- package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +85 -4
- package/uni-ui/lib/uni-section/changelog.md +2 -0
- package/uni-ui/lib/uni-section/package.json +104 -0
- package/uni-ui/lib/uni-section/readme.md +7 -0
- package/uni-ui/lib/uni-section/uni-section.vue +61 -1
- package/uni-ui/lib/uni-segmented-control/changelog.md +15 -0
- package/uni-ui/lib/uni-segmented-control/package.json +106 -0
- package/uni-ui/lib/uni-segmented-control/readme.md +11 -0
- package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +67 -5
- package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +3 -1
- package/uni-ui/lib/uni-steps/changelog.md +18 -0
- package/uni-ui/lib/uni-steps/package.json +106 -0
- package/uni-ui/lib/uni-steps/readme.md +11 -0
- package/uni-ui/lib/uni-steps/uni-steps.vue +201 -7
- package/uni-ui/lib/uni-swipe-action/changelog.md +60 -0
- package/uni-ui/lib/uni-swipe-action/package.json +113 -0
- package/uni-ui/lib/uni-swipe-action/readme.md +10 -0
- package/uni-ui/lib/uni-swipe-action/uni-swipe-action.vue +60 -1
- package/uni-ui/lib/uni-swipe-action-item/bindingx.js +286 -282
- package/uni-ui/lib/uni-swipe-action-item/mpwxs.js +1 -1
- package/uni-ui/lib/uni-swipe-action-item/render.js +21 -14
- package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +139 -18
- package/uni-ui/lib/uni-swipe-action-item/wx.wxs +10 -2
- package/uni-ui/lib/uni-swiper-dot/changelog.md +12 -0
- package/uni-ui/lib/uni-swiper-dot/package.json +106 -0
- package/uni-ui/lib/uni-swiper-dot/readme.md +10 -0
- package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +98 -2
- package/uni-ui/lib/uni-table/changelog.md +35 -0
- package/uni-ui/lib/uni-table/i18n/en.json +9 -0
- package/uni-ui/lib/uni-table/i18n/es.json +9 -0
- package/uni-ui/lib/uni-table/i18n/fr.json +9 -0
- package/uni-ui/lib/uni-table/i18n/index.js +12 -0
- package/uni-ui/lib/uni-table/i18n/zh-Hans.json +9 -0
- package/uni-ui/lib/uni-table/i18n/zh-Hant.json +9 -0
- package/uni-ui/lib/uni-table/package.json +106 -0
- package/uni-ui/lib/uni-table/readme.md +11 -0
- package/uni-ui/lib/uni-table/uni-table.vue +162 -1
- package/uni-ui/lib/uni-tag/changelog.md +25 -0
- package/uni-ui/lib/uni-tag/package.json +106 -0
- package/uni-ui/lib/uni-tag/readme.md +11 -0
- package/uni-ui/lib/uni-tag/uni-tag.vue +111 -3
- package/uni-ui/lib/uni-tbody/uni-tbody.vue +1 -1
- package/uni-ui/lib/uni-td/uni-td.vue +19 -1
- package/uni-ui/lib/uni-th/filter-dropdown.vue +224 -2
- package/uni-ui/lib/uni-th/uni-th.vue +82 -1
- package/uni-ui/lib/uni-thead/uni-thead.vue +53 -2
- package/uni-ui/lib/uni-title/changelog.md +10 -0
- package/uni-ui/lib/uni-title/package.json +107 -0
- package/uni-ui/lib/uni-title/readme.md +12 -0
- package/uni-ui/lib/uni-title/uni-title.vue +1 -1
- package/uni-ui/lib/uni-tooltip/changelog.md +16 -0
- package/uni-ui/lib/uni-tooltip/package.json +104 -0
- package/uni-ui/lib/uni-tooltip/readme.md +7 -0
- package/uni-ui/lib/uni-tooltip/uni-tooltip.vue +1 -1
- package/uni-ui/lib/uni-tr/table-checkbox.vue +85 -1
- package/uni-ui/lib/uni-tr/uni-tr.vue +45 -3
- package/uni-ui/lib/uni-transition/changelog.md +31 -0
- package/uni-ui/lib/uni-transition/package.json +112 -0
- package/uni-ui/lib/uni-transition/readme.md +10 -0
- package/uni-ui/lib/uni-transition/uni-transition.vue +36 -32
- package/uni-ui/lib/uni-ui/changelog.md +639 -0
- package/uni-ui/lib/uni-ui/package.json +148 -0
- package/uni-ui/lib/uni-ui/readme.md +247 -0
- package/uni-ui/lib/uni-ui/uni-ui.vue +7 -0
- package/uni-ui/package.json +1 -1
- package/uview-plus/components/u-action-sheet/u-action-sheet.vue +56 -1
- package/uview-plus/components/u-action-sheet-data/u-action-sheet-data.vue +10 -1
- package/uview-plus/components/u-agreement/u-agreement.vue +14 -3
- package/uview-plus/components/u-album/u-album.vue +29 -1
- package/uview-plus/components/u-alert/u-alert.vue +96 -1
- package/uview-plus/components/u-avatar/u-avatar.vue +21 -1
- package/uview-plus/components/u-avatar-group/u-avatar-group.vue +28 -1
- package/uview-plus/components/u-back-top/u-back-top.vue +16 -1
- package/uview-plus/components/u-badge/u-badge.vue +57 -1
- package/uview-plus/components/u-box/u-box.vue +101 -3
- package/uview-plus/components/u-button/u-button.vue +196 -3
- package/uview-plus/components/u-calendar/header.vue +59 -3
- package/uview-plus/components/u-calendar/month.vue +1 -3
- package/uview-plus/components/u-calendar/u-calendar.vue +3 -1
- package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +196 -1
- package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +70 -1
- package/uview-plus/components/u-card/u-card.vue +34 -1
- package/uview-plus/components/u-cascader/u-cascader.vue +16 -1
- package/uview-plus/components/u-cate-tab/u-cate-tab.vue +387 -3
- package/uview-plus/components/u-cell/u-cell.vue +113 -1
- package/uview-plus/components/u-cell-group/u-cell-group.vue +14 -1
- package/uview-plus/components/u-checkbox/u-checkbox.vue +77 -1
- package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +12 -1
- package/uview-plus/components/u-choose/u-choose.vue +15 -3
- package/uview-plus/components/u-circle-progress/u-circle-progress.vue +69 -1
- package/{ui-fireui copy/components/u-circular-progress/u-circular-progress.vue → uview-plus/components/u-circular-progress/u-circular-progress.vue} +1 -1
- package/uview-plus/components/u-city-locate/u-city-locate.vue +161 -1
- package/uview-plus/components/u-code-input/u-code-input.vue +68 -1
- package/uview-plus/components/u-col/u-col.vue +50 -1
- package/uview-plus/components/u-collapse-item/u-collapse-item.vue +10 -1
- package/uview-plus/components/u-color-picker/u-color-picker.vue +260 -1
- package/uview-plus/components/u-column-notice/u-column-notice.vue +37 -1
- package/uview-plus/components/u-count-down/u-count-down.vue +5 -1
- package/uview-plus/components/u-count-to/u-count-to.vue +6 -1
- package/uview-plus/components/u-coupon/u-coupon.vue +214 -1
- package/uview-plus/components/u-cropper/u-cropper.vue +1319 -1
- package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +26 -1
- package/uview-plus/components/u-divider/u-divider.vue +17 -1
- package/uview-plus/components/u-dragsort/u-dragsort.vue +40 -1
- package/uview-plus/components/u-dropdown/u-dropdown.vue +66 -1
- package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +3 -1
- package/{ui-fireui → uview-plus}/components/u-dropdown-list/u-dropdown-list.vue +1 -1
- package/uview-plus/components/u-empty/u-empty.vue +43 -32
- package/{ui-fireui copy/components/u-fab/u-fab.vue → uview-plus/components/u-fab/u-fab.vue} +1 -1
- package/uview-plus/components/u-float-button/u-float-button.vue +15 -1
- package/{ui-fireui → uview-plus}/components/u-footer/u-footer.vue +1 -1
- package/uview-plus/components/u-form-base/form.js +22 -0
- package/uview-plus/components/u-form-base/props.js +47 -0
- package/uview-plus/components/u-form-base/u-form.vue +243 -0
- package/uview-plus/components/u-form-item/u-form-item.vue +82 -1
- package/uview-plus/components/u-goods-sku/u-goods-sku.vue +100 -1
- package/uview-plus/components/u-grid/u-grid.vue +0 -2
- package/uview-plus/components/u-grid-item/u-grid-item.vue +30 -1
- package/uview-plus/components/u-icon/u-icon.vue +63 -1
- package/uview-plus/components/u-image/u-image.vue +25 -1
- package/{ui-fireui → uview-plus}/components/u-image-cropper/u-image-cropper.vue +1 -1
- package/{ui-fireui copy/components/u-image-group/u-image-group.vue → uview-plus/components/u-image-group/u-image-group.vue} +1 -1
- package/uview-plus/components/u-index-anchor/u-index-anchor.vue +22 -1
- package/uview-plus/components/u-index-list/u-index-list.vue +51 -1
- package/uview-plus/components/u-input/u-input.vue +65 -1
- package/uview-plus/components/u-keyboard/u-keyboard.vue +26 -1
- package/uview-plus/components/u-lazy-load/u-lazy-load.vue +12 -1
- package/uview-plus/components/u-line/u-line.vue +5 -1
- package/uview-plus/components/u-line-progress/u-line-progress.vue +38 -1
- package/uview-plus/components/u-link/u-link.vue +11 -1
- package/uview-plus/components/u-list/u-list.vue +6 -1
- package/uview-plus/components/u-list-item/u-list-item.vue +2 -1
- package/uview-plus/components/u-loading-icon/u-loading-icon.vue +138 -1
- package/uview-plus/components/u-loading-page/u-loading-page.vue +33 -1
- package/uview-plus/components/u-loadmore/u-loadmore.vue +29 -1
- package/uview-plus/components/u-markdown/u-markdown.vue +188 -1
- package/uview-plus/components/u-message-input/u-message-input.vue +115 -1
- package/uview-plus/components/u-modal/u-modal.vue +65 -1
- package/uview-plus/components/u-navbar/u-navbar.vue +52 -1
- package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +34 -1
- package/uview-plus/components/u-no-network/u-no-network.vue +38 -1
- package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -1
- package/uview-plus/components/u-notify/u-notify.vue +28 -1
- package/uview-plus/components/u-number-box/u-number-box.vue +60 -2
- package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +45 -1
- package/uview-plus/components/u-overlay/u-overlay.vue +8 -1
- package/uview-plus/components/u-pagination/u-pagination.vue +255 -1
- package/uview-plus/components/u-parse/node/node.vue +319 -129
- package/uview-plus/components/u-pdf-reader/u-pdf-reader.vue +2 -1
- package/uview-plus/components/u-picker/u-picker.vue +58 -1
- package/uview-plus/components/u-picker-data/u-picker-data.vue +11 -1
- package/uview-plus/components/u-popover/u-popover.vue +8 -1
- package/uview-plus/components/u-popup/u-popup.vue +87 -1
- package/uview-plus/components/u-popup-wu/u-popup-wu.vue +2 -2
- package/uview-plus/components/u-poster/u-poster.vue +22 -1
- package/uview-plus/components/u-pull-refresh/u-pull-refresh.vue +51 -1
- package/uview-plus/components/u-qrcode/u-qrcode.vue +32 -1
- package/uview-plus/components/u-radio/u-radio.vue +77 -1
- package/uview-plus/components/u-radio-group/u-radio-group.vue +15 -1
- package/uview-plus/components/u-rate/u-rate.vue +32 -1
- package/uview-plus/components/u-read-more/u-read-more.vue +23 -1
- package/uview-plus/components/u-row/u-row.vue +6 -1
- package/uview-plus/components/u-row-notice/u-row-notice.vue +50 -1
- package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +5 -1
- package/uview-plus/components/u-scroll-list/u-scroll-list.vue +35 -1
- package/uview-plus/components/u-search/u-search.vue +87 -1
- package/uview-plus/components/u-select/u-select.vue +51 -1
- package/uview-plus/components/u-short-video/u-short-video.vue +118 -1
- package/uview-plus/components/u-signature/u-signature.vue +71 -1
- package/uview-plus/components/u-skeleton/u-skeleton.vue +52 -1
- package/uview-plus/components/u-sku-wu/u-sku-wu.vue +271 -1
- package/uview-plus/components/u-slider/nvue.js +165 -178
- package/uview-plus/components/u-slider/u-slider.vue +69 -1
- package/uview-plus/components/u-status-bar/u-status-bar.vue +6 -1
- package/uview-plus/components/u-steps/u-steps.vue +20 -1
- package/uview-plus/components/u-steps-item/u-steps-item.vue +112 -1
- package/uview-plus/components/u-sticky/u-sticky.vue +6 -1
- package/uview-plus/components/u-subsection/u-subsection.vue +101 -1
- package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +51 -1
- package/uview-plus/components/u-swiper/u-swiper.vue +50 -1
- package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +26 -1
- package/uview-plus/components/u-switch/u-switch.vue +47 -1
- package/uview-plus/components/u-tabbar/u-tabbar.vue +29 -1
- package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +59 -1
- package/uview-plus/components/u-table2/tableRow.vue +361 -1
- package/uview-plus/components/u-table2/u-table2.vue +763 -1
- package/uview-plus/components/u-tabs/u-tabs.vue +62 -1
- package/uview-plus/components/u-tag/u-tag.vue +169 -1
- package/uview-plus/components/u-td/u-td.vue +14 -1
- package/uview-plus/components/u-text/u-text.vue +50 -1
- package/uview-plus/components/u-textarea/u-textarea.vue +35 -1
- package/uview-plus/components/u-th/u-th.vue +13 -1
- package/uview-plus/components/u-title/u-title.vue +10 -3
- package/uview-plus/components/u-toast/u-toast.vue +67 -1
- package/uview-plus/components/u-toolbar/u-toolbar.vue +34 -1
- package/uview-plus/components/u-tooltip/u-tooltip.vue +65 -1
- package/uview-plus/components/u-tr/u-tr.vue +6 -1
- package/uview-plus/components/u-transition/u-transition.vue +98 -1
- package/uview-plus/components/u-upload/u-upload.vue +176 -1
- package/uview-plus/components/u-view/u-view.vue +2 -1
- package/uview-plus/components/u-virtual-list/u-virtual-list.vue +16 -1
- package/uview-plus/components/u-waterfall/u-waterfall.vue +28 -1
- package/uview-plus/libs/css/color2.scss +32 -0
- package/uview-plus/libs/css/variable2.scss +111 -0
- package/{plugins → uview-plus/libs/ctocode}/MessageTip.js +6 -6
- package/uview-plus/libs/ctocode/wait.js +47 -0
- package/uview-plus/libs/mixin/openType2.js +60 -0
- package/uview-plus/libs/util/route2.js +126 -0
- package/other/style.css +0 -46
- package/ui-cv/components/cv-draw-gesture-lock/style.css +0 -39
- package/ui-cv/components/cv-geo-region/style.css +0 -77
- package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +0 -269
- package/ui-fireui/components/u-countdown/u-countdown.vue +0 -301
- package/ui-fireui/components/u-fab/u-fab.vue +0 -284
- package/ui-fireui/components/u-icon/style.css +0 -63
- package/ui-fireui/components/u-image-group/u-image-group.vue +0 -149
- package/ui-fireui copy/components/u-action-sheet/u-action-sheet.vue +0 -202
- package/ui-fireui copy/components/u-alert/u-alert.vue +0 -141
- package/ui-fireui copy/components/u-badge/u-badge.vue +0 -158
- package/ui-fireui copy/components/u-bottom-navigation/u-bottom-navigation.vue +0 -391
- package/ui-fireui copy/components/u-bottom-popup/u-bottom-popup.vue +0 -101
- package/ui-fireui copy/components/u-bubble-popup/u-bubble-popup.vue +0 -240
- package/ui-fireui copy/components/u-button/u-button.vue +0 -424
- package/ui-fireui copy/components/u-button/u-button2.vue +0 -553
- package/ui-fireui copy/components/u-calendar/u-calendar.js +0 -915
- package/ui-fireui copy/components/u-calendar/u-calendar.vue +0 -868
- package/ui-fireui copy/components/u-calendar/u-calendar2.vue +0 -801
- package/ui-fireui copy/components/u-card/u-card.vue +0 -231
- package/ui-fireui copy/components/u-cascade-selection/u-cascade-selection.vue +0 -538
- package/ui-fireui copy/components/u-collapse/u-collapse.vue +0 -179
- package/ui-fireui copy/components/u-datetime/u-datetime.vue +0 -570
- package/ui-fireui copy/components/u-divider/u-divider.vue +0 -118
- package/ui-fireui copy/components/u-drawer/u-drawer.vue +0 -103
- package/ui-fireui copy/components/u-dropdown-list/u-dropdown-list.vue +0 -75
- package/ui-fireui copy/components/u-footer/u-footer.vue +0 -135
- package/ui-fireui copy/components/u-grid/u-grid.vue +0 -50
- package/ui-fireui copy/components/u-grid-item/u-grid-item.vue +0 -142
- package/ui-fireui copy/components/u-icon/icons.js +0 -214
- package/ui-fireui copy/components/u-icon/props.js +0 -92
- package/ui-fireui copy/components/u-icon/style.css +0 -63
- package/ui-fireui copy/components/u-icon/style.scss +0 -1066
- package/ui-fireui copy/components/u-icon/u-icon.vue +0 -117
- package/ui-fireui copy/components/u-icon/u-icon2.vue +0 -149
- package/ui-fireui copy/components/u-icon/util.js +0 -68
- package/ui-fireui copy/components/u-image-cropper/u-image-cropper.vue +0 -1058
- package/ui-fireui copy/components/u-keyboard/u-keyboard.vue +0 -251
- package/ui-fireui copy/components/u-keyboard-input/u-keyboard-input.vue +0 -78
- package/ui-fireui copy/components/u-list-cell/u-list-cell.vue +0 -178
- package/ui-fireui copy/components/u-list-view/u-list-view.vue +0 -87
- package/ui-fireui copy/components/u-loading/u-loading.vue +0 -78
- package/ui-fireui copy/components/u-loadmore/u-loadmore.vue +0 -163
- package/ui-fireui copy/components/u-modal/u-modal.vue +0 -392
- package/ui-fireui copy/components/u-navigation-bar/u-navigation-bar.vue +0 -181
- package/ui-fireui copy/components/u-no-data/u-no-data.vue +0 -116
- package/ui-fireui copy/components/u-nomore/u-nomore.vue +0 -116
- package/ui-fireui copy/components/u-numberbox/u-numberbox.vue +0 -234
- package/ui-fireui copy/components/u-numberbox-border/u-numberbox-border.vue +0 -232
- package/ui-fireui copy/components/u-picture-cropper/u-picture-cropper.vue +0 -682
- package/ui-fireui copy/components/u-picture-cropper/u-picture-cropper.wxs +0 -582
- package/ui-fireui copy/components/u-round-progress/u-round-progress.vue +0 -306
- package/ui-fireui copy/components/u-scroll-top/u-scroll-top.vue +0 -189
- package/ui-fireui copy/components/u-share-model/u-share-model.vue +0 -181
- package/ui-fireui copy/components/u-skeleton/u-skeleton.vue +0 -248
- package/ui-fireui copy/components/u-steps/u-steps.vue +0 -214
- package/ui-fireui copy/components/u-sticky/u-sticky.vue +0 -155
- package/ui-fireui copy/components/u-sticky-wxs/u-sticky-wxs.vue +0 -133
- package/ui-fireui copy/components/u-sticky-wxs/u-sticky.wxs +0 -46
- package/ui-fireui copy/components/u-swipe-action/u-swipe-action.vue +0 -301
- package/ui-fireui copy/components/u-tabbar/u-tabbar.vue +0 -279
- package/ui-fireui copy/components/u-tabs/u-tabs.vue +0 -284
- package/ui-fireui copy/components/u-tabs2/u-tabs2.vue +0 -284
- package/ui-fireui copy/components/u-tag/u-tag.vue +0 -362
- package/ui-fireui copy/components/u-time-axis/u-time-axis.vue +0 -36
- package/ui-fireui copy/components/u-timeaxis-item/u-timeaxis-item.vue +0 -48
- package/ui-fireui copy/components/u-tips/u-tips.vue +0 -161
- package/ui-fireui copy/components/u-toast/u-toast.vue +0 -117
- package/ui-fireui copy/components/u-top-dropdown/u-top-dropdown.vue +0 -129
- package/ui-fireui copy/components/u-upload/u-upload.vue +0 -446
- package/ui-fireui copy/components/u-upload2/u-upload.vue +0 -464
- package/ui-fireui copy/components/u-uploadsamll/u-uploadsamll.vue +0 -472
- package/ui-fireui copy/css/thorui.css +0 -589
- package/ui-fireui copy/index.css +0 -1483
- package/ui-fireui copy/libs/fui-color-analysis/fui-color-analysis.js +0 -1
- package/ui-fireui copy/libs/fui-zh-pinyin/fui-zh-pinyin.js +0 -1
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/bridge/bridge-weex.js +0 -241
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStyleLinearGradient.js +0 -18
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStylePattern.js +0 -8
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStyleRadialGradient.js +0 -17
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/RenderingContext.js +0 -666
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/ActiveInfo.js +0 -11
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Buffer.js +0 -21
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Framebuffer.js +0 -21
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLenum.js +0 -298
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLmethod.js +0 -142
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLtype.js +0 -23
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Program.js +0 -21
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Renderbuffer.js +0 -21
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/RenderingContext.js +0 -1191
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Shader.js +0 -22
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -11
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Texture.js +0 -22
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/UniformLocation.js +0 -22
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/classUtils.js +0 -3
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/canvas.js +0 -74
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/image.js +0 -96
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/tool.js +0 -24
- package/ui-fireui copy/nvue/u-circular-progress/gcanvas/index.js +0 -47
- package/ui-fireui copy/nvue/u-circular-progress/u-circular-progress.nvue +0 -203
- package/ui-fireui copy/nvue/u-icon/icons.js +0 -188
- package/ui-fireui copy/nvue/u-icon/u-icon.vue +0 -78
- package/uni-ui/lib/uni-badge/style.css +0 -81
- package/uni-ui/lib/uni-badge/style.scss +0 -106
- package/uni-ui/lib/uni-breadcrumb/style.css +0 -3
- package/uni-ui/lib/uni-breadcrumb/style.scss +0 -4
- package/uni-ui/lib/uni-breadcrumb-item/style.css +0 -30
- package/uni-ui/lib/uni-breadcrumb-item/style.scss +0 -40
- package/uni-ui/lib/uni-calendar/style.css +0 -167
- package/uni-ui/lib/uni-calendar/style.scss +0 -200
- package/uni-ui/lib/uni-card/style.css +0 -115
- package/uni-ui/lib/uni-card/style.scss +0 -161
- package/uni-ui/lib/uni-col/style.css +0 -2145
- package/uni-ui/lib/uni-col/style.scss +0 -112
- package/uni-ui/lib/uni-collapse/style.css +0 -11
- package/uni-ui/lib/uni-collapse/style.scss +0 -12
- package/uni-ui/lib/uni-collapse-item/style.css +0 -120
- package/uni-ui/lib/uni-collapse-item/style.scss +0 -143
- package/uni-ui/lib/uni-combox/style.css +0 -114
- package/uni-ui/lib/uni-combox/style.scss +0 -133
- package/uni-ui/lib/uni-countdown/style.css +0 -16
- package/uni-ui/lib/uni-countdown/style.scss +0 -21
- package/uni-ui/lib/uni-data-checkbox/style.css +0 -302
- package/uni-ui/lib/uni-data-checkbox/style.scss +0 -366
- package/uni-ui/lib/uni-data-pickerview/style.css +0 -134
- package/uni-ui/lib/uni-data-pickerview/style.scss +0 -154
- package/uni-ui/lib/uni-data-select/style.css +0 -181
- package/uni-ui/lib/uni-data-select/style.scss +0 -213
- package/uni-ui/lib/uni-datetime-picker/style.css +0 -188
- package/uni-ui/lib/uni-datetime-picker/style.scss +0 -218
- package/uni-ui/lib/uni-drawer/style.css +0 -63
- package/uni-ui/lib/uni-drawer/style.scss +0 -77
- package/uni-ui/lib/uni-easyinput/style.css +0 -126
- package/uni-ui/lib/uni-easyinput/style.scss +0 -155
- package/uni-ui/lib/uni-fab/style.css +0 -185
- package/uni-ui/lib/uni-fab/style.scss +0 -259
- package/uni-ui/lib/uni-fav/style.css +0 -39
- package/uni-ui/lib/uni-fav/style.scss +0 -45
- package/uni-ui/lib/uni-file-picker/style.css +0 -97
- package/uni-ui/lib/uni-file-picker/style.scss +0 -110
- package/uni-ui/lib/uni-forms-item/style.css +0 -133
- package/uni-ui/lib/uni-goods-nav/style.css +0 -100
- package/uni-ui/lib/uni-goods-nav/style.scss +0 -122
- package/uni-ui/lib/uni-grid/style.css +0 -29
- package/uni-ui/lib/uni-grid/style.scss +0 -33
- package/uni-ui/lib/uni-grid-item/style.css +0 -49
- package/uni-ui/lib/uni-grid-item/style.scss +0 -55
- package/uni-ui/lib/uni-group/style.css +0 -36
- package/uni-ui/lib/uni-group/style.scss +0 -50
- package/uni-ui/lib/uni-icons/icons.js +0 -1169
- package/uni-ui/lib/uni-icons/style.css +0 -12
- package/uni-ui/lib/uni-icons/style.scss +0 -14
- package/uni-ui/lib/uni-indexed-list/style.css +0 -68
- package/uni-ui/lib/uni-indexed-list/style.scss +0 -83
- package/uni-ui/lib/uni-list/style.css +0 -43
- package/uni-ui/lib/uni-list/style.scss +0 -52
- package/uni-ui/lib/uni-list-ad/style.css +0 -30
- package/uni-ui/lib/uni-list-ad/style.scss +0 -35
- package/uni-ui/lib/uni-list-chat/style.css +0 -257
- package/uni-ui/lib/uni-list-chat/style.scss +0 -326
- package/uni-ui/lib/uni-list-item/style.css +0 -170
- package/uni-ui/lib/uni-list-item/style.scss +0 -213
- package/uni-ui/lib/uni-load-more/style.css +0 -194
- package/uni-ui/lib/uni-load-more/style.scss +0 -244
- package/uni-ui/lib/uni-nav-bar/style.css +0 -3
- package/uni-ui/lib/uni-nav-bar/style.scss +0 -6
- package/uni-ui/lib/uni-notice-bar/style.css +0 -109
- package/uni-ui/lib/uni-notice-bar/style.scss +0 -125
- package/uni-ui/lib/uni-number-box/style.css +0 -50
- package/uni-ui/lib/uni-number-box/style.scss +0 -64
- package/uni-ui/lib/uni-pagination/style.css +0 -125
- package/uni-ui/lib/uni-pagination/style.scss +0 -154
- package/uni-ui/lib/uni-popup/style.css +0 -41
- package/uni-ui/lib/uni-popup/style.scss +0 -51
- package/uni-ui/lib/uni-popup-dialog/style.css +0 -82
- package/uni-ui/lib/uni-popup-dialog/style.scss +0 -98
- package/uni-ui/lib/uni-popup-message/style.css +0 -57
- package/uni-ui/lib/uni-popup-message/style.scss +0 -69
- package/uni-ui/lib/uni-popup-share/style.css +0 -72
- package/uni-ui/lib/uni-popup-share/style.scss +0 -81
- package/uni-ui/lib/uni-rate/style.css +0 -29
- package/uni-ui/lib/uni-rate/style.scss +0 -33
- package/uni-ui/lib/uni-row/style.css +0 -58
- package/uni-ui/lib/uni-row/style.scss +0 -104
- package/uni-ui/lib/uni-search-bar/style.css +0 -59
- package/uni-ui/lib/uni-search-bar/style.scss +0 -70
- package/uni-ui/lib/uni-section/style.css +0 -55
- package/uni-ui/lib/uni-section/style.scss +0 -65
- package/uni-ui/lib/uni-segmented-control/style.css +0 -48
- package/uni-ui/lib/uni-segmented-control/style.scss +0 -55
- package/uni-ui/lib/uni-status-bar/style.css +0 -4
- package/uni-ui/lib/uni-steps/style.css +0 -152
- package/uni-ui/lib/uni-steps/style.scss +0 -179
- package/uni-ui/lib/uni-swipe-action-item/style.css +0 -90
- package/uni-ui/lib/uni-swipe-action-item/style.scss +0 -112
- package/uni-ui/lib/uni-swiper-dot/style.css +0 -75
- package/uni-ui/lib/uni-swiper-dot/style.scss +0 -95
- package/uni-ui/lib/uni-table/style.css +0 -123
- package/uni-ui/lib/uni-table/style.scss +0 -152
- package/uni-ui/lib/uni-tag/style.css +0 -105
- package/uni-ui/lib/uni-tag/style.scss +0 -141
- package/uni-ui/lib/uni-td/style.css +0 -13
- package/uni-ui/lib/uni-td/style.scss +0 -17
- package/uni-ui/lib/uni-th/style.css +0 -63
- package/uni-ui/lib/uni-th/style.scss +0 -78
- package/uni-ui/lib/uni-thead/style.css +0 -30
- package/uni-ui/lib/uni-thead/style.scss +0 -52
- package/uni-ui/lib/uni-tr/style.css +0 -25
- package/uni-ui/lib/uni-tr/style.scss +0 -46
- package/uview-plus/components/u-action-sheet/style.css +0 -56
- package/uview-plus/components/u-action-sheet/style.scss +0 -83
- package/uview-plus/components/u-action-sheet-data/style.css +0 -10
- package/uview-plus/components/u-action-sheet-data/style.scss +0 -12
- package/uview-plus/components/u-agreement/style.css +0 -10
- package/uview-plus/components/u-agreement/style.scss +0 -12
- package/uview-plus/components/u-album/style.css +0 -29
- package/uview-plus/components/u-alert/style.css +0 -90
- package/uview-plus/components/u-alert/style.scss +0 -111
- package/uview-plus/components/u-avatar/style.css +0 -21
- package/uview-plus/components/u-avatar/style.scss +0 -24
- package/uview-plus/components/u-avatar-group/style.css +0 -28
- package/uview-plus/components/u-avatar-group/style.scss +0 -26
- package/uview-plus/components/u-back-top/style.css +0 -16
- package/uview-plus/components/u-back-top/style.scss +0 -18
- package/uview-plus/components/u-badge/style.css +0 -57
- package/uview-plus/components/u-badge/style.scss +0 -83
- package/uview-plus/components/u-box/style.css +0 -51
- package/uview-plus/components/u-box/style.scss +0 -36
- package/uview-plus/components/u-button/style.css +0 -192
- package/uview-plus/components/u-calendar/style.css +0 -3
- package/uview-plus/components/u-calendar/style.scss +0 -5
- package/uview-plus/components/u-calendar-wu/style.css +0 -196
- package/uview-plus/components/u-car-keyboard/style.css +0 -69
- package/uview-plus/components/u-car-keyboard/style.scss +0 -89
- package/uview-plus/components/u-card/style.css +0 -34
- package/uview-plus/components/u-card/style.scss +0 -45
- package/uview-plus/components/u-cascader/style.css +0 -16
- package/uview-plus/components/u-cascader/style.scss +0 -25
- package/uview-plus/components/u-cate-tab/style.css +0 -98
- package/uview-plus/components/u-cate-tab/style.scss +0 -115
- package/uview-plus/components/u-cell/style.css +0 -112
- package/uview-plus/components/u-cell/style.scss +0 -148
- package/uview-plus/components/u-cell-group/style.css +0 -14
- package/uview-plus/components/u-cell-group/style.scss +0 -22
- package/uview-plus/components/u-checkbox/style.css +0 -77
- package/uview-plus/components/u-checkbox/style.scss +0 -102
- package/uview-plus/components/u-checkbox-group/style.css +0 -12
- package/uview-plus/components/u-checkbox-group/style.scss +0 -12
- package/uview-plus/components/u-choose/style.css +0 -13
- package/uview-plus/components/u-choose/style.scss +0 -17
- package/uview-plus/components/u-circle-progress/style.css +0 -69
- package/uview-plus/components/u-circle-progress/style.scss +0 -84
- package/uview-plus/components/u-city-locate/style.css +0 -20
- package/uview-plus/components/u-city-locate/style.scss +0 -20
- package/uview-plus/components/u-code-input/style.css +0 -68
- package/uview-plus/components/u-code-input/style.scss +0 -75
- package/uview-plus/components/u-col/style.css +0 -50
- package/uview-plus/components/u-col/style.scss +0 -65
- package/uview-plus/components/u-collapse-item/style.css +0 -10
- package/uview-plus/components/u-collapse-item/style.scss +0 -13
- package/uview-plus/components/u-color-picker/style.css +0 -246
- package/uview-plus/components/u-color-picker/style.scss +0 -299
- package/uview-plus/components/u-column-notice/style.css +0 -37
- package/uview-plus/components/u-column-notice/style.scss +0 -33
- package/uview-plus/components/u-count-down/style.css +0 -5
- package/uview-plus/components/u-count-down/style.scss +0 -11
- package/uview-plus/components/u-count-to/style.css +0 -6
- package/uview-plus/components/u-count-to/style.scss +0 -6
- package/uview-plus/components/u-coupon/style.css +0 -214
- package/uview-plus/components/u-coupon/style.scss +0 -246
- package/uview-plus/components/u-cropper/style.css +0 -91
- package/uview-plus/components/u-cropper/style.scss +0 -93
- package/uview-plus/components/u-datetime-picker/style.css +0 -26
- package/uview-plus/components/u-datetime-picker/style.scss +0 -26
- package/uview-plus/components/u-divider/style.css +0 -17
- package/uview-plus/components/u-divider/style.scss +0 -22
- package/uview-plus/components/u-dragsort/style.css +0 -40
- package/uview-plus/components/u-dragsort/style.scss +0 -52
- package/uview-plus/components/u-dropdown/style.css +0 -66
- package/uview-plus/components/u-dropdown/style.scss +0 -66
- package/uview-plus/components/u-dropdown-item/style.css +0 -3
- package/uview-plus/components/u-dropdown-item/style.scss +0 -3
- package/uview-plus/components/u-empty/style.css +0 -27
- package/uview-plus/components/u-empty/style.scss +0 -22
- package/uview-plus/components/u-empty/u-empty-new.vue +0 -102
- package/uview-plus/components/u-float-button/style.css +0 -15
- package/uview-plus/components/u-float-button/style.scss +0 -15
- package/uview-plus/components/u-form-item/style.css +0 -82
- package/uview-plus/components/u-form-item/style.scss +0 -72
- package/uview-plus/components/u-goods-sku/style.css +0 -100
- package/uview-plus/components/u-goods-sku/style.scss +0 -120
- package/uview-plus/components/u-grid/style.css +0 -21
- package/uview-plus/components/u-grid/style.scss +0 -21
- package/uview-plus/components/u-grid-item/style.css +0 -30
- package/uview-plus/components/u-grid-item/style.scss +0 -43
- package/uview-plus/components/u-icon/style.css +0 -63
- package/uview-plus/components/u-icon/style.scss +0 -82
- package/uview-plus/components/u-image/style.css +0 -24
- package/uview-plus/components/u-image/style.scss +0 -32
- package/uview-plus/components/u-index-anchor/style.css +0 -22
- package/uview-plus/components/u-index-anchor/style.scss +0 -18
- package/uview-plus/components/u-index-list/style.css +0 -51
- package/uview-plus/components/u-index-list/style.scss +0 -52
- package/uview-plus/components/u-input/style.css +0 -64
- package/uview-plus/components/u-input/style.scss +0 -62
- package/uview-plus/components/u-keyboard/style.css +0 -26
- package/uview-plus/components/u-keyboard/style.scss +0 -29
- package/uview-plus/components/u-lazy-load/style.css +0 -12
- package/uview-plus/components/u-lazy-load/style.scss +0 -15
- package/uview-plus/components/u-line/style.css +0 -5
- package/uview-plus/components/u-line/style.scss +0 -5
- package/uview-plus/components/u-line-progress/style.css +0 -38
- package/uview-plus/components/u-line-progress/style.scss +0 -35
- package/uview-plus/components/u-link/style.css +0 -11
- package/uview-plus/components/u-link/style.scss +0 -10
- package/uview-plus/components/u-list/style.css +0 -6
- package/uview-plus/components/u-list/style.scss +0 -3
- package/uview-plus/components/u-list-item/style.css +0 -2
- package/uview-plus/components/u-list-item/style.scss +0 -2
- package/uview-plus/components/u-loading-icon/style.css +0 -138
- package/uview-plus/components/u-loading-icon/style.scss +0 -152
- package/uview-plus/components/u-loading-page/style.css +0 -33
- package/uview-plus/components/u-loading-page/style.scss +0 -35
- package/uview-plus/components/u-loadmore/style.css +0 -29
- package/uview-plus/components/u-loadmore/style.scss +0 -27
- package/uview-plus/components/u-markdown/style.css +0 -188
- package/uview-plus/components/u-markdown/style.scss +0 -199
- package/uview-plus/components/u-message-input/style.css +0 -115
- package/uview-plus/components/u-message-input/style.scss +0 -134
- package/uview-plus/components/u-modal/style.css +0 -63
- package/uview-plus/components/u-modal/style.scss +0 -68
- package/uview-plus/components/u-navbar/style.css +0 -51
- package/uview-plus/components/u-navbar/style.scss +0 -56
- package/uview-plus/components/u-navbar-mini/style.css +0 -34
- package/uview-plus/components/u-navbar-mini/style.scss +0 -36
- package/uview-plus/components/u-no-network/style.css +0 -38
- package/uview-plus/components/u-no-network/style.scss +0 -34
- package/uview-plus/components/u-notice-bar/style.css +0 -5
- package/uview-plus/components/u-notice-bar/style.scss +0 -5
- package/uview-plus/components/u-notice-bar/u-notice-bar2.vue +0 -102
- package/uview-plus/components/u-notify/style.css +0 -28
- package/uview-plus/components/u-notify/style.scss +0 -38
- package/uview-plus/components/u-number-box/style.css +0 -56
- package/uview-plus/components/u-number-box/style.scss +0 -68
- package/uview-plus/components/u-number-keyboard/style.css +0 -45
- package/uview-plus/components/u-number-keyboard/style.scss +0 -61
- package/uview-plus/components/u-overlay/style.css +0 -8
- package/uview-plus/components/u-overlay/style.scss +0 -13
- package/uview-plus/components/u-pagination/style.css +0 -46
- package/uview-plus/components/u-pagination/style.scss +0 -51
- package/uview-plus/components/u-pdf-reader/style.css +0 -2
- package/uview-plus/components/u-pdf-reader/style.scss +0 -2
- package/uview-plus/components/u-picker/style.css +0 -58
- package/uview-plus/components/u-picker/style.scss +0 -54
- package/uview-plus/components/u-picker-data/style.css +0 -11
- package/uview-plus/components/u-picker-data/style.scss +0 -13
- package/uview-plus/components/u-popover/style.css +0 -8
- package/uview-plus/components/u-popover/style.scss +0 -7
- package/uview-plus/components/u-popup/style.css +0 -87
- package/uview-plus/components/u-popup/style.scss +0 -106
- package/uview-plus/components/u-poster/style.css +0 -22
- package/uview-plus/components/u-poster/style.scss +0 -26
- package/uview-plus/components/u-pull-refresh/style.css +0 -51
- package/uview-plus/components/u-pull-refresh/style.scss +0 -58
- package/uview-plus/components/u-qrcode/style.css +0 -33
- package/uview-plus/components/u-qrcode/style.scss +0 -33
- package/uview-plus/components/u-radio/style.css +0 -77
- package/uview-plus/components/u-radio/style.scss +0 -101
- package/uview-plus/components/u-radio-group/style.css +0 -15
- package/uview-plus/components/u-radio-group/style.scss +0 -14
- package/uview-plus/components/u-rate/style.css +0 -32
- package/uview-plus/components/u-rate/style.scss +0 -37
- package/uview-plus/components/u-read-more/style.css +0 -23
- package/uview-plus/components/u-read-more/style.scss +0 -21
- package/uview-plus/components/u-row/style.css +0 -6
- package/uview-plus/components/u-row/style.scss +0 -3
- package/uview-plus/components/u-row-notice/style.css +0 -50
- package/uview-plus/components/u-row-notice/style.scss +0 -49
- package/uview-plus/components/u-safe-bottom/style.css +0 -5
- package/uview-plus/components/u-safe-bottom/style.scss +0 -5
- package/uview-plus/components/u-scroll-list/style.css +0 -35
- package/uview-plus/components/u-scroll-list/style.scss +0 -32
- package/uview-plus/components/u-search/style.css +0 -87
- package/uview-plus/components/u-search/style.scss +0 -105
- package/uview-plus/components/u-select/style.css +0 -51
- package/uview-plus/components/u-select/style.scss +0 -47
- package/uview-plus/components/u-short-video/style.css +0 -117
- package/uview-plus/components/u-short-video/style.scss +0 -138
- package/uview-plus/components/u-signature/style.css +0 -70
- package/uview-plus/components/u-signature/style.scss +0 -88
- package/uview-plus/components/u-skeleton/style.css +0 -51
- package/uview-plus/components/u-skeleton/style.scss +0 -57
- package/uview-plus/components/u-sku-wu/style.css +0 -271
- package/uview-plus/components/u-slider/style.css +0 -69
- package/uview-plus/components/u-slider/style.scss +0 -76
- package/uview-plus/components/u-status-bar/style.css +0 -5
- package/uview-plus/components/u-status-bar/style.scss +0 -6
- package/uview-plus/components/u-steps/style.css +0 -20
- package/uview-plus/components/u-steps/style.scss +0 -21
- package/uview-plus/components/u-steps-item/style.css +0 -112
- package/uview-plus/components/u-steps-item/style.scss +0 -116
- package/uview-plus/components/u-sticky/style.css +0 -5
- package/uview-plus/components/u-sticky/style.scss +0 -6
- package/uview-plus/components/u-subsection/style.css +0 -101
- package/uview-plus/components/u-subsection/style.scss +0 -121
- package/uview-plus/components/u-swipe-action-item/style.css +0 -51
- package/uview-plus/components/u-swipe-action-item/style.scss +0 -44
- package/uview-plus/components/u-swiper/style.css +0 -50
- package/uview-plus/components/u-swiper/style.scss +0 -51
- package/uview-plus/components/u-swiper-indicator/style.css +0 -26
- package/uview-plus/components/u-swiper-indicator/style.scss +0 -29
- package/uview-plus/components/u-switch/style.css +0 -47
- package/uview-plus/components/u-switch/style.scss +0 -46
- package/uview-plus/components/u-tabbar/style.css +0 -29
- package/uview-plus/components/u-tabbar/style.scss +0 -23
- package/uview-plus/components/u-tabbar-item/style.css +0 -59
- package/uview-plus/components/u-tabbar-item/style.scss +0 -62
- package/uview-plus/components/u-table2/style.css +0 -90
- package/uview-plus/components/u-table2/style.scss +0 -117
- package/uview-plus/components/u-tabs/style.css +0 -62
- package/uview-plus/components/u-tabs/style.scss +0 -60
- package/uview-plus/components/u-tag/style.css +0 -169
- package/uview-plus/components/u-tag/style.scss +0 -204
- package/uview-plus/components/u-td/style.css +0 -14
- package/uview-plus/components/u-td/style.scss +0 -11
- package/uview-plus/components/u-text/style.css +0 -50
- package/uview-plus/components/u-text/style.scss +0 -56
- package/uview-plus/components/u-text/style2.scss +0 -60
- package/uview-plus/components/u-textarea/style.css +0 -35
- package/uview-plus/components/u-textarea/style.scss +0 -37
- package/uview-plus/components/u-th/style.css +0 -13
- package/uview-plus/components/u-th/style.scss +0 -10
- package/uview-plus/components/u-title/style.css +0 -8
- package/uview-plus/components/u-title/style.scss +0 -10
- package/uview-plus/components/u-toast/style.css +0 -67
- package/uview-plus/components/u-toast/style.scss +0 -106
- package/uview-plus/components/u-toolbar/style.css +0 -33
- package/uview-plus/components/u-toolbar/style.scss +0 -35
- package/uview-plus/components/u-tooltip/style.css +0 -65
- package/uview-plus/components/u-tooltip/style.scss +0 -62
- package/uview-plus/components/u-tr/style.css +0 -6
- package/uview-plus/components/u-tr/style.scss +0 -3
- package/uview-plus/components/u-transition/style.css +0 -98
- package/uview-plus/components/u-transition/style.scss +0 -120
- package/uview-plus/components/u-upload/style.css +0 -174
- package/uview-plus/components/u-upload/style.scss +0 -221
- package/uview-plus/components/u-view/style.css +0 -2
- package/uview-plus/components/u-view/style.scss +0 -2
- package/uview-plus/components/u-virtual-list/style.css +0 -16
- package/uview-plus/components/u-virtual-list/style.scss +0 -16
- package/uview-plus/components/u-waterfall/style.css +0 -28
- package/uview-plus/components/u-waterfall/style.scss +0 -25
- /package/{uni-ui/lib/uni-forms/style.css → other/lime-painter2/components/lime-painter/qrcode.js} +0 -0
- /package/{ui-fireui copy/components/u-countdown/u-countdown.vue → ui-fireui/components/u-count-down/u-count-down.vue} +0 -0
- /package/{plugins → uview-plus/libs/ctocode}/MessageBox.js +0 -0
|
@@ -1 +1,1319 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="u-cropper">
|
|
3
2
|
<!-- <image :src="imgSrc.imgSrc" @click="select" :style="[ imgStyle ]" class="my-avatar"></image> -->
|
|
4
3
|
<canvas
|
|
5
4
|
:canvas-id="'avatar-canvas-' + instanceId"
|
|
6
5
|
:id="'avatar-canvas-' + instanceId"
|
|
7
6
|
class="my-canvas"
|
|
8
7
|
:style="{ top: styleTop, height: cvsStyleHeight }"
|
|
9
8
|
disable-scroll="false"
|
|
10
9
|
></canvas>
|
|
11
10
|
<canvas
|
|
12
11
|
:canvas-id="'oper-canvas-' + instanceId"
|
|
13
12
|
:id="'oper-canvas-' + instanceId"
|
|
14
13
|
class="oper-canvas"
|
|
15
14
|
:style="{ top: styleTop, height: cvsStyleHeight }"
|
|
16
15
|
disable-scroll="false"
|
|
17
16
|
@touchstart="start"
|
|
18
17
|
@touchmove="move"
|
|
19
18
|
@touchend="end"
|
|
20
19
|
></canvas>
|
|
21
20
|
<canvas
|
|
22
21
|
:canvas-id="'prv-canvas-' + instanceId"
|
|
23
22
|
:id="'prv-canvas-' + instanceId"
|
|
24
23
|
class="prv-canvas"
|
|
25
24
|
disable-scroll="false"
|
|
26
25
|
@touchstart="hideImg"
|
|
27
26
|
:style="{ height: cvsStyleHeight, top: prvTop }"
|
|
28
27
|
></canvas>
|
|
29
28
|
<view class="oper-wrapper" :style="{ display: styleDisplay }">
|
|
30
29
|
<view class="oper">
|
|
31
30
|
<view class="btn-wrapper" v-if="showOper">
|
|
32
31
|
<view @click="select" hover-class="hover" :style="{ width: btnWidth }">
|
|
33
32
|
<text>{{ t('up.common.re-select') }}</text>
|
|
34
33
|
</view>
|
|
35
34
|
<view @click="close" hover-class="hover" :style="{ width: btnWidth }">
|
|
36
35
|
<text>{{ t('up.common.close') }}</text>
|
|
37
36
|
</view>
|
|
38
37
|
<view @click="rotate" hover-class="hover" :style="{ width: btnWidth, display: btnDsp }">
|
|
39
38
|
<text>{{ t('up.common.rotate') }}</text>
|
|
40
39
|
</view>
|
|
41
40
|
<view @click="preview" hover-class="hover" :style="{ width: btnWidth }">
|
|
42
41
|
<text>{{ t('up.common.preview') }}</text>
|
|
43
42
|
</view>
|
|
44
43
|
<view @click="confirm" hover-class="hover" :style="{ width: btnWidth }">
|
|
45
44
|
<text>{{ t('up.common.confirm') }}</text>
|
|
46
45
|
</view>
|
|
47
46
|
</view>
|
|
48
47
|
<view class="clr-wrapper" v-else>
|
|
49
48
|
<slider
|
|
50
49
|
class="my-slider"
|
|
51
50
|
@change="colorChange"
|
|
52
51
|
block-size="25"
|
|
53
52
|
value="0"
|
|
54
53
|
min="-100"
|
|
55
54
|
max="100"
|
|
56
55
|
activeColor="red"
|
|
57
56
|
backgroundColor="green"
|
|
58
57
|
block-color="grey"
|
|
59
58
|
show-value
|
|
60
59
|
></slider>
|
|
61
60
|
<view @click="prvUpload" hover-class="hover" :style="{ width: btnWidth }">
|
|
62
61
|
<text>{{ t('up.common.confirm') }}</text>
|
|
63
62
|
</view>
|
|
64
63
|
</view>
|
|
65
64
|
</view>
|
|
66
65
|
</view>
|
|
67
66
|
<view @click="chooseImage(0, {})" v-if="styleDisplay == 'none'">
|
|
68
67
|
<slot></slot>
|
|
69
68
|
</view>
|
|
70
69
|
</view>
|
|
71
70
|
name: 'u-cropper',
|
|
72
71
|
data() {
|
|
73
72
|
return {
|
|
74
73
|
// 添加实例ID用于区分不同实例
|
|
75
74
|
instanceId: Date.now() + '-' + Math.random().toString(36).substr(2, 9),
|
|
76
75
|
cvsStyleHeight: '0px',
|
|
77
76
|
styleDisplay: 'none',
|
|
78
77
|
styleTop: '-10000px',
|
|
79
78
|
prvTop: '-10000px',
|
|
80
79
|
imgStyle: {},
|
|
81
80
|
selStyle: {},
|
|
82
81
|
showOper: true,
|
|
83
82
|
imgSrc: {
|
|
84
83
|
imgSrc: ''
|
|
85
84
|
},
|
|
86
85
|
btnWidth: '19%',
|
|
87
86
|
btnDsp: 'flex',
|
|
88
87
|
// 裁剪区域宽度,用于设置选择区域的宽度
|
|
89
88
|
arWidth: '',
|
|
90
89
|
// 裁剪区域高度,用于设置选择区域的高度
|
|
91
90
|
arHeight: '',
|
|
92
91
|
// 导出图片宽度,用于设置最终导出图片的宽度
|
|
93
92
|
expWidth: '',
|
|
94
93
|
// 导出图片高度,用于设置最终导出图片的高度
|
|
95
94
|
expHeight: '',
|
|
96
95
|
// 是否允许调整裁剪框大小
|
|
97
96
|
letChangeSize: false
|
|
98
97
|
};
|
|
99
98
|
},
|
|
100
99
|
watch: {
|
|
101
100
|
avatarSrc() {
|
|
102
101
|
this.imgSrc.imgSrc = this.avatarSrc;
|
|
103
102
|
}
|
|
104
103
|
},
|
|
105
104
|
emits: ['avtinit', 'confirm'],
|
|
106
105
|
props: {
|
|
107
106
|
minScale: '',
|
|
108
107
|
maxScale: '',
|
|
109
108
|
canScale: true,
|
|
110
109
|
canRotate: true,
|
|
111
110
|
lockWidth: '',
|
|
112
111
|
lockHeight: '',
|
|
113
112
|
stretch: '',
|
|
114
113
|
lock: '',
|
|
115
114
|
noTab: true,
|
|
116
115
|
inner: false,
|
|
117
116
|
quality: '',
|
|
118
117
|
index: '',
|
|
119
118
|
canChangeSize: false,
|
|
120
119
|
areaWidth: '300rpx',
|
|
121
120
|
// 裁剪区域高度,用于设置选择区域的高度
|
|
122
121
|
areaHeight: '300rpx',
|
|
123
122
|
// 导出图片宽度,用于设置最终导出图片的宽度
|
|
124
123
|
exportWidth: '260rpx',
|
|
125
124
|
// 导出图片高度,用于设置最终导出图片的高度
|
|
126
125
|
exportHeight: '260rpx'
|
|
127
126
|
},
|
|
128
127
|
created() {
|
|
129
128
|
this.ctxCanvas = uni.createCanvasContext('avatar-canvas-' + this.instanceId, this);
|
|
130
129
|
this.ctxCanvasOper = uni.createCanvasContext('oper-canvas-' + this.instanceId, this);
|
|
131
130
|
this.ctxCanvasPrv = uni.createCanvasContext('prv-canvas-' + this.instanceId, this);
|
|
132
131
|
this.qlty = parseInt(this.quality) || 0.9;
|
|
133
132
|
this.imgSrc.imgSrc = this.imageSrc;
|
|
134
133
|
this.letRotate = this.canRotate === false || this.inner === true ? 0 : 1;
|
|
135
134
|
this.letScale = this.canScale === false ? 0 : 1;
|
|
136
135
|
// 是否允许调整裁剪框大小,false表示不允许,其他值表示允许
|
|
137
136
|
this.letChangeSize = this.canChangeSize;
|
|
138
137
|
this.isin = this.inner === true ? 1 : 0;
|
|
139
138
|
this.indx = this.index || undefined;
|
|
140
139
|
this.mnScale = this.minScale || 0.3;
|
|
141
140
|
this.mxScale = this.maxScale || 4;
|
|
142
141
|
this.noBar = this.noTab === true ? 1 : 0;
|
|
143
142
|
this.stc = this.stretch;
|
|
144
143
|
this.lck = this.lock;
|
|
145
144
|
if (this.isin) {
|
|
146
145
|
this.btnWidth = '24%';
|
|
147
146
|
this.btnDsp = 'none';
|
|
148
147
|
} else {
|
|
149
148
|
this.btnWidth = '19%';
|
|
150
149
|
this.btnDsp = 'flex';
|
|
151
150
|
}
|
|
152
151
|
if (this.noBar) {
|
|
153
152
|
this.moreHeight = 0;
|
|
154
153
|
this.windowResize();
|
|
155
154
|
} else {
|
|
156
155
|
uni.showTabBar({
|
|
157
156
|
complete: (res) => {
|
|
158
157
|
this.moreHeight = res.errMsg === 'showTabBar:ok' ? 50 : 0;
|
|
159
158
|
this.windowResize();
|
|
160
159
|
}
|
|
161
160
|
});
|
|
162
161
|
}
|
|
163
162
|
},
|
|
164
163
|
methods: {
|
|
165
164
|
t,
|
|
166
165
|
windowResize() {
|
|
167
166
|
let sysInfo = uni.getSystemInfoSync();
|
|
168
167
|
this.platform = sysInfo.platform;
|
|
169
168
|
this.pixelRatio = sysInfo.pixelRatio;
|
|
170
169
|
this.windowWidth = sysInfo.windowWidth;
|
|
171
170
|
// #ifdef H5
|
|
172
171
|
this.drawTop = sysInfo.windowTop;
|
|
173
172
|
this.windowHeight = sysInfo.windowHeight + sysInfo.windowBottom;
|
|
174
173
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
175
174
|
// #endif
|
|
176
175
|
// #ifdef APP-PLUS
|
|
177
176
|
if (this.platform === 'android') {
|
|
178
177
|
this.windowHeight = sysInfo.screenHeight + sysInfo.statusBarHeight;
|
|
179
178
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
180
179
|
} else {
|
|
181
180
|
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
182
181
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 6 + 'px';
|
|
183
182
|
}
|
|
184
183
|
// #endif
|
|
185
184
|
// #ifdef MP
|
|
186
185
|
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
187
186
|
this.cvsStyleHeight = this.windowHeight - tabHeight - 2 + 'px';
|
|
188
187
|
// #endif
|
|
189
188
|
this.pxRatio = this.windowWidth / 750;
|
|
190
189
|
let style = this.avatarStyle;
|
|
191
190
|
if (style && style !== true && (style = style.trim())) {
|
|
192
191
|
style = style.split(';');
|
|
193
192
|
let obj = {};
|
|
194
193
|
for (let v of style) {
|
|
195
194
|
if (!v) continue;
|
|
196
195
|
v = v.trim().split(':');
|
|
197
196
|
if (v[1].indexOf('rpx') >= 0) {
|
|
198
197
|
let arr = v[1].trim().split(' ');
|
|
199
198
|
for (let k in arr) {
|
|
200
199
|
if (!arr[k]) continue;
|
|
201
200
|
if (arr[k].indexOf('rpx') >= 0) {
|
|
202
201
|
arr[k] = parseFloat(arr[k]) * this.pxRatio + 'px';
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
v[1] = arr.join(' ');
|
|
206
205
|
}
|
|
207
206
|
obj[v[0].trim()] = v[1].trim();
|
|
208
207
|
}
|
|
209
208
|
this.imgStyle = obj;
|
|
210
209
|
}
|
|
211
210
|
this.expWidth &&
|
|
212
211
|
(this.expWidth = this.expWidth.indexOf('rpx') >= 0 ? parseInt(this.expWidth) * this.pxRatio : parseInt(this.expWidth));
|
|
213
212
|
this.expHeight &&
|
|
214
213
|
(this.expHeight =
|
|
215
214
|
this.expHeight.indexOf('rpx') >= 0 ? parseInt(this.expHeight) * this.pxRatio : parseInt(this.expHeight));
|
|
216
215
|
if (this.styleDisplay === 'flex') {
|
|
217
216
|
this.drawInit(true);
|
|
218
217
|
}
|
|
219
218
|
this.hideImg();
|
|
220
219
|
},
|
|
221
220
|
select() {
|
|
222
221
|
if (this.fSelecting) return;
|
|
223
222
|
this.fSelecting = true;
|
|
224
223
|
setTimeout(() => {
|
|
225
224
|
this.fSelecting = false;
|
|
226
225
|
}, 500);
|
|
227
226
|
uni.chooseImage({
|
|
228
227
|
count: 1,
|
|
229
228
|
sizeType: ['original', 'compressed'],
|
|
230
229
|
sourceType: ['album', 'camera'],
|
|
231
230
|
success: (r) => {
|
|
232
231
|
uni.showLoading({ mask: true });
|
|
233
232
|
let path = (this.imgPath = r.tempFilePaths[0]);
|
|
234
233
|
uni.getImageInfo({
|
|
235
234
|
src: path,
|
|
236
235
|
success: (r) => {
|
|
237
236
|
this.imgWidth = r.width;
|
|
238
237
|
this.imgHeight = r.height;
|
|
239
238
|
this.path = path;
|
|
240
239
|
if (!this.hasSel) {
|
|
241
240
|
let style = this.selStyle || {};
|
|
242
241
|
if (this.arWidth && this.arHeight) {
|
|
243
242
|
let areaWidth =
|
|
244
243
|
this.arWidth.indexOf('rpx') >= 0 ? parseInt(this.arWidth) * this.pxRatio : parseInt(this.arWidth),
|
|
245
244
|
areaHeight =
|
|
246
245
|
this.arHeight.indexOf('rpx') >= 0 ? parseInt(this.arHeight) * this.pxRatio : parseInt(this.arHeight);
|
|
247
246
|
style.width = areaWidth + 'px';
|
|
248
247
|
style.height = areaHeight + 'px';
|
|
249
248
|
style.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
250
249
|
style.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
251
250
|
} else {
|
|
252
251
|
uni.showModal({
|
|
253
252
|
title: t('up.cropper.emptyWidhtOrHeight'),
|
|
254
253
|
showCancel: false
|
|
255
254
|
});
|
|
256
255
|
return;
|
|
257
256
|
}
|
|
258
257
|
this.selStyle = style;
|
|
259
258
|
}
|
|
260
259
|
if (this.noBar) {
|
|
261
260
|
this.drawInit(true);
|
|
262
261
|
} else {
|
|
263
262
|
uni.hideTabBar({
|
|
264
263
|
complete: () => {
|
|
265
264
|
this.drawInit(true);
|
|
266
265
|
}
|
|
267
266
|
});
|
|
268
267
|
}
|
|
269
268
|
},
|
|
270
269
|
fail: () => {
|
|
271
270
|
uni.showToast({
|
|
272
271
|
title: 'error3',
|
|
273
272
|
duration: 2000
|
|
274
273
|
});
|
|
275
274
|
},
|
|
276
275
|
complete() {
|
|
277
276
|
uni.hideLoading();
|
|
278
277
|
}
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
280
|
});
|
|
282
281
|
},
|
|
283
282
|
confirm() {
|
|
284
283
|
if (this.fUploading) return;
|
|
285
284
|
this.fUploading = true;
|
|
286
285
|
setTimeout(() => {
|
|
287
286
|
this.fUploading = false;
|
|
288
287
|
}, 1000);
|
|
289
288
|
let style = this.selStyle,
|
|
290
289
|
x = parseInt(style.left),
|
|
291
290
|
y = parseInt(style.top),
|
|
292
291
|
width = parseInt(style.width),
|
|
293
292
|
height = parseInt(style.height),
|
|
294
293
|
expWidth = this.expWidth || width,
|
|
295
294
|
expHeight = this.expHeight || height;
|
|
296
295
|
// #ifdef H5
|
|
297
296
|
// x *= this.pixelRatio;
|
|
298
297
|
// y *= this.pixelRatio;
|
|
299
298
|
expWidth = width;
|
|
300
299
|
expHeight = height;
|
|
301
300
|
// #endif
|
|
302
301
|
uni.showLoading({ mask: true });
|
|
303
302
|
this.styleDisplay = 'none';
|
|
304
303
|
this.styleTop = '-10000px';
|
|
305
304
|
this.hasSel = false;
|
|
306
305
|
this.hideImg();
|
|
307
306
|
uni.canvasToTempFilePath(
|
|
308
307
|
{
|
|
309
308
|
x: x,
|
|
310
309
|
y: y,
|
|
311
310
|
width: width,
|
|
312
311
|
height: height,
|
|
313
312
|
destWidth: expWidth,
|
|
314
313
|
destHeight: expHeight,
|
|
315
314
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
316
315
|
fileType: 'png',
|
|
317
316
|
quality: this.qlty,
|
|
318
317
|
success: (r) => {
|
|
319
318
|
r = r.tempFilePath;
|
|
320
319
|
// #ifdef H5
|
|
321
320
|
this.btop(r).then((r) => {
|
|
322
321
|
if (this.expWidth && this.expHeight) {
|
|
323
322
|
let ctxCanvas = this.ctxCanvas;
|
|
324
323
|
(expWidth = this.expWidth), (expHeight = this.expHeight);
|
|
325
324
|
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
326
325
|
ctxCanvas.draw(false, () => {
|
|
327
326
|
uni.canvasToTempFilePath({
|
|
328
327
|
x: 0,
|
|
329
328
|
y: 0,
|
|
330
329
|
width: expWidth,
|
|
331
330
|
height: expHeight,
|
|
332
331
|
destWidth: expWidth,
|
|
333
332
|
destHeight: expHeight,
|
|
334
333
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
335
334
|
fileType: 'png',
|
|
336
335
|
quality: this.qlty,
|
|
337
336
|
success: (r) => {
|
|
338
337
|
r = r.tempFilePath;
|
|
339
338
|
this.btop(r).then((r) => {
|
|
340
339
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
341
340
|
});
|
|
342
341
|
},
|
|
343
342
|
fail: () => {
|
|
344
343
|
uni.showToast({
|
|
345
344
|
title: 'error0',
|
|
346
345
|
duration: 2000
|
|
347
346
|
});
|
|
348
347
|
}
|
|
349
348
|
});
|
|
350
349
|
});
|
|
351
350
|
} else {
|
|
352
351
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
353
352
|
}
|
|
354
353
|
});
|
|
355
354
|
// #endif
|
|
356
355
|
// #ifndef H5
|
|
357
356
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
358
357
|
// #endif
|
|
359
358
|
},
|
|
360
359
|
fail: (res) => {
|
|
361
360
|
uni.showToast({
|
|
362
361
|
title: 'error1',
|
|
363
362
|
duration: 2000
|
|
364
363
|
});
|
|
365
364
|
},
|
|
366
365
|
complete: () => {
|
|
367
366
|
uni.hideLoading();
|
|
368
367
|
this.noBar || uni.showTabBar();
|
|
369
368
|
}
|
|
370
369
|
},
|
|
371
370
|
this
|
|
372
371
|
);
|
|
373
372
|
},
|
|
374
373
|
// 用户点击"预览"模式下的"确认"按钮时被调用,用于将预览的裁剪结果上传
|
|
375
374
|
prvUpload() {
|
|
376
375
|
if (this.fPrvUploading) return;
|
|
377
376
|
this.fPrvUploading = true;
|
|
378
377
|
setTimeout(() => {
|
|
379
378
|
this.fPrvUploading = false;
|
|
380
379
|
}, 1000);
|
|
381
380
|
let style = this.selStyle,
|
|
382
381
|
destWidth = parseInt(style.width),
|
|
383
382
|
destHeight = parseInt(style.height),
|
|
384
383
|
prvX = this.prvX,
|
|
385
384
|
prvY = this.prvY,
|
|
386
385
|
prvWidth = this.prvWidth,
|
|
387
386
|
prvHeight = this.prvHeight,
|
|
388
387
|
expWidth = this.expWidth || prvWidth,
|
|
389
388
|
expHeight = this.expHeight || prvHeight;
|
|
390
389
|
// #ifdef H5
|
|
391
390
|
// prvX *= this.pixelRatio;
|
|
392
391
|
// prvY *= this.pixelRatio;
|
|
393
392
|
expWidth = prvWidth;
|
|
394
393
|
expHeight = prvHeight;
|
|
395
394
|
// #endif
|
|
396
395
|
uni.showLoading({ mask: true });
|
|
397
396
|
this.styleDisplay = 'none';
|
|
398
397
|
this.styleTop = '-10000px';
|
|
399
398
|
this.hasSel = false;
|
|
400
399
|
this.hideImg();
|
|
401
400
|
uni.canvasToTempFilePath(
|
|
402
401
|
{
|
|
403
402
|
x: prvX,
|
|
404
403
|
y: prvY,
|
|
405
404
|
width: prvWidth,
|
|
406
405
|
height: prvHeight,
|
|
407
406
|
destWidth: expWidth,
|
|
408
407
|
destHeight: expHeight,
|
|
409
408
|
canvasId: 'prv-canvas-' + this.instanceId,
|
|
410
409
|
fileType: 'png',
|
|
411
410
|
quality: this.qlty,
|
|
412
411
|
success: (r) => {
|
|
413
412
|
r = r.tempFilePath;
|
|
414
413
|
// #ifdef H5
|
|
415
414
|
this.btop(r).then((r) => {
|
|
416
415
|
if (this.expWidth && this.expHeight) {
|
|
417
416
|
let ctxCanvas = this.ctxCanvas;
|
|
418
417
|
(expWidth = this.expWidth), (expHeight = this.expHeight);
|
|
419
418
|
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
420
419
|
ctxCanvas.draw(false, () => {
|
|
421
420
|
uni.canvasToTempFilePath({
|
|
422
421
|
x: 0,
|
|
423
422
|
y: 0,
|
|
424
423
|
width: expWidth,
|
|
425
424
|
height: expHeight,
|
|
426
425
|
destWidth: expWidth,
|
|
427
426
|
destHeight: expHeight,
|
|
428
427
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
429
428
|
fileType: 'png',
|
|
430
429
|
quality: this.qlty,
|
|
431
430
|
success: (r) => {
|
|
432
431
|
r = r.tempFilePath;
|
|
433
432
|
this.btop(r).then((r) => {
|
|
434
433
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
435
434
|
});
|
|
436
435
|
},
|
|
437
436
|
fail: () => {
|
|
438
437
|
uni.showToast({
|
|
439
438
|
title: 'error0',
|
|
440
439
|
duration: 2000
|
|
441
440
|
});
|
|
442
441
|
}
|
|
443
442
|
});
|
|
444
443
|
});
|
|
445
444
|
} else {
|
|
446
445
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
447
446
|
}
|
|
448
447
|
});
|
|
449
448
|
// #endif
|
|
450
449
|
// #ifndef H5
|
|
451
450
|
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
452
451
|
// #endif
|
|
453
452
|
},
|
|
454
453
|
fail: () => {
|
|
455
454
|
uni.showToast({
|
|
456
455
|
title: 'error_prv',
|
|
457
456
|
duration: 2000
|
|
458
457
|
});
|
|
459
458
|
},
|
|
460
459
|
complete: () => {
|
|
461
460
|
uni.hideLoading();
|
|
462
461
|
this.noBar || uni.showTabBar();
|
|
463
462
|
}
|
|
464
463
|
},
|
|
465
464
|
this
|
|
466
465
|
);
|
|
467
466
|
},
|
|
468
467
|
drawInit(ini = false) {
|
|
469
468
|
let allWidth = this.windowWidth,
|
|
470
469
|
allHeight = this.windowHeight,
|
|
471
470
|
imgWidth = this.imgWidth,
|
|
472
471
|
imgHeight = this.imgHeight,
|
|
473
472
|
imgRadio = imgWidth / imgHeight,
|
|
474
473
|
useWidth = allWidth - 40,
|
|
475
474
|
useHeight = allHeight - tabHeight - 80,
|
|
476
475
|
pixelRatio = this.pixelRatio,
|
|
477
476
|
selWidth = parseInt(this.selStyle.width),
|
|
478
477
|
selHeight = parseInt(this.selStyle.height);
|
|
479
478
|
this.fixWidth = 0;
|
|
480
479
|
this.fixHeight = 0;
|
|
481
480
|
this.lckWidth = 0;
|
|
482
481
|
this.lckHeight = 0;
|
|
483
482
|
switch (this.stc) {
|
|
484
483
|
case 'x':
|
|
485
484
|
this.fixWidth = 1;
|
|
486
485
|
break;
|
|
487
486
|
case 'y':
|
|
488
487
|
this.fixHeight = 1;
|
|
489
488
|
break;
|
|
490
489
|
case 'long':
|
|
491
490
|
if (imgRadio > 1) this.fixWidth = 1;
|
|
492
491
|
else this.fixHeight = 1;
|
|
493
492
|
break;
|
|
494
493
|
case 'short':
|
|
495
494
|
if (imgRadio > 1) this.fixHeight = 1;
|
|
496
495
|
else this.fixWidth = 1;
|
|
497
496
|
break;
|
|
498
497
|
case 'longSel':
|
|
499
498
|
if (selWidth > selHeight) this.fixWidth = 1;
|
|
500
499
|
else this.fixHeight = 1;
|
|
501
500
|
break;
|
|
502
501
|
case 'shortSel':
|
|
503
502
|
if (selWidth > selHeight) this.fixHeight = 1;
|
|
504
503
|
else this.fixWidth = 1;
|
|
505
504
|
break;
|
|
506
505
|
}
|
|
507
506
|
// lck 用于控制裁剪框的宽度和高度锁定行为
|
|
508
507
|
// 'x': 锁定宽度,不允许水平方向调整
|
|
509
508
|
// 'y': 锁定高度,不允许垂直方向调整
|
|
510
509
|
// 'long': 根据图片长边锁定,如果图片横向较长则锁定宽度,否则锁定高度
|
|
511
510
|
// 'short': 根据图片短边锁定,如果图片横向较长则锁定高度,否则锁定宽度
|
|
512
511
|
// 'longSel': 根据选择框的长边锁定,如果选择框宽度大于高度则锁定宽度,否则锁定高度
|
|
513
512
|
// 'shortSel': 根据选择框的短边锁定,如果选择框宽度大于高度则锁定高度,否则锁定宽度
|
|
514
513
|
switch (this.lck) {
|
|
515
514
|
case 'x':
|
|
516
515
|
this.lckWidth = 1;
|
|
517
516
|
break;
|
|
518
517
|
case 'y':
|
|
519
518
|
this.lckHeight = 1;
|
|
520
519
|
break;
|
|
521
520
|
case 'long':
|
|
522
521
|
if (imgRadio > 1) this.lckWidth = 1;
|
|
523
522
|
else this.lckHeight = 1;
|
|
524
523
|
break;
|
|
525
524
|
case 'short':
|
|
526
525
|
if (imgRadio > 1) this.lckHeight = 1;
|
|
527
526
|
else this.lckWidth = 1;
|
|
528
527
|
break;
|
|
529
528
|
case 'longSel':
|
|
530
529
|
if (selWidth > selHeight) this.lckWidth = 1;
|
|
531
530
|
else this.lckHeight = 1;
|
|
532
531
|
break;
|
|
533
532
|
case 'shortSel':
|
|
534
533
|
if (selWidth > selHeight) this.lckHeight = 1;
|
|
535
534
|
else this.lckWidth = 1;
|
|
536
535
|
break;
|
|
537
536
|
}
|
|
538
537
|
if (this.fixWidth) {
|
|
539
538
|
useWidth = selWidth;
|
|
540
539
|
useHeight = useWidth / imgRadio;
|
|
541
540
|
} else if (this.fixHeight) {
|
|
542
541
|
useHeight = selHeight;
|
|
543
542
|
useWidth = useHeight * imgRadio;
|
|
544
543
|
} else if (imgRadio < 1) {
|
|
545
544
|
if (imgHeight < useHeight) {
|
|
546
545
|
useWidth = imgWidth;
|
|
547
546
|
useHeight = imgHeight;
|
|
548
547
|
} else {
|
|
549
548
|
useHeight = useHeight;
|
|
550
549
|
useWidth = useHeight * imgRadio;
|
|
551
550
|
}
|
|
552
551
|
} else {
|
|
553
552
|
if (imgWidth < useWidth) {
|
|
554
553
|
useWidth = imgWidth;
|
|
555
554
|
useHeight = imgHeight;
|
|
556
555
|
} else {
|
|
557
556
|
useWidth = useWidth;
|
|
558
557
|
useHeight = useWidth / imgRadio;
|
|
559
558
|
}
|
|
560
559
|
}
|
|
561
560
|
if (this.isin) {
|
|
562
561
|
this.scaleWidth = 0;
|
|
563
562
|
this.scaleHeight = 0;
|
|
564
563
|
if (useWidth < selWidth) {
|
|
565
564
|
useWidth = selWidth;
|
|
566
565
|
useHeight = useWidth / imgRadio;
|
|
567
566
|
this.lckHeight = 0;
|
|
568
567
|
}
|
|
569
568
|
if (useHeight < selHeight) {
|
|
570
569
|
useHeight = selHeight;
|
|
571
570
|
useWidth = useHeight * imgRadio;
|
|
572
571
|
this.lckWidth = 0;
|
|
573
572
|
}
|
|
574
573
|
}
|
|
575
574
|
this.scaleSize = 1;
|
|
576
575
|
this.rotateDeg = 0;
|
|
577
576
|
this.posWidth = (allWidth - useWidth) / 2;
|
|
578
577
|
this.posHeight = (allHeight - useHeight - tabHeight) / 2;
|
|
579
578
|
this.useWidth = useWidth;
|
|
580
579
|
this.useHeight = useHeight;
|
|
581
580
|
let style = this.selStyle,
|
|
582
581
|
left = parseInt(style.left),
|
|
583
582
|
top = parseInt(style.top),
|
|
584
583
|
width = parseInt(style.width),
|
|
585
584
|
height = parseInt(style.height),
|
|
586
585
|
canvas = this.canvas,
|
|
587
586
|
canvasOper = this.canvasOper,
|
|
588
587
|
ctxCanvas = this.ctxCanvas,
|
|
589
588
|
ctxCanvasOper = this.ctxCanvasOper;
|
|
590
589
|
ctxCanvasOper.setLineWidth(3);
|
|
591
590
|
ctxCanvasOper.setStrokeStyle('grey');
|
|
592
591
|
ctxCanvasOper.setGlobalAlpha(0.4);
|
|
593
592
|
ctxCanvasOper.setFillStyle('black');
|
|
594
593
|
ctxCanvasOper.strokeRect(left, top, width, height);
|
|
595
594
|
ctxCanvasOper.fillRect(0, 0, this.windowWidth, top);
|
|
596
595
|
ctxCanvasOper.fillRect(0, top, left, height);
|
|
597
596
|
ctxCanvasOper.fillRect(0, top + height, this.windowWidth, this.windowHeight - height - top - tabHeight);
|
|
598
597
|
ctxCanvasOper.fillRect(left + width, top, this.windowWidth - width - left, height);
|
|
599
598
|
ctxCanvasOper.setStrokeStyle('red');
|
|
600
599
|
ctxCanvasOper.moveTo(left + 20, top);
|
|
601
600
|
ctxCanvasOper.lineTo(left, top);
|
|
602
601
|
ctxCanvasOper.lineTo(left, top + 20);
|
|
603
602
|
ctxCanvasOper.moveTo(left + width - 20, top);
|
|
604
603
|
ctxCanvasOper.lineTo(left + width, top);
|
|
605
604
|
ctxCanvasOper.lineTo(left + width, top + 20);
|
|
606
605
|
ctxCanvasOper.moveTo(left + 20, top + height);
|
|
607
606
|
ctxCanvasOper.lineTo(left, top + height);
|
|
608
607
|
ctxCanvasOper.lineTo(left, top + height - 20);
|
|
609
608
|
ctxCanvasOper.moveTo(left + width - 20, top + height);
|
|
610
609
|
ctxCanvasOper.lineTo(left + width, top + height);
|
|
611
610
|
ctxCanvasOper.lineTo(left + width, top + height - 20);
|
|
612
611
|
// 绘制控制点(四个角)
|
|
613
612
|
const controlPointSize = 10;
|
|
614
613
|
ctxCanvasOper.setFillStyle('white');
|
|
615
614
|
ctxCanvasOper.setStrokeStyle('grey');
|
|
616
615
|
ctxCanvasOper.setLineWidth(1);
|
|
617
616
|
// 左上角
|
|
618
617
|
ctxCanvasOper.fillRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
619
618
|
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
620
619
|
// 右上角
|
|
621
620
|
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
622
621
|
ctxCanvasOper.strokeRect(
|
|
623
622
|
left + width - controlPointSize / 2,
|
|
624
623
|
top - controlPointSize / 2,
|
|
625
624
|
controlPointSize,
|
|
626
625
|
controlPointSize
|
|
627
626
|
);
|
|
628
627
|
// 左下角
|
|
629
628
|
ctxCanvasOper.fillRect(
|
|
630
629
|
left - controlPointSize / 2,
|
|
631
630
|
top + height - controlPointSize / 2,
|
|
632
631
|
controlPointSize,
|
|
633
632
|
controlPointSize
|
|
634
633
|
);
|
|
635
634
|
ctxCanvasOper.strokeRect(
|
|
636
635
|
left - controlPointSize / 2,
|
|
637
636
|
top + height - controlPointSize / 2,
|
|
638
637
|
controlPointSize,
|
|
639
638
|
controlPointSize
|
|
640
639
|
);
|
|
641
640
|
// 右下角
|
|
642
641
|
ctxCanvasOper.fillRect(
|
|
643
642
|
left + width - controlPointSize / 2,
|
|
644
643
|
top + height - controlPointSize / 2,
|
|
645
644
|
controlPointSize,
|
|
646
645
|
controlPointSize
|
|
647
646
|
);
|
|
648
647
|
ctxCanvasOper.strokeRect(
|
|
649
648
|
left + width - controlPointSize / 2,
|
|
650
649
|
top + height - controlPointSize / 2,
|
|
651
650
|
controlPointSize,
|
|
652
651
|
controlPointSize
|
|
653
652
|
);
|
|
654
653
|
ctxCanvasOper.stroke();
|
|
655
654
|
ctxCanvasOper.draw(false, () => {
|
|
656
655
|
if (ini) {
|
|
657
656
|
this.styleDisplay = 'flex';
|
|
658
657
|
// #ifdef H5
|
|
659
658
|
this.styleTop = this.drawTop + 'px';
|
|
660
659
|
// #endif
|
|
661
660
|
// #ifndef H5
|
|
662
661
|
this.styleTop = '0';
|
|
663
662
|
// #endif
|
|
664
663
|
ctxCanvas.setFillStyle('black');
|
|
665
664
|
this.drawImage();
|
|
666
665
|
}
|
|
667
666
|
});
|
|
668
667
|
this.$emit('avtinit');
|
|
669
668
|
},
|
|
670
669
|
drawImage() {
|
|
671
670
|
let tm_now = Date.now();
|
|
672
671
|
if (tm_now - this.drawTm < 20) return;
|
|
673
672
|
this.drawTm = tm_now;
|
|
674
673
|
let ctxCanvas = this.ctxCanvas;
|
|
675
674
|
ctxCanvas.fillRect(0, 0, this.windowWidth, this.windowHeight - tabHeight);
|
|
676
675
|
ctxCanvas.translate(this.posWidth + this.useWidth / 2, this.posHeight + this.useHeight / 2);
|
|
677
676
|
ctxCanvas.scale(this.scaleSize, this.scaleSize);
|
|
678
677
|
ctxCanvas.rotate((this.rotateDeg * Math.PI) / 180);
|
|
679
678
|
ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
|
|
680
679
|
ctxCanvas.draw(false);
|
|
681
680
|
},
|
|
682
681
|
hideImg() {
|
|
683
682
|
this.prvImg = '';
|
|
684
683
|
this.prvTop = '-10000px';
|
|
685
684
|
this.showOper = true;
|
|
686
685
|
this.prvImgData = null;
|
|
687
686
|
this.target = null;
|
|
688
687
|
},
|
|
689
688
|
close() {
|
|
690
689
|
this.styleDisplay = 'none';
|
|
691
690
|
this.styleTop = '-10000px';
|
|
692
691
|
this.hasSel = false;
|
|
693
692
|
this.hideImg();
|
|
694
693
|
this.noBar || uni.showTabBar();
|
|
695
694
|
},
|
|
696
695
|
preview() {
|
|
697
696
|
if (this.fPreviewing) return;
|
|
698
697
|
this.fPreviewing = true;
|
|
699
698
|
setTimeout(() => {
|
|
700
699
|
this.fPreviewing = false;
|
|
701
700
|
}, 1000);
|
|
702
701
|
let style = this.selStyle,
|
|
703
702
|
x = parseInt(style.left),
|
|
704
703
|
y = parseInt(style.top),
|
|
705
704
|
width = parseInt(style.width),
|
|
706
705
|
height = parseInt(style.height);
|
|
707
706
|
uni.showLoading({ mask: true });
|
|
708
707
|
// console.log('size', x, y, width, height)
|
|
709
708
|
uni.canvasToTempFilePath(
|
|
710
709
|
{
|
|
711
710
|
x: x,
|
|
712
711
|
y: y,
|
|
713
712
|
width: width,
|
|
714
713
|
height: height,
|
|
715
714
|
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
716
715
|
fileType: 'png',
|
|
717
716
|
quality: this.qlty,
|
|
718
717
|
success: (r) => {
|
|
719
718
|
// console.log(r)
|
|
720
719
|
this.prvImgTmp = r = r.tempFilePath;
|
|
721
720
|
let ctxCanvasPrv = this.ctxCanvasPrv,
|
|
722
721
|
prvX = this.windowWidth,
|
|
723
722
|
prvY = parseInt(this.cvsStyleHeight),
|
|
724
723
|
prvWidth = parseInt(this.selStyle.width),
|
|
725
724
|
prvHeight = parseInt(this.selStyle.height),
|
|
726
725
|
useWidth = prvX - 40,
|
|
727
726
|
useHeight = prvY - 80,
|
|
728
727
|
radio = useWidth / prvWidth,
|
|
729
728
|
rHeight = prvHeight * radio;
|
|
730
729
|
if (rHeight < useHeight) {
|
|
731
730
|
prvWidth = useWidth;
|
|
732
731
|
prvHeight = rHeight;
|
|
733
732
|
} else {
|
|
734
733
|
radio = useHeight / prvHeight;
|
|
735
734
|
prvWidth *= radio;
|
|
736
735
|
prvHeight = useHeight;
|
|
737
736
|
}
|
|
738
737
|
ctxCanvasPrv.setFillStyle('black');
|
|
739
738
|
ctxCanvasPrv.fillRect(0, 0, prvX, prvY);
|
|
740
739
|
ctxCanvasPrv.fillRect(x, y, width, height);
|
|
741
740
|
this.prvX = prvX = (prvX - prvWidth) / 2;
|
|
742
741
|
this.prvY = prvY = (prvY - prvHeight) / 2;
|
|
743
742
|
this.prvWidth = prvWidth;
|
|
744
743
|
this.prvHeight = prvHeight;
|
|
745
744
|
ctxCanvasPrv.drawImage(r, prvX, prvY, prvWidth, prvHeight);
|
|
746
745
|
ctxCanvasPrv.draw(false, () => {
|
|
747
746
|
// #ifdef H5
|
|
748
747
|
this.btop(this.prvImgTmp).then((r) => {
|
|
749
748
|
this.showOper = false;
|
|
750
749
|
this.prvTop = this.drawTop + 'px';
|
|
751
750
|
});
|
|
752
751
|
// #endif
|
|
753
752
|
// #ifndef H5
|
|
754
753
|
if (this.platform != 'android') {
|
|
755
754
|
this.showOper = false;
|
|
756
755
|
}
|
|
757
756
|
this.prvTop = '0';
|
|
758
757
|
// #endif
|
|
759
758
|
});
|
|
760
759
|
},
|
|
761
760
|
fail: () => {
|
|
762
761
|
uni.showToast({
|
|
763
762
|
title: 'error2',
|
|
764
763
|
duration: 2000
|
|
765
764
|
});
|
|
766
765
|
},
|
|
767
766
|
complete: () => {
|
|
768
767
|
uni.hideLoading();
|
|
769
768
|
}
|
|
770
769
|
},
|
|
771
770
|
this
|
|
772
771
|
);
|
|
773
772
|
},
|
|
774
773
|
chooseImage(index = undefined, params = undefined, data = undefined) {
|
|
775
774
|
if (params) {
|
|
776
775
|
console.log(params);
|
|
777
776
|
let areaWidth = params.areaWidth || this.areaWidth,
|
|
778
777
|
areaHeight = params.areaHeight || this.areaHeight,
|
|
779
778
|
expWidth = params.exportWidth || this.exportWidth,
|
|
780
779
|
expHeight = params.exportHeight || this.exportHeight,
|
|
781
780
|
quality = params.quality,
|
|
782
781
|
canRotate = params.canRotate,
|
|
783
782
|
canScale = params.canScale,
|
|
784
783
|
canChangeSize = params.canChangeSize,
|
|
785
784
|
minScale = params.minScale,
|
|
786
785
|
maxScale = params.maxScale,
|
|
787
786
|
stretch = params.stretch,
|
|
788
787
|
inner = params.inner,
|
|
789
788
|
lock = params.lock;
|
|
790
789
|
console.log('areaWidth', this.areaWidth);
|
|
791
790
|
expWidth && (this.expWidth = expWidth.indexOf('rpx') >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt(expWidth));
|
|
792
791
|
expHeight && (this.expHeight = expHeight.indexOf('rpx') >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt(expHeight));
|
|
793
792
|
this.letRotate = canRotate === false ? 0 : 1;
|
|
794
793
|
this.letScale = canScale === false ? 0 : 1;
|
|
795
794
|
// 设置是否允许调整裁剪框大小
|
|
796
795
|
this.letChangeSize = canChangeSize || false;
|
|
797
796
|
this.qlty = parseInt(quality) || 0.9;
|
|
798
797
|
this.mnScale = minScale || 0.3;
|
|
799
798
|
this.mxScale = maxScale || 4;
|
|
800
799
|
this.stc = stretch;
|
|
801
800
|
this.isin = inner === true ? 1 : 0;
|
|
802
801
|
this.lck = lock;
|
|
803
802
|
if (this.isin) {
|
|
804
803
|
this.btnWidth = '24%';
|
|
805
804
|
this.btnDsp = 'none';
|
|
806
805
|
} else {
|
|
807
806
|
this.btnWidth = '19%';
|
|
808
807
|
this.btnDsp = 'flex';
|
|
809
808
|
}
|
|
810
809
|
if (areaWidth && areaHeight) {
|
|
811
810
|
areaWidth = areaWidth.indexOf('rpx') >= 0 ? parseInt(areaWidth) * this.pxRatio : parseInt(areaWidth);
|
|
812
811
|
areaHeight = areaHeight.indexOf('rpx') >= 0 ? parseInt(areaHeight) * this.pxRatio : parseInt(areaHeight);
|
|
813
812
|
this.selStyle.width = areaWidth + 'px';
|
|
814
813
|
this.selStyle.height = areaHeight + 'px';
|
|
815
814
|
this.selStyle.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
816
815
|
this.selStyle.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
817
816
|
// console.log(this.selStyle);
|
|
818
817
|
this.hasSel = true;
|
|
819
818
|
}
|
|
820
819
|
}
|
|
821
820
|
this.rtn = data;
|
|
822
821
|
this.indx = index;
|
|
823
822
|
this.select();
|
|
824
823
|
},
|
|
825
824
|
rotate() {
|
|
826
825
|
// #ifdef APP-PLUS
|
|
827
826
|
if (this.platform === 'android') {
|
|
828
827
|
if (this.fRotateing) return;
|
|
829
828
|
this.fRotateing = true;
|
|
830
829
|
setTimeout(() => {
|
|
831
830
|
this.fRotateing = false;
|
|
832
831
|
}, 500);
|
|
833
832
|
}
|
|
834
833
|
// #endif
|
|
835
834
|
// if(this.letRotate) {
|
|
836
835
|
this.rotateDeg += 90 - (this.rotateDeg % 90);
|
|
837
836
|
this.drawImage();
|
|
838
837
|
// }
|
|
839
838
|
},
|
|
840
839
|
start(e) {
|
|
841
840
|
let touches = e.touches,
|
|
842
841
|
touch0 = touches[0],
|
|
843
842
|
touch1 = touches[1];
|
|
844
843
|
this.touch0 = touch0;
|
|
845
844
|
this.touch1 = touch1;
|
|
846
845
|
if (touch1) {
|
|
847
846
|
let x = touch1.x - touch0.x,
|
|
848
847
|
y = touch1.y - touch0.y;
|
|
849
848
|
this.fgDistance = Math.sqrt(x * x + y * y);
|
|
850
849
|
} else {
|
|
851
850
|
// 只有在允许调整大小时才检查控制点
|
|
852
851
|
if (this.letChangeSize) {
|
|
853
852
|
// 检查是否点击在控制点上
|
|
854
853
|
const controlPointSize = 20;
|
|
855
854
|
const x = touch0.x;
|
|
856
855
|
const y = touch0.y;
|
|
857
856
|
const style = this.selStyle;
|
|
858
857
|
const left = parseInt(style.left);
|
|
859
858
|
const top = parseInt(style.top);
|
|
860
859
|
const width = parseInt(style.width);
|
|
861
860
|
const height = parseInt(style.height);
|
|
862
861
|
// 检查四个控制点
|
|
863
862
|
if (Math.abs(x - left) < controlPointSize && Math.abs(y - top) < controlPointSize) {
|
|
864
863
|
this.resizeHandle = 'top-left';
|
|
865
864
|
} else if (Math.abs(x - (left + width)) < controlPointSize && Math.abs(y - top) < controlPointSize) {
|
|
866
865
|
this.resizeHandle = 'top-right';
|
|
867
866
|
} else if (Math.abs(x - left) < controlPointSize && Math.abs(y - (top + height)) < controlPointSize) {
|
|
868
867
|
this.resizeHandle = 'bottom-left';
|
|
869
868
|
} else if (Math.abs(x - (left + width)) < controlPointSize && Math.abs(y - (top + height)) < controlPointSize) {
|
|
870
869
|
this.resizeHandle = 'bottom-right';
|
|
871
870
|
} else {
|
|
872
871
|
this.resizeHandle = null;
|
|
873
872
|
}
|
|
874
873
|
} else {
|
|
875
874
|
this.resizeHandle = null;
|
|
876
875
|
}
|
|
877
876
|
}
|
|
878
877
|
},
|
|
879
878
|
move(e) {
|
|
880
879
|
let touches = e.touches,
|
|
881
880
|
touch0 = touches[0],
|
|
882
881
|
touch1 = touches[1];
|
|
883
882
|
if (touch1) {
|
|
884
883
|
let x = touch1.x - touch0.x,
|
|
885
884
|
y = touch1.y - touch0.y,
|
|
886
885
|
fgDistance = Math.sqrt(x * x + y * y),
|
|
887
886
|
scaleSize = 0.005 * (fgDistance - this.fgDistance),
|
|
888
887
|
beScaleSize = this.scaleSize + scaleSize;
|
|
889
888
|
do {
|
|
890
889
|
if (!this.letScale) break;
|
|
891
890
|
if (beScaleSize < this.mnScale) break;
|
|
892
891
|
if (beScaleSize > this.mxScale) break;
|
|
893
892
|
if (this.isin) {
|
|
894
893
|
let imgWidth = this.useWidth * beScaleSize,
|
|
895
894
|
imgHeight = this.useHeight * beScaleSize,
|
|
896
895
|
rx0 = this.posWidth + this.useWidth / 2,
|
|
897
896
|
ry0 = this.posHeight + this.useHeight / 2,
|
|
898
897
|
l = rx0 - imgWidth / 2,
|
|
899
898
|
t = ry0 - imgHeight / 2,
|
|
900
899
|
r = l + imgWidth,
|
|
901
900
|
b = t + imgHeight,
|
|
902
901
|
left = parseInt(this.selStyle.left),
|
|
903
902
|
top = parseInt(this.selStyle.top),
|
|
904
903
|
width = parseInt(this.selStyle.width),
|
|
905
904
|
height = parseInt(this.selStyle.height);
|
|
906
905
|
if (left < l || left + width > r || top < t || top + height > b) break;
|
|
907
906
|
this.scaleWidth = (this.useWidth - imgWidth) / 2;
|
|
908
907
|
this.scaleHeight = (this.useHeight - imgHeight) / 2;
|
|
909
908
|
}
|
|
910
909
|
this.scaleSize = beScaleSize;
|
|
911
910
|
} while (0);
|
|
912
911
|
this.fgDistance = fgDistance;
|
|
913
912
|
if (touch1.x !== touch0.x && this.letRotate) {
|
|
914
913
|
x = (this.touch1.y - this.touch0.y) / (this.touch1.x - this.touch0.x);
|
|
915
914
|
y = (touch1.y - touch0.y) / (touch1.x - touch0.x);
|
|
916
915
|
this.rotateDeg += (Math.atan((y - x) / (1 + x * y)) * 180) / Math.PI;
|
|
917
916
|
this.touch0 = touch0;
|
|
918
917
|
this.touch1 = touch1;
|
|
919
918
|
}
|
|
920
919
|
this.drawImage();
|
|
921
920
|
} else if (this.touch0) {
|
|
922
921
|
// 只有在允许调整大小时才处理裁剪框大小调整
|
|
923
922
|
if (this.resizeHandle && this.letChangeSize) {
|
|
924
923
|
const style = { ...this.selStyle };
|
|
925
924
|
const left = parseInt(style.left);
|
|
926
925
|
const top = parseInt(style.top);
|
|
927
926
|
const width = parseInt(style.width);
|
|
928
927
|
const height = parseInt(style.height);
|
|
929
928
|
const minWidth = 50;
|
|
930
929
|
const minHeight = 50;
|
|
931
930
|
switch (this.resizeHandle) {
|
|
932
931
|
case 'top-left':
|
|
933
932
|
style.left = touch0.x + 'px';
|
|
934
933
|
style.top = touch0.y + 'px';
|
|
935
934
|
style.width = left + width - touch0.x + 'px';
|
|
936
935
|
style.height = top + height - touch0.y + 'px';
|
|
937
936
|
break;
|
|
938
937
|
case 'top-right':
|
|
939
938
|
style.top = touch0.y + 'px';
|
|
940
939
|
style.width = touch0.x - left + 'px';
|
|
941
940
|
style.height = top + height - touch0.y + 'px';
|
|
942
941
|
break;
|
|
943
942
|
case 'bottom-left':
|
|
944
943
|
style.left = touch0.x + 'px';
|
|
945
944
|
style.width = left + width - touch0.x + 'px';
|
|
946
945
|
style.height = touch0.y - top + 'px';
|
|
947
946
|
break;
|
|
948
947
|
case 'bottom-right':
|
|
949
948
|
style.width = touch0.x - left + 'px';
|
|
950
949
|
style.height = touch0.y - top + 'px';
|
|
951
950
|
break;
|
|
952
951
|
}
|
|
953
952
|
// 确保最小尺寸
|
|
954
953
|
if (parseInt(style.width) >= minWidth && parseInt(style.height) >= minHeight) {
|
|
955
954
|
// 确保裁剪框不超出屏幕边界
|
|
956
955
|
if (
|
|
957
956
|
parseInt(style.left) >= 0 &&
|
|
958
957
|
parseInt(style.top) >= 0 &&
|
|
959
958
|
parseInt(style.left) + parseInt(style.width) <= this.windowWidth &&
|
|
960
959
|
parseInt(style.top) + parseInt(style.height) <= this.windowHeight - tabHeight
|
|
961
960
|
) {
|
|
962
961
|
this.selStyle = style;
|
|
963
962
|
// 重新绘制操作层
|
|
964
963
|
this.drawInit();
|
|
965
964
|
}
|
|
966
965
|
}
|
|
967
966
|
} else {
|
|
968
967
|
// 原有的移动图片逻辑
|
|
969
968
|
let x = touch0.x - this.touch0.x,
|
|
970
969
|
y = touch0.y - this.touch0.y,
|
|
971
970
|
beX = this.posWidth + x,
|
|
972
971
|
beY = this.posHeight + y;
|
|
973
972
|
if (this.isin) {
|
|
974
973
|
let imgWidth = this.useWidth * this.scaleSize,
|
|
975
974
|
imgHeight = this.useHeight * this.scaleSize,
|
|
976
975
|
rx0 = beX + this.useWidth / 2,
|
|
977
976
|
ry0 = beY + this.useHeight / 2,
|
|
978
977
|
l = rx0 - imgWidth / 2,
|
|
979
978
|
t = ry0 - imgHeight / 2,
|
|
980
979
|
r = l + imgWidth,
|
|
981
980
|
b = t + imgHeight,
|
|
982
981
|
left = parseInt(this.selStyle.left),
|
|
983
982
|
top = parseInt(this.selStyle.top),
|
|
984
983
|
width = parseInt(this.selStyle.width),
|
|
985
984
|
height = parseInt(this.selStyle.height);
|
|
986
985
|
if (!this.lckWidth && Math.abs(x) < 100) {
|
|
987
986
|
if (left >= l && left + width <= r) {
|
|
988
987
|
this.posWidth = beX;
|
|
989
988
|
} else if (left < l) {
|
|
990
989
|
this.posWidth = left - this.scaleWidth;
|
|
991
990
|
} else if (left + width > r) {
|
|
992
991
|
this.posWidth = left - (imgWidth - width) - this.scaleWidth;
|
|
993
992
|
}
|
|
994
993
|
}
|
|
995
994
|
if (!this.lckHeight && Math.abs(y) < 100) {
|
|
996
995
|
if (top >= t && top + height <= b) {
|
|
997
996
|
this.posHeight = beY;
|
|
998
997
|
} else if (top < t) {
|
|
999
998
|
this.posHeight = top - this.scaleHeight;
|
|
1000
999
|
} else if (top + height > b) {
|
|
1001
1000
|
this.posHeight = top - (imgHeight - height) - this.scaleHeight;
|
|
1002
1001
|
}
|
|
1003
1002
|
}
|
|
1004
1003
|
} else {
|
|
1005
1004
|
if (Math.abs(x) < 100 && !this.lckWidth) this.posWidth = beX;
|
|
1006
1005
|
if (Math.abs(y) < 100 && !this.lckHeight) this.posHeight = beY;
|
|
1007
1006
|
}
|
|
1008
1007
|
this.touch0 = touch0;
|
|
1009
1008
|
this.drawImage();
|
|
1010
1009
|
}
|
|
1011
1010
|
}
|
|
1012
1011
|
},
|
|
1013
1012
|
end(e) {
|
|
1014
1013
|
let touches = e.touches,
|
|
1015
1014
|
touch0 = touches && touches[0],
|
|
1016
1015
|
touch1 = touches && touches[1];
|
|
1017
1016
|
if (touch0) {
|
|
1018
1017
|
this.touch0 = touch0;
|
|
1019
1018
|
} else {
|
|
1020
1019
|
this.touch0 = null;
|
|
1021
1020
|
this.touch1 = null;
|
|
1022
1021
|
this.resizeHandle = null; // 重置调整手柄
|
|
1023
1022
|
}
|
|
1024
1023
|
},
|
|
1025
1024
|
getImgData() {
|
|
1026
1025
|
return new Promise((resolve, reject) => {
|
|
1027
1026
|
let prvX = this.prvX,
|
|
1028
1027
|
prvY = this.prvY,
|
|
1029
1028
|
prvWidth = this.prvWidth,
|
|
1030
1029
|
prvHeight = this.prvHeight;
|
|
1031
1030
|
// #ifdef APP-PLUS||H5
|
|
1032
1031
|
prvX *= this.pixelRatio;
|
|
1033
1032
|
prvY *= this.pixelRatio;
|
|
1034
1033
|
prvWidth *= this.pixelRatio;
|
|
1035
1034
|
prvHeight *= this.pixelRatio;
|
|
1036
1035
|
// #endif
|
|
1037
1036
|
uni.canvasGetImageData(
|
|
1038
1037
|
{
|
|
1039
1038
|
canvasId: 'prv-canvas-' + this.instanceId,
|
|
1040
1039
|
x: prvX,
|
|
1041
1040
|
y: prvY,
|
|
1042
1041
|
width: prvWidth,
|
|
1043
1042
|
height: prvHeight,
|
|
1044
1043
|
success(res) {
|
|
1045
1044
|
resolve(res.data);
|
|
1046
1045
|
},
|
|
1047
1046
|
fail(err) {
|
|
1048
1047
|
reject(err);
|
|
1049
1048
|
}
|
|
1050
1049
|
},
|
|
1051
1050
|
this
|
|
1052
1051
|
);
|
|
1053
1052
|
});
|
|
1054
1053
|
},
|
|
1055
1054
|
async colorChange(e) {
|
|
1056
1055
|
let tm_now = Date.now();
|
|
1057
1056
|
if (tm_now - this.prvTm < 100) return;
|
|
1058
1057
|
this.prvTm = tm_now;
|
|
1059
1058
|
uni.showLoading({ mask: true });
|
|
1060
1059
|
if (!this.prvImgData) {
|
|
1061
1060
|
if (
|
|
1062
1061
|
!(this.prvImgData = await this.getImgData().catch((res) => {
|
|
1063
1062
|
uni.showToast({
|
|
1064
1063
|
title: 'error_read',
|
|
1065
1064
|
duration: 2000
|
|
1066
1065
|
});
|
|
1067
1066
|
}))
|
|
1068
1067
|
)
|
|
1069
1068
|
return;
|
|
1070
1069
|
this.target = new Uint8ClampedArray(this.prvImgData.length);
|
|
1071
1070
|
}
|
|
1072
1071
|
let data = this.prvImgData,
|
|
1073
1072
|
target = this.target,
|
|
1074
1073
|
i = e.detail.value,
|
|
1075
1074
|
r,
|
|
1076
1075
|
g,
|
|
1077
1076
|
b,
|
|
1078
1077
|
a,
|
|
1079
1078
|
h,
|
|
1080
1079
|
s,
|
|
1081
1080
|
l,
|
|
1082
1081
|
d,
|
|
1083
1082
|
p,
|
|
1084
1083
|
q,
|
|
1085
1084
|
t,
|
|
1086
1085
|
min,
|
|
1087
1086
|
max,
|
|
1088
1087
|
hK,
|
|
1089
1088
|
tR,
|
|
1090
1089
|
tG,
|
|
1091
1090
|
tB;
|
|
1092
1091
|
if (i === 0) {
|
|
1093
1092
|
target = data;
|
|
1094
1093
|
} else {
|
|
1095
1094
|
i = (i + 100) / 200;
|
|
1096
1095
|
if (i < 0.005) i = 0;
|
|
1097
1096
|
if (i > 0.995) i = 1;
|
|
1098
1097
|
for (let n = data.length - 1; n >= 0; n -= 4) {
|
|
1099
1098
|
r = data[n - 3] / 255;
|
|
1100
1099
|
g = data[n - 2] / 255;
|
|
1101
1100
|
b = data[n - 1] / 255;
|
|
1102
1101
|
max = Math.max(r, g, b);
|
|
1103
1102
|
min = Math.min(r, g, b);
|
|
1104
1103
|
d = max - min;
|
|
1105
1104
|
if (max === min) {
|
|
1106
1105
|
h = 0;
|
|
1107
1106
|
} else if (max === r && g >= b) {
|
|
1108
1107
|
h = 60 * ((g - b) / d);
|
|
1109
1108
|
} else if (max === r && g < b) {
|
|
1110
1109
|
h = 60 * ((g - b) / d) + 360;
|
|
1111
1110
|
} else if (max === g) {
|
|
1112
1111
|
h = 60 * ((b - r) / d) + 120;
|
|
1113
1112
|
} else if (max === b) {
|
|
1114
1113
|
h = 60 * ((r - g) / d) + 240;
|
|
1115
1114
|
}
|
|
1116
1115
|
l = (max + min) / 2;
|
|
1117
1116
|
if (l === 0 || max === min) {
|
|
1118
1117
|
s = 0;
|
|
1119
1118
|
} else if (0 < l && l <= 0.5) {
|
|
1120
1119
|
s = d / (2 * l);
|
|
1121
1120
|
} else if (l > 0.5) {
|
|
1122
1121
|
s = d / (2 - 2 * l);
|
|
1123
1122
|
}
|
|
1124
1123
|
data[n] && (a = data[n]);
|
|
1125
1124
|
if (i < 0.5) {
|
|
1126
1125
|
s = (s * i) / 0.5;
|
|
1127
1126
|
} else if (i > 0.5) {
|
|
1128
1127
|
s = 2 * s + 2 * i - (s * i) / 0.5 - 1;
|
|
1129
1128
|
}
|
|
1130
1129
|
if (s === 0) {
|
|
1131
1130
|
r = g = b = Math.round(l * 255);
|
|
1132
1131
|
} else {
|
|
1133
1132
|
if (l < 0.5) {
|
|
1134
1133
|
q = l * (1 + s);
|
|
1135
1134
|
} else if (l >= 0.5) {
|
|
1136
1135
|
q = l + s - l * s;
|
|
1137
1136
|
}
|
|
1138
1137
|
p = 2 * l - q;
|
|
1139
1138
|
hK = h / 360;
|
|
1140
1139
|
tR = hK + 1 / 3;
|
|
1141
1140
|
tG = hK;
|
|
1142
1141
|
tB = hK - 1 / 3;
|
|
1143
1142
|
let correctRGB = (t) => {
|
|
1144
1143
|
if (t < 0) {
|
|
1145
1144
|
return t + 1.0;
|
|
1146
1145
|
}
|
|
1147
1146
|
if (t > 1) {
|
|
1148
1147
|
return t - 1.0;
|
|
1149
1148
|
}
|
|
1150
1149
|
return t;
|
|
1151
1150
|
};
|
|
1152
1151
|
let createRGB = (t) => {
|
|
1153
1152
|
if (t < 1 / 6) {
|
|
1154
1153
|
return p + (q - p) * 6 * t;
|
|
1155
1154
|
} else if (t >= 1 / 6 && t < 1 / 2) {
|
|
1156
1155
|
return q;
|
|
1157
1156
|
} else if (t >= 1 / 2 && t < 2 / 3) {
|
|
1158
1157
|
return p + (q - p) * 6 * (2 / 3 - t);
|
|
1159
1158
|
}
|
|
1160
1159
|
return p;
|
|
1161
1160
|
};
|
|
1162
1161
|
r = tR = Math.round(createRGB(correctRGB(tR)) * 255);
|
|
1163
1162
|
g = tG = Math.round(createRGB(correctRGB(tG)) * 255);
|
|
1164
1163
|
b = tB = Math.round(createRGB(correctRGB(tB)) * 255);
|
|
1165
1164
|
}
|
|
1166
1165
|
a && (target[n] = a);
|
|
1167
1166
|
target[n - 3] = r;
|
|
1168
1167
|
target[n - 2] = g;
|
|
1169
1168
|
target[n - 1] = b;
|
|
1170
1169
|
}
|
|
1171
1170
|
}
|
|
1172
1171
|
let prvX = this.prvX,
|
|
1173
1172
|
prvY = this.prvY,
|
|
1174
1173
|
prvWidth = this.prvWidth,
|
|
1175
1174
|
prvHeight = this.prvHeight;
|
|
1176
1175
|
this.ctxCanvasPrv.setFillStyle('black');
|
|
1177
1176
|
this.ctxCanvasPrv.fillRect(prvX, prvY, prvWidth, prvHeight);
|
|
1178
1177
|
this.ctxCanvasPrv.draw(true);
|
|
1179
1178
|
// #ifdef APP-PLUS||H5
|
|
1180
1179
|
prvX *= this.pixelRatio;
|
|
1181
1180
|
prvY *= this.pixelRatio;
|
|
1182
1181
|
prvWidth *= this.pixelRatio;
|
|
1183
1182
|
prvHeight *= this.pixelRatio;
|
|
1184
1183
|
// #endif
|
|
1185
1184
|
uni.canvasPutImageData(
|
|
1186
1185
|
{
|
|
1187
1186
|
canvasId: 'prv-canvas-' + this.instanceId,
|
|
1188
1187
|
x: prvX,
|
|
1189
1188
|
y: prvY,
|
|
1190
1189
|
width: prvWidth,
|
|
1191
1190
|
height: prvHeight,
|
|
1192
1191
|
data: target,
|
|
1193
1192
|
fail() {
|
|
1194
1193
|
uni.showToast({
|
|
1195
1194
|
title: 'error_put',
|
|
1196
1195
|
duration: 2000
|
|
1197
1196
|
});
|
|
1198
1197
|
},
|
|
1199
1198
|
complete() {
|
|
1200
1199
|
uni.hideLoading();
|
|
1201
1200
|
}
|
|
1202
1201
|
},
|
|
1203
1202
|
this
|
|
1204
1203
|
);
|
|
1205
1204
|
},
|
|
1206
1205
|
btop(base64) {
|
|
1207
1206
|
return new Promise(function (resolve, reject) {
|
|
1208
1207
|
var arr = base64.split(','),
|
|
1209
1208
|
mime = arr[0].match(/:(.*?);/)[1],
|
|
1210
1209
|
bstr = atob(arr[1]),
|
|
1211
1210
|
n = bstr.length,
|
|
1212
1211
|
u8arr = new Uint8Array(n);
|
|
1213
1212
|
while (n--) {
|
|
1214
1213
|
u8arr[n] = bstr.charCodeAt(n);
|
|
1215
1214
|
}
|
|
1216
1215
|
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([u8arr], { type: mime })));
|
|
1217
1216
|
});
|
|
1218
1217
|
}
|
|
1219
1218
|
}
|
|
1219
|
+
<template>
|
|
1220
|
+
<view class="u-cropper">
|
|
1221
|
+
<!-- <image :src="imgSrc.imgSrc" @click="select" :style="[ imgStyle ]" class="my-avatar"></image> -->
|
|
1222
|
+
<canvas
|
|
1223
|
+
:canvas-id="'avatar-canvas-' + instanceId"
|
|
1224
|
+
:id="'avatar-canvas-' + instanceId"
|
|
1225
|
+
class="my-canvas"
|
|
1226
|
+
:style="{ top: styleTop, height: cvsStyleHeight }"
|
|
1227
|
+
disable-scroll="false"
|
|
1228
|
+
></canvas>
|
|
1229
|
+
<canvas
|
|
1230
|
+
:canvas-id="'oper-canvas-' + instanceId"
|
|
1231
|
+
:id="'oper-canvas-' + instanceId"
|
|
1232
|
+
class="oper-canvas"
|
|
1233
|
+
:style="{ top: styleTop, height: cvsStyleHeight }"
|
|
1234
|
+
disable-scroll="false"
|
|
1235
|
+
@touchstart="start"
|
|
1236
|
+
@touchmove="move"
|
|
1237
|
+
@touchend="end"
|
|
1238
|
+
></canvas>
|
|
1239
|
+
<canvas
|
|
1240
|
+
:canvas-id="'prv-canvas-' + instanceId"
|
|
1241
|
+
:id="'prv-canvas-' + instanceId"
|
|
1242
|
+
class="prv-canvas"
|
|
1243
|
+
disable-scroll="false"
|
|
1244
|
+
@touchstart="hideImg"
|
|
1245
|
+
:style="{ height: cvsStyleHeight, top: prvTop }"
|
|
1246
|
+
></canvas>
|
|
1247
|
+
<view class="oper-wrapper" :style="{ display: styleDisplay }">
|
|
1248
|
+
<view class="oper">
|
|
1249
|
+
<view class="btn-wrapper" v-if="showOper">
|
|
1250
|
+
<view @click="select" hover-class="hover" :style="{ width: btnWidth }">
|
|
1251
|
+
<text>{{ t('up.common.re-select') }}</text>
|
|
1252
|
+
</view>
|
|
1253
|
+
<view @click="close" hover-class="hover" :style="{ width: btnWidth }">
|
|
1254
|
+
<text>{{ t('up.common.close') }}</text>
|
|
1255
|
+
</view>
|
|
1256
|
+
<view @click="rotate" hover-class="hover" :style="{ width: btnWidth, display: btnDsp }">
|
|
1257
|
+
<text>{{ t('up.common.rotate') }}</text>
|
|
1258
|
+
</view>
|
|
1259
|
+
<view @click="preview" hover-class="hover" :style="{ width: btnWidth }">
|
|
1260
|
+
<text>{{ t('up.common.preview') }}</text>
|
|
1261
|
+
</view>
|
|
1262
|
+
<view @click="confirm" hover-class="hover" :style="{ width: btnWidth }">
|
|
1263
|
+
<text>{{ t('up.common.confirm') }}</text>
|
|
1264
|
+
</view>
|
|
1265
|
+
</view>
|
|
1266
|
+
<view class="clr-wrapper" v-else>
|
|
1267
|
+
<slider
|
|
1268
|
+
class="my-slider"
|
|
1269
|
+
@change="colorChange"
|
|
1270
|
+
block-size="25"
|
|
1271
|
+
value="0"
|
|
1272
|
+
min="-100"
|
|
1273
|
+
max="100"
|
|
1274
|
+
activeColor="red"
|
|
1275
|
+
backgroundColor="green"
|
|
1276
|
+
block-color="grey"
|
|
1277
|
+
show-value
|
|
1278
|
+
></slider>
|
|
1279
|
+
<view @click="prvUpload" hover-class="hover" :style="{ width: btnWidth }">
|
|
1280
|
+
<text>{{ t('up.common.confirm') }}</text>
|
|
1281
|
+
</view>
|
|
1282
|
+
</view>
|
|
1283
|
+
</view>
|
|
1284
|
+
</view>
|
|
1285
|
+
<view @click="chooseImage(0, {})" v-if="styleDisplay == 'none'">
|
|
1286
|
+
<slot></slot>
|
|
1287
|
+
</view>
|
|
1288
|
+
</view>
|
|
1289
|
+
</template>
|
|
1290
|
+
<script>
|
|
1291
|
+
import { t } from '../../libs/i18n';
|
|
1292
|
+
const tabHeight = 50;
|
|
1293
|
+
export default {
|
|
1294
|
+
name: 'u-cropper',
|
|
1295
|
+
data() {
|
|
1296
|
+
return {
|
|
1297
|
+
// 添加实例ID用于区分不同实例
|
|
1298
|
+
instanceId: Date.now() + '-' + Math.random().toString(36).substr(2, 9),
|
|
1299
|
+
cvsStyleHeight: '0px',
|
|
1300
|
+
styleDisplay: 'none',
|
|
1301
|
+
styleTop: '-10000px',
|
|
1302
|
+
prvTop: '-10000px',
|
|
1303
|
+
imgStyle: {},
|
|
1304
|
+
selStyle: {},
|
|
1305
|
+
showOper: true,
|
|
1306
|
+
imgSrc: {
|
|
1307
|
+
imgSrc: ''
|
|
1308
|
+
},
|
|
1309
|
+
btnWidth: '19%',
|
|
1310
|
+
btnDsp: 'flex',
|
|
1311
|
+
// 裁剪区域宽度,用于设置选择区域的宽度
|
|
1312
|
+
arWidth: '',
|
|
1313
|
+
// 裁剪区域高度,用于设置选择区域的高度
|
|
1314
|
+
arHeight: '',
|
|
1315
|
+
// 导出图片宽度,用于设置最终导出图片的宽度
|
|
1316
|
+
expWidth: '',
|
|
1317
|
+
// 导出图片高度,用于设置最终导出图片的高度
|
|
1318
|
+
expHeight: '',
|
|
1319
|
+
// 是否允许调整裁剪框大小
|
|
1320
|
+
letChangeSize: false
|
|
1321
|
+
};
|
|
1322
|
+
},
|
|
1323
|
+
watch: {
|
|
1324
|
+
avatarSrc() {
|
|
1325
|
+
this.imgSrc.imgSrc = this.avatarSrc;
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
emits: ['avtinit', 'confirm'],
|
|
1329
|
+
props: {
|
|
1330
|
+
minScale: '',
|
|
1331
|
+
maxScale: '',
|
|
1332
|
+
canScale: true,
|
|
1333
|
+
canRotate: true,
|
|
1334
|
+
lockWidth: '',
|
|
1335
|
+
lockHeight: '',
|
|
1336
|
+
stretch: '',
|
|
1337
|
+
lock: '',
|
|
1338
|
+
noTab: true,
|
|
1339
|
+
inner: false,
|
|
1340
|
+
quality: '',
|
|
1341
|
+
index: '',
|
|
1342
|
+
canChangeSize: false,
|
|
1343
|
+
areaWidth: '300rpx',
|
|
1344
|
+
// 裁剪区域高度,用于设置选择区域的高度
|
|
1345
|
+
areaHeight: '300rpx',
|
|
1346
|
+
// 导出图片宽度,用于设置最终导出图片的宽度
|
|
1347
|
+
exportWidth: '260rpx',
|
|
1348
|
+
// 导出图片高度,用于设置最终导出图片的高度
|
|
1349
|
+
exportHeight: '260rpx'
|
|
1350
|
+
},
|
|
1351
|
+
created() {
|
|
1352
|
+
this.ctxCanvas = uni.createCanvasContext('avatar-canvas-' + this.instanceId, this);
|
|
1353
|
+
this.ctxCanvasOper = uni.createCanvasContext('oper-canvas-' + this.instanceId, this);
|
|
1354
|
+
this.ctxCanvasPrv = uni.createCanvasContext('prv-canvas-' + this.instanceId, this);
|
|
1355
|
+
this.qlty = parseInt(this.quality) || 0.9;
|
|
1356
|
+
this.imgSrc.imgSrc = this.imageSrc;
|
|
1357
|
+
this.letRotate = this.canRotate === false || this.inner === true ? 0 : 1;
|
|
1358
|
+
this.letScale = this.canScale === false ? 0 : 1;
|
|
1359
|
+
// 是否允许调整裁剪框大小,false表示不允许,其他值表示允许
|
|
1360
|
+
this.letChangeSize = this.canChangeSize;
|
|
1361
|
+
this.isin = this.inner === true ? 1 : 0;
|
|
1362
|
+
this.indx = this.index || undefined;
|
|
1363
|
+
this.mnScale = this.minScale || 0.3;
|
|
1364
|
+
this.mxScale = this.maxScale || 4;
|
|
1365
|
+
this.noBar = this.noTab === true ? 1 : 0;
|
|
1366
|
+
this.stc = this.stretch;
|
|
1367
|
+
this.lck = this.lock;
|
|
1368
|
+
if (this.isin) {
|
|
1369
|
+
this.btnWidth = '24%';
|
|
1370
|
+
this.btnDsp = 'none';
|
|
1371
|
+
} else {
|
|
1372
|
+
this.btnWidth = '19%';
|
|
1373
|
+
this.btnDsp = 'flex';
|
|
1374
|
+
}
|
|
1375
|
+
if (this.noBar) {
|
|
1376
|
+
this.moreHeight = 0;
|
|
1377
|
+
this.windowResize();
|
|
1378
|
+
} else {
|
|
1379
|
+
uni.showTabBar({
|
|
1380
|
+
complete: (res) => {
|
|
1381
|
+
this.moreHeight = res.errMsg === 'showTabBar:ok' ? 50 : 0;
|
|
1382
|
+
this.windowResize();
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
methods: {
|
|
1388
|
+
t,
|
|
1389
|
+
windowResize() {
|
|
1390
|
+
let sysInfo = uni.getSystemInfoSync();
|
|
1391
|
+
this.platform = sysInfo.platform;
|
|
1392
|
+
this.pixelRatio = sysInfo.pixelRatio;
|
|
1393
|
+
this.windowWidth = sysInfo.windowWidth;
|
|
1394
|
+
// #ifdef H5
|
|
1395
|
+
this.drawTop = sysInfo.windowTop;
|
|
1396
|
+
this.windowHeight = sysInfo.windowHeight + sysInfo.windowBottom;
|
|
1397
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
1398
|
+
// #endif
|
|
1399
|
+
// #ifdef APP-PLUS
|
|
1400
|
+
if (this.platform === 'android') {
|
|
1401
|
+
this.windowHeight = sysInfo.screenHeight + sysInfo.statusBarHeight;
|
|
1402
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
1403
|
+
} else {
|
|
1404
|
+
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
1405
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight + 6 + 'px';
|
|
1406
|
+
}
|
|
1407
|
+
// #endif
|
|
1408
|
+
// #ifdef MP
|
|
1409
|
+
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
1410
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight - 2 + 'px';
|
|
1411
|
+
// #endif
|
|
1412
|
+
this.pxRatio = this.windowWidth / 750;
|
|
1413
|
+
let style = this.avatarStyle;
|
|
1414
|
+
if (style && style !== true && (style = style.trim())) {
|
|
1415
|
+
style = style.split(';');
|
|
1416
|
+
let obj = {};
|
|
1417
|
+
for (let v of style) {
|
|
1418
|
+
if (!v) continue;
|
|
1419
|
+
v = v.trim().split(':');
|
|
1420
|
+
if (v[1].indexOf('rpx') >= 0) {
|
|
1421
|
+
let arr = v[1].trim().split(' ');
|
|
1422
|
+
for (let k in arr) {
|
|
1423
|
+
if (!arr[k]) continue;
|
|
1424
|
+
if (arr[k].indexOf('rpx') >= 0) {
|
|
1425
|
+
arr[k] = parseFloat(arr[k]) * this.pxRatio + 'px';
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
v[1] = arr.join(' ');
|
|
1429
|
+
}
|
|
1430
|
+
obj[v[0].trim()] = v[1].trim();
|
|
1431
|
+
}
|
|
1432
|
+
this.imgStyle = obj;
|
|
1433
|
+
}
|
|
1434
|
+
this.expWidth &&
|
|
1435
|
+
(this.expWidth = this.expWidth.indexOf('rpx') >= 0 ? parseInt(this.expWidth) * this.pxRatio : parseInt(this.expWidth));
|
|
1436
|
+
this.expHeight &&
|
|
1437
|
+
(this.expHeight =
|
|
1438
|
+
this.expHeight.indexOf('rpx') >= 0 ? parseInt(this.expHeight) * this.pxRatio : parseInt(this.expHeight));
|
|
1439
|
+
if (this.styleDisplay === 'flex') {
|
|
1440
|
+
this.drawInit(true);
|
|
1441
|
+
}
|
|
1442
|
+
this.hideImg();
|
|
1443
|
+
},
|
|
1444
|
+
select() {
|
|
1445
|
+
if (this.fSelecting) return;
|
|
1446
|
+
this.fSelecting = true;
|
|
1447
|
+
setTimeout(() => {
|
|
1448
|
+
this.fSelecting = false;
|
|
1449
|
+
}, 500);
|
|
1450
|
+
uni.chooseImage({
|
|
1451
|
+
count: 1,
|
|
1452
|
+
sizeType: ['original', 'compressed'],
|
|
1453
|
+
sourceType: ['album', 'camera'],
|
|
1454
|
+
success: (r) => {
|
|
1455
|
+
uni.showLoading({ mask: true });
|
|
1456
|
+
let path = (this.imgPath = r.tempFilePaths[0]);
|
|
1457
|
+
uni.getImageInfo({
|
|
1458
|
+
src: path,
|
|
1459
|
+
success: (r) => {
|
|
1460
|
+
this.imgWidth = r.width;
|
|
1461
|
+
this.imgHeight = r.height;
|
|
1462
|
+
this.path = path;
|
|
1463
|
+
if (!this.hasSel) {
|
|
1464
|
+
let style = this.selStyle || {};
|
|
1465
|
+
if (this.arWidth && this.arHeight) {
|
|
1466
|
+
let areaWidth =
|
|
1467
|
+
this.arWidth.indexOf('rpx') >= 0 ? parseInt(this.arWidth) * this.pxRatio : parseInt(this.arWidth),
|
|
1468
|
+
areaHeight =
|
|
1469
|
+
this.arHeight.indexOf('rpx') >= 0 ? parseInt(this.arHeight) * this.pxRatio : parseInt(this.arHeight);
|
|
1470
|
+
style.width = areaWidth + 'px';
|
|
1471
|
+
style.height = areaHeight + 'px';
|
|
1472
|
+
style.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
1473
|
+
style.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
1474
|
+
} else {
|
|
1475
|
+
uni.showModal({
|
|
1476
|
+
title: t('up.cropper.emptyWidhtOrHeight'),
|
|
1477
|
+
showCancel: false
|
|
1478
|
+
});
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
this.selStyle = style;
|
|
1482
|
+
}
|
|
1483
|
+
if (this.noBar) {
|
|
1484
|
+
this.drawInit(true);
|
|
1485
|
+
} else {
|
|
1486
|
+
uni.hideTabBar({
|
|
1487
|
+
complete: () => {
|
|
1488
|
+
this.drawInit(true);
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
},
|
|
1493
|
+
fail: () => {
|
|
1494
|
+
uni.showToast({
|
|
1495
|
+
title: 'error3',
|
|
1496
|
+
duration: 2000
|
|
1497
|
+
});
|
|
1498
|
+
},
|
|
1499
|
+
complete() {
|
|
1500
|
+
uni.hideLoading();
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
},
|
|
1506
|
+
confirm() {
|
|
1507
|
+
if (this.fUploading) return;
|
|
1508
|
+
this.fUploading = true;
|
|
1509
|
+
setTimeout(() => {
|
|
1510
|
+
this.fUploading = false;
|
|
1511
|
+
}, 1000);
|
|
1512
|
+
let style = this.selStyle,
|
|
1513
|
+
x = parseInt(style.left),
|
|
1514
|
+
y = parseInt(style.top),
|
|
1515
|
+
width = parseInt(style.width),
|
|
1516
|
+
height = parseInt(style.height),
|
|
1517
|
+
expWidth = this.expWidth || width,
|
|
1518
|
+
expHeight = this.expHeight || height;
|
|
1519
|
+
// #ifdef H5
|
|
1520
|
+
// x *= this.pixelRatio;
|
|
1521
|
+
// y *= this.pixelRatio;
|
|
1522
|
+
expWidth = width;
|
|
1523
|
+
expHeight = height;
|
|
1524
|
+
// #endif
|
|
1525
|
+
uni.showLoading({ mask: true });
|
|
1526
|
+
this.styleDisplay = 'none';
|
|
1527
|
+
this.styleTop = '-10000px';
|
|
1528
|
+
this.hasSel = false;
|
|
1529
|
+
this.hideImg();
|
|
1530
|
+
uni.canvasToTempFilePath(
|
|
1531
|
+
{
|
|
1532
|
+
x: x,
|
|
1533
|
+
y: y,
|
|
1534
|
+
width: width,
|
|
1535
|
+
height: height,
|
|
1536
|
+
destWidth: expWidth,
|
|
1537
|
+
destHeight: expHeight,
|
|
1538
|
+
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
1539
|
+
fileType: 'png',
|
|
1540
|
+
quality: this.qlty,
|
|
1541
|
+
success: (r) => {
|
|
1542
|
+
r = r.tempFilePath;
|
|
1543
|
+
// #ifdef H5
|
|
1544
|
+
this.btop(r).then((r) => {
|
|
1545
|
+
if (this.expWidth && this.expHeight) {
|
|
1546
|
+
let ctxCanvas = this.ctxCanvas;
|
|
1547
|
+
((expWidth = this.expWidth), (expHeight = this.expHeight));
|
|
1548
|
+
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
1549
|
+
ctxCanvas.draw(false, () => {
|
|
1550
|
+
uni.canvasToTempFilePath({
|
|
1551
|
+
x: 0,
|
|
1552
|
+
y: 0,
|
|
1553
|
+
width: expWidth,
|
|
1554
|
+
height: expHeight,
|
|
1555
|
+
destWidth: expWidth,
|
|
1556
|
+
destHeight: expHeight,
|
|
1557
|
+
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
1558
|
+
fileType: 'png',
|
|
1559
|
+
quality: this.qlty,
|
|
1560
|
+
success: (r) => {
|
|
1561
|
+
r = r.tempFilePath;
|
|
1562
|
+
this.btop(r).then((r) => {
|
|
1563
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1564
|
+
});
|
|
1565
|
+
},
|
|
1566
|
+
fail: () => {
|
|
1567
|
+
uni.showToast({
|
|
1568
|
+
title: 'error0',
|
|
1569
|
+
duration: 2000
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
});
|
|
1574
|
+
} else {
|
|
1575
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
// #endif
|
|
1579
|
+
// #ifndef H5
|
|
1580
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1581
|
+
// #endif
|
|
1582
|
+
},
|
|
1583
|
+
fail: (res) => {
|
|
1584
|
+
uni.showToast({
|
|
1585
|
+
title: 'error1',
|
|
1586
|
+
duration: 2000
|
|
1587
|
+
});
|
|
1588
|
+
},
|
|
1589
|
+
complete: () => {
|
|
1590
|
+
uni.hideLoading();
|
|
1591
|
+
this.noBar || uni.showTabBar();
|
|
1592
|
+
}
|
|
1593
|
+
},
|
|
1594
|
+
this
|
|
1595
|
+
);
|
|
1596
|
+
},
|
|
1597
|
+
// 用户点击"预览"模式下的"确认"按钮时被调用,用于将预览的裁剪结果上传
|
|
1598
|
+
prvUpload() {
|
|
1599
|
+
if (this.fPrvUploading) return;
|
|
1600
|
+
this.fPrvUploading = true;
|
|
1601
|
+
setTimeout(() => {
|
|
1602
|
+
this.fPrvUploading = false;
|
|
1603
|
+
}, 1000);
|
|
1604
|
+
let style = this.selStyle,
|
|
1605
|
+
destWidth = parseInt(style.width),
|
|
1606
|
+
destHeight = parseInt(style.height),
|
|
1607
|
+
prvX = this.prvX,
|
|
1608
|
+
prvY = this.prvY,
|
|
1609
|
+
prvWidth = this.prvWidth,
|
|
1610
|
+
prvHeight = this.prvHeight,
|
|
1611
|
+
expWidth = this.expWidth || prvWidth,
|
|
1612
|
+
expHeight = this.expHeight || prvHeight;
|
|
1613
|
+
// #ifdef H5
|
|
1614
|
+
// prvX *= this.pixelRatio;
|
|
1615
|
+
// prvY *= this.pixelRatio;
|
|
1616
|
+
expWidth = prvWidth;
|
|
1617
|
+
expHeight = prvHeight;
|
|
1618
|
+
// #endif
|
|
1619
|
+
uni.showLoading({ mask: true });
|
|
1620
|
+
this.styleDisplay = 'none';
|
|
1621
|
+
this.styleTop = '-10000px';
|
|
1622
|
+
this.hasSel = false;
|
|
1623
|
+
this.hideImg();
|
|
1624
|
+
uni.canvasToTempFilePath(
|
|
1625
|
+
{
|
|
1626
|
+
x: prvX,
|
|
1627
|
+
y: prvY,
|
|
1628
|
+
width: prvWidth,
|
|
1629
|
+
height: prvHeight,
|
|
1630
|
+
destWidth: expWidth,
|
|
1631
|
+
destHeight: expHeight,
|
|
1632
|
+
canvasId: 'prv-canvas-' + this.instanceId,
|
|
1633
|
+
fileType: 'png',
|
|
1634
|
+
quality: this.qlty,
|
|
1635
|
+
success: (r) => {
|
|
1636
|
+
r = r.tempFilePath;
|
|
1637
|
+
// #ifdef H5
|
|
1638
|
+
this.btop(r).then((r) => {
|
|
1639
|
+
if (this.expWidth && this.expHeight) {
|
|
1640
|
+
let ctxCanvas = this.ctxCanvas;
|
|
1641
|
+
((expWidth = this.expWidth), (expHeight = this.expHeight));
|
|
1642
|
+
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
1643
|
+
ctxCanvas.draw(false, () => {
|
|
1644
|
+
uni.canvasToTempFilePath({
|
|
1645
|
+
x: 0,
|
|
1646
|
+
y: 0,
|
|
1647
|
+
width: expWidth,
|
|
1648
|
+
height: expHeight,
|
|
1649
|
+
destWidth: expWidth,
|
|
1650
|
+
destHeight: expHeight,
|
|
1651
|
+
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
1652
|
+
fileType: 'png',
|
|
1653
|
+
quality: this.qlty,
|
|
1654
|
+
success: (r) => {
|
|
1655
|
+
r = r.tempFilePath;
|
|
1656
|
+
this.btop(r).then((r) => {
|
|
1657
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1658
|
+
});
|
|
1659
|
+
},
|
|
1660
|
+
fail: () => {
|
|
1661
|
+
uni.showToast({
|
|
1662
|
+
title: 'error0',
|
|
1663
|
+
duration: 2000
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
});
|
|
1668
|
+
} else {
|
|
1669
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
// #endif
|
|
1673
|
+
// #ifndef H5
|
|
1674
|
+
this.$emit('confirm', { avatar: this.imgSrc, path: r, index: this.indx, data: this.rtn });
|
|
1675
|
+
// #endif
|
|
1676
|
+
},
|
|
1677
|
+
fail: () => {
|
|
1678
|
+
uni.showToast({
|
|
1679
|
+
title: 'error_prv',
|
|
1680
|
+
duration: 2000
|
|
1681
|
+
});
|
|
1682
|
+
},
|
|
1683
|
+
complete: () => {
|
|
1684
|
+
uni.hideLoading();
|
|
1685
|
+
this.noBar || uni.showTabBar();
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
this
|
|
1689
|
+
);
|
|
1690
|
+
},
|
|
1691
|
+
drawInit(ini = false) {
|
|
1692
|
+
let allWidth = this.windowWidth,
|
|
1693
|
+
allHeight = this.windowHeight,
|
|
1694
|
+
imgWidth = this.imgWidth,
|
|
1695
|
+
imgHeight = this.imgHeight,
|
|
1696
|
+
imgRadio = imgWidth / imgHeight,
|
|
1697
|
+
useWidth = allWidth - 40,
|
|
1698
|
+
useHeight = allHeight - tabHeight - 80,
|
|
1699
|
+
pixelRatio = this.pixelRatio,
|
|
1700
|
+
selWidth = parseInt(this.selStyle.width),
|
|
1701
|
+
selHeight = parseInt(this.selStyle.height);
|
|
1702
|
+
this.fixWidth = 0;
|
|
1703
|
+
this.fixHeight = 0;
|
|
1704
|
+
this.lckWidth = 0;
|
|
1705
|
+
this.lckHeight = 0;
|
|
1706
|
+
switch (this.stc) {
|
|
1707
|
+
case 'x':
|
|
1708
|
+
this.fixWidth = 1;
|
|
1709
|
+
break;
|
|
1710
|
+
case 'y':
|
|
1711
|
+
this.fixHeight = 1;
|
|
1712
|
+
break;
|
|
1713
|
+
case 'long':
|
|
1714
|
+
if (imgRadio > 1) this.fixWidth = 1;
|
|
1715
|
+
else this.fixHeight = 1;
|
|
1716
|
+
break;
|
|
1717
|
+
case 'short':
|
|
1718
|
+
if (imgRadio > 1) this.fixHeight = 1;
|
|
1719
|
+
else this.fixWidth = 1;
|
|
1720
|
+
break;
|
|
1721
|
+
case 'longSel':
|
|
1722
|
+
if (selWidth > selHeight) this.fixWidth = 1;
|
|
1723
|
+
else this.fixHeight = 1;
|
|
1724
|
+
break;
|
|
1725
|
+
case 'shortSel':
|
|
1726
|
+
if (selWidth > selHeight) this.fixHeight = 1;
|
|
1727
|
+
else this.fixWidth = 1;
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
// lck 用于控制裁剪框的宽度和高度锁定行为
|
|
1731
|
+
// 'x': 锁定宽度,不允许水平方向调整
|
|
1732
|
+
// 'y': 锁定高度,不允许垂直方向调整
|
|
1733
|
+
// 'long': 根据图片长边锁定,如果图片横向较长则锁定宽度,否则锁定高度
|
|
1734
|
+
// 'short': 根据图片短边锁定,如果图片横向较长则锁定高度,否则锁定宽度
|
|
1735
|
+
// 'longSel': 根据选择框的长边锁定,如果选择框宽度大于高度则锁定宽度,否则锁定高度
|
|
1736
|
+
// 'shortSel': 根据选择框的短边锁定,如果选择框宽度大于高度则锁定高度,否则锁定宽度
|
|
1737
|
+
switch (this.lck) {
|
|
1738
|
+
case 'x':
|
|
1739
|
+
this.lckWidth = 1;
|
|
1740
|
+
break;
|
|
1741
|
+
case 'y':
|
|
1742
|
+
this.lckHeight = 1;
|
|
1743
|
+
break;
|
|
1744
|
+
case 'long':
|
|
1745
|
+
if (imgRadio > 1) this.lckWidth = 1;
|
|
1746
|
+
else this.lckHeight = 1;
|
|
1747
|
+
break;
|
|
1748
|
+
case 'short':
|
|
1749
|
+
if (imgRadio > 1) this.lckHeight = 1;
|
|
1750
|
+
else this.lckWidth = 1;
|
|
1751
|
+
break;
|
|
1752
|
+
case 'longSel':
|
|
1753
|
+
if (selWidth > selHeight) this.lckWidth = 1;
|
|
1754
|
+
else this.lckHeight = 1;
|
|
1755
|
+
break;
|
|
1756
|
+
case 'shortSel':
|
|
1757
|
+
if (selWidth > selHeight) this.lckHeight = 1;
|
|
1758
|
+
else this.lckWidth = 1;
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
if (this.fixWidth) {
|
|
1762
|
+
useWidth = selWidth;
|
|
1763
|
+
useHeight = useWidth / imgRadio;
|
|
1764
|
+
} else if (this.fixHeight) {
|
|
1765
|
+
useHeight = selHeight;
|
|
1766
|
+
useWidth = useHeight * imgRadio;
|
|
1767
|
+
} else if (imgRadio < 1) {
|
|
1768
|
+
if (imgHeight < useHeight) {
|
|
1769
|
+
useWidth = imgWidth;
|
|
1770
|
+
useHeight = imgHeight;
|
|
1771
|
+
} else {
|
|
1772
|
+
useHeight = useHeight;
|
|
1773
|
+
useWidth = useHeight * imgRadio;
|
|
1774
|
+
}
|
|
1775
|
+
} else {
|
|
1776
|
+
if (imgWidth < useWidth) {
|
|
1777
|
+
useWidth = imgWidth;
|
|
1778
|
+
useHeight = imgHeight;
|
|
1779
|
+
} else {
|
|
1780
|
+
useWidth = useWidth;
|
|
1781
|
+
useHeight = useWidth / imgRadio;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (this.isin) {
|
|
1785
|
+
this.scaleWidth = 0;
|
|
1786
|
+
this.scaleHeight = 0;
|
|
1787
|
+
if (useWidth < selWidth) {
|
|
1788
|
+
useWidth = selWidth;
|
|
1789
|
+
useHeight = useWidth / imgRadio;
|
|
1790
|
+
this.lckHeight = 0;
|
|
1791
|
+
}
|
|
1792
|
+
if (useHeight < selHeight) {
|
|
1793
|
+
useHeight = selHeight;
|
|
1794
|
+
useWidth = useHeight * imgRadio;
|
|
1795
|
+
this.lckWidth = 0;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
this.scaleSize = 1;
|
|
1799
|
+
this.rotateDeg = 0;
|
|
1800
|
+
this.posWidth = (allWidth - useWidth) / 2;
|
|
1801
|
+
this.posHeight = (allHeight - useHeight - tabHeight) / 2;
|
|
1802
|
+
this.useWidth = useWidth;
|
|
1803
|
+
this.useHeight = useHeight;
|
|
1804
|
+
let style = this.selStyle,
|
|
1805
|
+
left = parseInt(style.left),
|
|
1806
|
+
top = parseInt(style.top),
|
|
1807
|
+
width = parseInt(style.width),
|
|
1808
|
+
height = parseInt(style.height),
|
|
1809
|
+
canvas = this.canvas,
|
|
1810
|
+
canvasOper = this.canvasOper,
|
|
1811
|
+
ctxCanvas = this.ctxCanvas,
|
|
1812
|
+
ctxCanvasOper = this.ctxCanvasOper;
|
|
1813
|
+
ctxCanvasOper.setLineWidth(3);
|
|
1814
|
+
ctxCanvasOper.setStrokeStyle('grey');
|
|
1815
|
+
ctxCanvasOper.setGlobalAlpha(0.4);
|
|
1816
|
+
ctxCanvasOper.setFillStyle('black');
|
|
1817
|
+
ctxCanvasOper.strokeRect(left, top, width, height);
|
|
1818
|
+
ctxCanvasOper.fillRect(0, 0, this.windowWidth, top);
|
|
1819
|
+
ctxCanvasOper.fillRect(0, top, left, height);
|
|
1820
|
+
ctxCanvasOper.fillRect(0, top + height, this.windowWidth, this.windowHeight - height - top - tabHeight);
|
|
1821
|
+
ctxCanvasOper.fillRect(left + width, top, this.windowWidth - width - left, height);
|
|
1822
|
+
ctxCanvasOper.setStrokeStyle('red');
|
|
1823
|
+
ctxCanvasOper.moveTo(left + 20, top);
|
|
1824
|
+
ctxCanvasOper.lineTo(left, top);
|
|
1825
|
+
ctxCanvasOper.lineTo(left, top + 20);
|
|
1826
|
+
ctxCanvasOper.moveTo(left + width - 20, top);
|
|
1827
|
+
ctxCanvasOper.lineTo(left + width, top);
|
|
1828
|
+
ctxCanvasOper.lineTo(left + width, top + 20);
|
|
1829
|
+
ctxCanvasOper.moveTo(left + 20, top + height);
|
|
1830
|
+
ctxCanvasOper.lineTo(left, top + height);
|
|
1831
|
+
ctxCanvasOper.lineTo(left, top + height - 20);
|
|
1832
|
+
ctxCanvasOper.moveTo(left + width - 20, top + height);
|
|
1833
|
+
ctxCanvasOper.lineTo(left + width, top + height);
|
|
1834
|
+
ctxCanvasOper.lineTo(left + width, top + height - 20);
|
|
1835
|
+
// 绘制控制点(四个角)
|
|
1836
|
+
const controlPointSize = 10;
|
|
1837
|
+
ctxCanvasOper.setFillStyle('white');
|
|
1838
|
+
ctxCanvasOper.setStrokeStyle('grey');
|
|
1839
|
+
ctxCanvasOper.setLineWidth(1);
|
|
1840
|
+
// 左上角
|
|
1841
|
+
ctxCanvasOper.fillRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
1842
|
+
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
1843
|
+
// 右上角
|
|
1844
|
+
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
|
|
1845
|
+
ctxCanvasOper.strokeRect(
|
|
1846
|
+
left + width - controlPointSize / 2,
|
|
1847
|
+
top - controlPointSize / 2,
|
|
1848
|
+
controlPointSize,
|
|
1849
|
+
controlPointSize
|
|
1850
|
+
);
|
|
1851
|
+
// 左下角
|
|
1852
|
+
ctxCanvasOper.fillRect(
|
|
1853
|
+
left - controlPointSize / 2,
|
|
1854
|
+
top + height - controlPointSize / 2,
|
|
1855
|
+
controlPointSize,
|
|
1856
|
+
controlPointSize
|
|
1857
|
+
);
|
|
1858
|
+
ctxCanvasOper.strokeRect(
|
|
1859
|
+
left - controlPointSize / 2,
|
|
1860
|
+
top + height - controlPointSize / 2,
|
|
1861
|
+
controlPointSize,
|
|
1862
|
+
controlPointSize
|
|
1863
|
+
);
|
|
1864
|
+
// 右下角
|
|
1865
|
+
ctxCanvasOper.fillRect(
|
|
1866
|
+
left + width - controlPointSize / 2,
|
|
1867
|
+
top + height - controlPointSize / 2,
|
|
1868
|
+
controlPointSize,
|
|
1869
|
+
controlPointSize
|
|
1870
|
+
);
|
|
1871
|
+
ctxCanvasOper.strokeRect(
|
|
1872
|
+
left + width - controlPointSize / 2,
|
|
1873
|
+
top + height - controlPointSize / 2,
|
|
1874
|
+
controlPointSize,
|
|
1875
|
+
controlPointSize
|
|
1876
|
+
);
|
|
1877
|
+
ctxCanvasOper.stroke();
|
|
1878
|
+
ctxCanvasOper.draw(false, () => {
|
|
1879
|
+
if (ini) {
|
|
1880
|
+
this.styleDisplay = 'flex';
|
|
1881
|
+
// #ifdef H5
|
|
1882
|
+
this.styleTop = this.drawTop + 'px';
|
|
1883
|
+
// #endif
|
|
1884
|
+
// #ifndef H5
|
|
1885
|
+
this.styleTop = '0';
|
|
1886
|
+
// #endif
|
|
1887
|
+
ctxCanvas.setFillStyle('black');
|
|
1888
|
+
this.drawImage();
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
this.$emit('avtinit');
|
|
1892
|
+
},
|
|
1893
|
+
drawImage() {
|
|
1894
|
+
let tm_now = Date.now();
|
|
1895
|
+
if (tm_now - this.drawTm < 20) return;
|
|
1896
|
+
this.drawTm = tm_now;
|
|
1897
|
+
let ctxCanvas = this.ctxCanvas;
|
|
1898
|
+
ctxCanvas.fillRect(0, 0, this.windowWidth, this.windowHeight - tabHeight);
|
|
1899
|
+
ctxCanvas.translate(this.posWidth + this.useWidth / 2, this.posHeight + this.useHeight / 2);
|
|
1900
|
+
ctxCanvas.scale(this.scaleSize, this.scaleSize);
|
|
1901
|
+
ctxCanvas.rotate((this.rotateDeg * Math.PI) / 180);
|
|
1902
|
+
ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
|
|
1903
|
+
ctxCanvas.draw(false);
|
|
1904
|
+
},
|
|
1905
|
+
hideImg() {
|
|
1906
|
+
this.prvImg = '';
|
|
1907
|
+
this.prvTop = '-10000px';
|
|
1908
|
+
this.showOper = true;
|
|
1909
|
+
this.prvImgData = null;
|
|
1910
|
+
this.target = null;
|
|
1911
|
+
},
|
|
1912
|
+
close() {
|
|
1913
|
+
this.styleDisplay = 'none';
|
|
1914
|
+
this.styleTop = '-10000px';
|
|
1915
|
+
this.hasSel = false;
|
|
1916
|
+
this.hideImg();
|
|
1917
|
+
this.noBar || uni.showTabBar();
|
|
1918
|
+
},
|
|
1919
|
+
preview() {
|
|
1920
|
+
if (this.fPreviewing) return;
|
|
1921
|
+
this.fPreviewing = true;
|
|
1922
|
+
setTimeout(() => {
|
|
1923
|
+
this.fPreviewing = false;
|
|
1924
|
+
}, 1000);
|
|
1925
|
+
let style = this.selStyle,
|
|
1926
|
+
x = parseInt(style.left),
|
|
1927
|
+
y = parseInt(style.top),
|
|
1928
|
+
width = parseInt(style.width),
|
|
1929
|
+
height = parseInt(style.height);
|
|
1930
|
+
uni.showLoading({ mask: true });
|
|
1931
|
+
// console.log('size', x, y, width, height)
|
|
1932
|
+
uni.canvasToTempFilePath(
|
|
1933
|
+
{
|
|
1934
|
+
x: x,
|
|
1935
|
+
y: y,
|
|
1936
|
+
width: width,
|
|
1937
|
+
height: height,
|
|
1938
|
+
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
1939
|
+
fileType: 'png',
|
|
1940
|
+
quality: this.qlty,
|
|
1941
|
+
success: (r) => {
|
|
1942
|
+
// console.log(r)
|
|
1943
|
+
this.prvImgTmp = r = r.tempFilePath;
|
|
1944
|
+
let ctxCanvasPrv = this.ctxCanvasPrv,
|
|
1945
|
+
prvX = this.windowWidth,
|
|
1946
|
+
prvY = parseInt(this.cvsStyleHeight),
|
|
1947
|
+
prvWidth = parseInt(this.selStyle.width),
|
|
1948
|
+
prvHeight = parseInt(this.selStyle.height),
|
|
1949
|
+
useWidth = prvX - 40,
|
|
1950
|
+
useHeight = prvY - 80,
|
|
1951
|
+
radio = useWidth / prvWidth,
|
|
1952
|
+
rHeight = prvHeight * radio;
|
|
1953
|
+
if (rHeight < useHeight) {
|
|
1954
|
+
prvWidth = useWidth;
|
|
1955
|
+
prvHeight = rHeight;
|
|
1956
|
+
} else {
|
|
1957
|
+
radio = useHeight / prvHeight;
|
|
1958
|
+
prvWidth *= radio;
|
|
1959
|
+
prvHeight = useHeight;
|
|
1960
|
+
}
|
|
1961
|
+
ctxCanvasPrv.setFillStyle('black');
|
|
1962
|
+
ctxCanvasPrv.fillRect(0, 0, prvX, prvY);
|
|
1963
|
+
ctxCanvasPrv.fillRect(x, y, width, height);
|
|
1964
|
+
this.prvX = prvX = (prvX - prvWidth) / 2;
|
|
1965
|
+
this.prvY = prvY = (prvY - prvHeight) / 2;
|
|
1966
|
+
this.prvWidth = prvWidth;
|
|
1967
|
+
this.prvHeight = prvHeight;
|
|
1968
|
+
ctxCanvasPrv.drawImage(r, prvX, prvY, prvWidth, prvHeight);
|
|
1969
|
+
ctxCanvasPrv.draw(false, () => {
|
|
1970
|
+
// #ifdef H5
|
|
1971
|
+
this.btop(this.prvImgTmp).then((r) => {
|
|
1972
|
+
this.showOper = false;
|
|
1973
|
+
this.prvTop = this.drawTop + 'px';
|
|
1974
|
+
});
|
|
1975
|
+
// #endif
|
|
1976
|
+
// #ifndef H5
|
|
1977
|
+
if (this.platform != 'android') {
|
|
1978
|
+
this.showOper = false;
|
|
1979
|
+
}
|
|
1980
|
+
this.prvTop = '0';
|
|
1981
|
+
// #endif
|
|
1982
|
+
});
|
|
1983
|
+
},
|
|
1984
|
+
fail: () => {
|
|
1985
|
+
uni.showToast({
|
|
1986
|
+
title: 'error2',
|
|
1987
|
+
duration: 2000
|
|
1988
|
+
});
|
|
1989
|
+
},
|
|
1990
|
+
complete: () => {
|
|
1991
|
+
uni.hideLoading();
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
this
|
|
1995
|
+
);
|
|
1996
|
+
},
|
|
1997
|
+
chooseImage(index = undefined, params = undefined, data = undefined) {
|
|
1998
|
+
if (params) {
|
|
1999
|
+
console.log(params);
|
|
2000
|
+
let areaWidth = params.areaWidth || this.areaWidth,
|
|
2001
|
+
areaHeight = params.areaHeight || this.areaHeight,
|
|
2002
|
+
expWidth = params.exportWidth || this.exportWidth,
|
|
2003
|
+
expHeight = params.exportHeight || this.exportHeight,
|
|
2004
|
+
quality = params.quality,
|
|
2005
|
+
canRotate = params.canRotate,
|
|
2006
|
+
canScale = params.canScale,
|
|
2007
|
+
canChangeSize = params.canChangeSize,
|
|
2008
|
+
minScale = params.minScale,
|
|
2009
|
+
maxScale = params.maxScale,
|
|
2010
|
+
stretch = params.stretch,
|
|
2011
|
+
inner = params.inner,
|
|
2012
|
+
lock = params.lock;
|
|
2013
|
+
console.log('areaWidth', this.areaWidth);
|
|
2014
|
+
expWidth && (this.expWidth = expWidth.indexOf('rpx') >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt(expWidth));
|
|
2015
|
+
expHeight && (this.expHeight = expHeight.indexOf('rpx') >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt(expHeight));
|
|
2016
|
+
this.letRotate = canRotate === false ? 0 : 1;
|
|
2017
|
+
this.letScale = canScale === false ? 0 : 1;
|
|
2018
|
+
// 设置是否允许调整裁剪框大小
|
|
2019
|
+
this.letChangeSize = canChangeSize || false;
|
|
2020
|
+
this.qlty = parseInt(quality) || 0.9;
|
|
2021
|
+
this.mnScale = minScale || 0.3;
|
|
2022
|
+
this.mxScale = maxScale || 4;
|
|
2023
|
+
this.stc = stretch;
|
|
2024
|
+
this.isin = inner === true ? 1 : 0;
|
|
2025
|
+
this.lck = lock;
|
|
2026
|
+
if (this.isin) {
|
|
2027
|
+
this.btnWidth = '24%';
|
|
2028
|
+
this.btnDsp = 'none';
|
|
2029
|
+
} else {
|
|
2030
|
+
this.btnWidth = '19%';
|
|
2031
|
+
this.btnDsp = 'flex';
|
|
2032
|
+
}
|
|
2033
|
+
if (areaWidth && areaHeight) {
|
|
2034
|
+
areaWidth = areaWidth.indexOf('rpx') >= 0 ? parseInt(areaWidth) * this.pxRatio : parseInt(areaWidth);
|
|
2035
|
+
areaHeight = areaHeight.indexOf('rpx') >= 0 ? parseInt(areaHeight) * this.pxRatio : parseInt(areaHeight);
|
|
2036
|
+
this.selStyle.width = areaWidth + 'px';
|
|
2037
|
+
this.selStyle.height = areaHeight + 'px';
|
|
2038
|
+
this.selStyle.top = (this.windowHeight - areaHeight - tabHeight) / 2 + 'px';
|
|
2039
|
+
this.selStyle.left = (this.windowWidth - areaWidth) / 2 + 'px';
|
|
2040
|
+
// console.log(this.selStyle);
|
|
2041
|
+
this.hasSel = true;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
this.rtn = data;
|
|
2045
|
+
this.indx = index;
|
|
2046
|
+
this.select();
|
|
2047
|
+
},
|
|
2048
|
+
rotate() {
|
|
2049
|
+
// #ifdef APP-PLUS
|
|
2050
|
+
if (this.platform === 'android') {
|
|
2051
|
+
if (this.fRotateing) return;
|
|
2052
|
+
this.fRotateing = true;
|
|
2053
|
+
setTimeout(() => {
|
|
2054
|
+
this.fRotateing = false;
|
|
2055
|
+
}, 500);
|
|
2056
|
+
}
|
|
2057
|
+
// #endif
|
|
2058
|
+
// if(this.letRotate) {
|
|
2059
|
+
this.rotateDeg += 90 - (this.rotateDeg % 90);
|
|
2060
|
+
this.drawImage();
|
|
2061
|
+
// }
|
|
2062
|
+
},
|
|
2063
|
+
start(e) {
|
|
2064
|
+
let touches = e.touches,
|
|
2065
|
+
touch0 = touches[0],
|
|
2066
|
+
touch1 = touches[1];
|
|
2067
|
+
this.touch0 = touch0;
|
|
2068
|
+
this.touch1 = touch1;
|
|
2069
|
+
if (touch1) {
|
|
2070
|
+
let x = touch1.x - touch0.x,
|
|
2071
|
+
y = touch1.y - touch0.y;
|
|
2072
|
+
this.fgDistance = Math.sqrt(x * x + y * y);
|
|
2073
|
+
} else {
|
|
2074
|
+
// 只有在允许调整大小时才检查控制点
|
|
2075
|
+
if (this.letChangeSize) {
|
|
2076
|
+
// 检查是否点击在控制点上
|
|
2077
|
+
const controlPointSize = 20;
|
|
2078
|
+
const x = touch0.x;
|
|
2079
|
+
const y = touch0.y;
|
|
2080
|
+
const style = this.selStyle;
|
|
2081
|
+
const left = parseInt(style.left);
|
|
2082
|
+
const top = parseInt(style.top);
|
|
2083
|
+
const width = parseInt(style.width);
|
|
2084
|
+
const height = parseInt(style.height);
|
|
2085
|
+
// 检查四个控制点
|
|
2086
|
+
if (Math.abs(x - left) < controlPointSize && Math.abs(y - top) < controlPointSize) {
|
|
2087
|
+
this.resizeHandle = 'top-left';
|
|
2088
|
+
} else if (Math.abs(x - (left + width)) < controlPointSize && Math.abs(y - top) < controlPointSize) {
|
|
2089
|
+
this.resizeHandle = 'top-right';
|
|
2090
|
+
} else if (Math.abs(x - left) < controlPointSize && Math.abs(y - (top + height)) < controlPointSize) {
|
|
2091
|
+
this.resizeHandle = 'bottom-left';
|
|
2092
|
+
} else if (Math.abs(x - (left + width)) < controlPointSize && Math.abs(y - (top + height)) < controlPointSize) {
|
|
2093
|
+
this.resizeHandle = 'bottom-right';
|
|
2094
|
+
} else {
|
|
2095
|
+
this.resizeHandle = null;
|
|
2096
|
+
}
|
|
2097
|
+
} else {
|
|
2098
|
+
this.resizeHandle = null;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
move(e) {
|
|
2103
|
+
let touches = e.touches,
|
|
2104
|
+
touch0 = touches[0],
|
|
2105
|
+
touch1 = touches[1];
|
|
2106
|
+
if (touch1) {
|
|
2107
|
+
let x = touch1.x - touch0.x,
|
|
2108
|
+
y = touch1.y - touch0.y,
|
|
2109
|
+
fgDistance = Math.sqrt(x * x + y * y),
|
|
2110
|
+
scaleSize = 0.005 * (fgDistance - this.fgDistance),
|
|
2111
|
+
beScaleSize = this.scaleSize + scaleSize;
|
|
2112
|
+
do {
|
|
2113
|
+
if (!this.letScale) break;
|
|
2114
|
+
if (beScaleSize < this.mnScale) break;
|
|
2115
|
+
if (beScaleSize > this.mxScale) break;
|
|
2116
|
+
if (this.isin) {
|
|
2117
|
+
let imgWidth = this.useWidth * beScaleSize,
|
|
2118
|
+
imgHeight = this.useHeight * beScaleSize,
|
|
2119
|
+
rx0 = this.posWidth + this.useWidth / 2,
|
|
2120
|
+
ry0 = this.posHeight + this.useHeight / 2,
|
|
2121
|
+
l = rx0 - imgWidth / 2,
|
|
2122
|
+
t = ry0 - imgHeight / 2,
|
|
2123
|
+
r = l + imgWidth,
|
|
2124
|
+
b = t + imgHeight,
|
|
2125
|
+
left = parseInt(this.selStyle.left),
|
|
2126
|
+
top = parseInt(this.selStyle.top),
|
|
2127
|
+
width = parseInt(this.selStyle.width),
|
|
2128
|
+
height = parseInt(this.selStyle.height);
|
|
2129
|
+
if (left < l || left + width > r || top < t || top + height > b) break;
|
|
2130
|
+
this.scaleWidth = (this.useWidth - imgWidth) / 2;
|
|
2131
|
+
this.scaleHeight = (this.useHeight - imgHeight) / 2;
|
|
2132
|
+
}
|
|
2133
|
+
this.scaleSize = beScaleSize;
|
|
2134
|
+
} while (0);
|
|
2135
|
+
this.fgDistance = fgDistance;
|
|
2136
|
+
if (touch1.x !== touch0.x && this.letRotate) {
|
|
2137
|
+
x = (this.touch1.y - this.touch0.y) / (this.touch1.x - this.touch0.x);
|
|
2138
|
+
y = (touch1.y - touch0.y) / (touch1.x - touch0.x);
|
|
2139
|
+
this.rotateDeg += (Math.atan((y - x) / (1 + x * y)) * 180) / Math.PI;
|
|
2140
|
+
this.touch0 = touch0;
|
|
2141
|
+
this.touch1 = touch1;
|
|
2142
|
+
}
|
|
2143
|
+
this.drawImage();
|
|
2144
|
+
} else if (this.touch0) {
|
|
2145
|
+
// 只有在允许调整大小时才处理裁剪框大小调整
|
|
2146
|
+
if (this.resizeHandle && this.letChangeSize) {
|
|
2147
|
+
const style = { ...this.selStyle };
|
|
2148
|
+
const left = parseInt(style.left);
|
|
2149
|
+
const top = parseInt(style.top);
|
|
2150
|
+
const width = parseInt(style.width);
|
|
2151
|
+
const height = parseInt(style.height);
|
|
2152
|
+
const minWidth = 50;
|
|
2153
|
+
const minHeight = 50;
|
|
2154
|
+
switch (this.resizeHandle) {
|
|
2155
|
+
case 'top-left':
|
|
2156
|
+
style.left = touch0.x + 'px';
|
|
2157
|
+
style.top = touch0.y + 'px';
|
|
2158
|
+
style.width = left + width - touch0.x + 'px';
|
|
2159
|
+
style.height = top + height - touch0.y + 'px';
|
|
2160
|
+
break;
|
|
2161
|
+
case 'top-right':
|
|
2162
|
+
style.top = touch0.y + 'px';
|
|
2163
|
+
style.width = touch0.x - left + 'px';
|
|
2164
|
+
style.height = top + height - touch0.y + 'px';
|
|
2165
|
+
break;
|
|
2166
|
+
case 'bottom-left':
|
|
2167
|
+
style.left = touch0.x + 'px';
|
|
2168
|
+
style.width = left + width - touch0.x + 'px';
|
|
2169
|
+
style.height = touch0.y - top + 'px';
|
|
2170
|
+
break;
|
|
2171
|
+
case 'bottom-right':
|
|
2172
|
+
style.width = touch0.x - left + 'px';
|
|
2173
|
+
style.height = touch0.y - top + 'px';
|
|
2174
|
+
break;
|
|
2175
|
+
}
|
|
2176
|
+
// 确保最小尺寸
|
|
2177
|
+
if (parseInt(style.width) >= minWidth && parseInt(style.height) >= minHeight) {
|
|
2178
|
+
// 确保裁剪框不超出屏幕边界
|
|
2179
|
+
if (
|
|
2180
|
+
parseInt(style.left) >= 0 &&
|
|
2181
|
+
parseInt(style.top) >= 0 &&
|
|
2182
|
+
parseInt(style.left) + parseInt(style.width) <= this.windowWidth &&
|
|
2183
|
+
parseInt(style.top) + parseInt(style.height) <= this.windowHeight - tabHeight
|
|
2184
|
+
) {
|
|
2185
|
+
this.selStyle = style;
|
|
2186
|
+
// 重新绘制操作层
|
|
2187
|
+
this.drawInit();
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
} else {
|
|
2191
|
+
// 原有的移动图片逻辑
|
|
2192
|
+
let x = touch0.x - this.touch0.x,
|
|
2193
|
+
y = touch0.y - this.touch0.y,
|
|
2194
|
+
beX = this.posWidth + x,
|
|
2195
|
+
beY = this.posHeight + y;
|
|
2196
|
+
if (this.isin) {
|
|
2197
|
+
let imgWidth = this.useWidth * this.scaleSize,
|
|
2198
|
+
imgHeight = this.useHeight * this.scaleSize,
|
|
2199
|
+
rx0 = beX + this.useWidth / 2,
|
|
2200
|
+
ry0 = beY + this.useHeight / 2,
|
|
2201
|
+
l = rx0 - imgWidth / 2,
|
|
2202
|
+
t = ry0 - imgHeight / 2,
|
|
2203
|
+
r = l + imgWidth,
|
|
2204
|
+
b = t + imgHeight,
|
|
2205
|
+
left = parseInt(this.selStyle.left),
|
|
2206
|
+
top = parseInt(this.selStyle.top),
|
|
2207
|
+
width = parseInt(this.selStyle.width),
|
|
2208
|
+
height = parseInt(this.selStyle.height);
|
|
2209
|
+
if (!this.lckWidth && Math.abs(x) < 100) {
|
|
2210
|
+
if (left >= l && left + width <= r) {
|
|
2211
|
+
this.posWidth = beX;
|
|
2212
|
+
} else if (left < l) {
|
|
2213
|
+
this.posWidth = left - this.scaleWidth;
|
|
2214
|
+
} else if (left + width > r) {
|
|
2215
|
+
this.posWidth = left - (imgWidth - width) - this.scaleWidth;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
if (!this.lckHeight && Math.abs(y) < 100) {
|
|
2219
|
+
if (top >= t && top + height <= b) {
|
|
2220
|
+
this.posHeight = beY;
|
|
2221
|
+
} else if (top < t) {
|
|
2222
|
+
this.posHeight = top - this.scaleHeight;
|
|
2223
|
+
} else if (top + height > b) {
|
|
2224
|
+
this.posHeight = top - (imgHeight - height) - this.scaleHeight;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
} else {
|
|
2228
|
+
if (Math.abs(x) < 100 && !this.lckWidth) this.posWidth = beX;
|
|
2229
|
+
if (Math.abs(y) < 100 && !this.lckHeight) this.posHeight = beY;
|
|
2230
|
+
}
|
|
2231
|
+
this.touch0 = touch0;
|
|
2232
|
+
this.drawImage();
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
end(e) {
|
|
2237
|
+
let touches = e.touches,
|
|
2238
|
+
touch0 = touches && touches[0],
|
|
2239
|
+
touch1 = touches && touches[1];
|
|
2240
|
+
if (touch0) {
|
|
2241
|
+
this.touch0 = touch0;
|
|
2242
|
+
} else {
|
|
2243
|
+
this.touch0 = null;
|
|
2244
|
+
this.touch1 = null;
|
|
2245
|
+
this.resizeHandle = null; // 重置调整手柄
|
|
2246
|
+
}
|
|
2247
|
+
},
|
|
2248
|
+
getImgData() {
|
|
2249
|
+
return new Promise((resolve, reject) => {
|
|
2250
|
+
let prvX = this.prvX,
|
|
2251
|
+
prvY = this.prvY,
|
|
2252
|
+
prvWidth = this.prvWidth,
|
|
2253
|
+
prvHeight = this.prvHeight;
|
|
2254
|
+
// #ifdef APP-PLUS||H5
|
|
2255
|
+
prvX *= this.pixelRatio;
|
|
2256
|
+
prvY *= this.pixelRatio;
|
|
2257
|
+
prvWidth *= this.pixelRatio;
|
|
2258
|
+
prvHeight *= this.pixelRatio;
|
|
2259
|
+
// #endif
|
|
2260
|
+
uni.canvasGetImageData(
|
|
2261
|
+
{
|
|
2262
|
+
canvasId: 'prv-canvas-' + this.instanceId,
|
|
2263
|
+
x: prvX,
|
|
2264
|
+
y: prvY,
|
|
2265
|
+
width: prvWidth,
|
|
2266
|
+
height: prvHeight,
|
|
2267
|
+
success(res) {
|
|
2268
|
+
resolve(res.data);
|
|
2269
|
+
},
|
|
2270
|
+
fail(err) {
|
|
2271
|
+
reject(err);
|
|
2272
|
+
}
|
|
2273
|
+
},
|
|
2274
|
+
this
|
|
2275
|
+
);
|
|
2276
|
+
});
|
|
2277
|
+
},
|
|
2278
|
+
async colorChange(e) {
|
|
2279
|
+
let tm_now = Date.now();
|
|
2280
|
+
if (tm_now - this.prvTm < 100) return;
|
|
2281
|
+
this.prvTm = tm_now;
|
|
2282
|
+
uni.showLoading({ mask: true });
|
|
2283
|
+
if (!this.prvImgData) {
|
|
2284
|
+
if (
|
|
2285
|
+
!(this.prvImgData = await this.getImgData().catch((res) => {
|
|
2286
|
+
uni.showToast({
|
|
2287
|
+
title: 'error_read',
|
|
2288
|
+
duration: 2000
|
|
2289
|
+
});
|
|
2290
|
+
}))
|
|
2291
|
+
)
|
|
2292
|
+
return;
|
|
2293
|
+
this.target = new Uint8ClampedArray(this.prvImgData.length);
|
|
2294
|
+
}
|
|
2295
|
+
let data = this.prvImgData,
|
|
2296
|
+
target = this.target,
|
|
2297
|
+
i = e.detail.value,
|
|
2298
|
+
r,
|
|
2299
|
+
g,
|
|
2300
|
+
b,
|
|
2301
|
+
a,
|
|
2302
|
+
h,
|
|
2303
|
+
s,
|
|
2304
|
+
l,
|
|
2305
|
+
d,
|
|
2306
|
+
p,
|
|
2307
|
+
q,
|
|
2308
|
+
t,
|
|
2309
|
+
min,
|
|
2310
|
+
max,
|
|
2311
|
+
hK,
|
|
2312
|
+
tR,
|
|
2313
|
+
tG,
|
|
2314
|
+
tB;
|
|
2315
|
+
if (i === 0) {
|
|
2316
|
+
target = data;
|
|
2317
|
+
} else {
|
|
2318
|
+
i = (i + 100) / 200;
|
|
2319
|
+
if (i < 0.005) i = 0;
|
|
2320
|
+
if (i > 0.995) i = 1;
|
|
2321
|
+
for (let n = data.length - 1; n >= 0; n -= 4) {
|
|
2322
|
+
r = data[n - 3] / 255;
|
|
2323
|
+
g = data[n - 2] / 255;
|
|
2324
|
+
b = data[n - 1] / 255;
|
|
2325
|
+
max = Math.max(r, g, b);
|
|
2326
|
+
min = Math.min(r, g, b);
|
|
2327
|
+
d = max - min;
|
|
2328
|
+
if (max === min) {
|
|
2329
|
+
h = 0;
|
|
2330
|
+
} else if (max === r && g >= b) {
|
|
2331
|
+
h = 60 * ((g - b) / d);
|
|
2332
|
+
} else if (max === r && g < b) {
|
|
2333
|
+
h = 60 * ((g - b) / d) + 360;
|
|
2334
|
+
} else if (max === g) {
|
|
2335
|
+
h = 60 * ((b - r) / d) + 120;
|
|
2336
|
+
} else if (max === b) {
|
|
2337
|
+
h = 60 * ((r - g) / d) + 240;
|
|
2338
|
+
}
|
|
2339
|
+
l = (max + min) / 2;
|
|
2340
|
+
if (l === 0 || max === min) {
|
|
2341
|
+
s = 0;
|
|
2342
|
+
} else if (0 < l && l <= 0.5) {
|
|
2343
|
+
s = d / (2 * l);
|
|
2344
|
+
} else if (l > 0.5) {
|
|
2345
|
+
s = d / (2 - 2 * l);
|
|
2346
|
+
}
|
|
2347
|
+
data[n] && (a = data[n]);
|
|
2348
|
+
if (i < 0.5) {
|
|
2349
|
+
s = (s * i) / 0.5;
|
|
2350
|
+
} else if (i > 0.5) {
|
|
2351
|
+
s = 2 * s + 2 * i - (s * i) / 0.5 - 1;
|
|
2352
|
+
}
|
|
2353
|
+
if (s === 0) {
|
|
2354
|
+
r = g = b = Math.round(l * 255);
|
|
2355
|
+
} else {
|
|
2356
|
+
if (l < 0.5) {
|
|
2357
|
+
q = l * (1 + s);
|
|
2358
|
+
} else if (l >= 0.5) {
|
|
2359
|
+
q = l + s - l * s;
|
|
2360
|
+
}
|
|
2361
|
+
p = 2 * l - q;
|
|
2362
|
+
hK = h / 360;
|
|
2363
|
+
tR = hK + 1 / 3;
|
|
2364
|
+
tG = hK;
|
|
2365
|
+
tB = hK - 1 / 3;
|
|
2366
|
+
let correctRGB = (t) => {
|
|
2367
|
+
if (t < 0) {
|
|
2368
|
+
return t + 1.0;
|
|
2369
|
+
}
|
|
2370
|
+
if (t > 1) {
|
|
2371
|
+
return t - 1.0;
|
|
2372
|
+
}
|
|
2373
|
+
return t;
|
|
2374
|
+
};
|
|
2375
|
+
let createRGB = (t) => {
|
|
2376
|
+
if (t < 1 / 6) {
|
|
2377
|
+
return p + (q - p) * 6 * t;
|
|
2378
|
+
} else if (t >= 1 / 6 && t < 1 / 2) {
|
|
2379
|
+
return q;
|
|
2380
|
+
} else if (t >= 1 / 2 && t < 2 / 3) {
|
|
2381
|
+
return p + (q - p) * 6 * (2 / 3 - t);
|
|
2382
|
+
}
|
|
2383
|
+
return p;
|
|
2384
|
+
};
|
|
2385
|
+
r = tR = Math.round(createRGB(correctRGB(tR)) * 255);
|
|
2386
|
+
g = tG = Math.round(createRGB(correctRGB(tG)) * 255);
|
|
2387
|
+
b = tB = Math.round(createRGB(correctRGB(tB)) * 255);
|
|
2388
|
+
}
|
|
2389
|
+
a && (target[n] = a);
|
|
2390
|
+
target[n - 3] = r;
|
|
2391
|
+
target[n - 2] = g;
|
|
2392
|
+
target[n - 1] = b;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
let prvX = this.prvX,
|
|
2396
|
+
prvY = this.prvY,
|
|
2397
|
+
prvWidth = this.prvWidth,
|
|
2398
|
+
prvHeight = this.prvHeight;
|
|
2399
|
+
this.ctxCanvasPrv.setFillStyle('black');
|
|
2400
|
+
this.ctxCanvasPrv.fillRect(prvX, prvY, prvWidth, prvHeight);
|
|
2401
|
+
this.ctxCanvasPrv.draw(true);
|
|
2402
|
+
// #ifdef APP-PLUS||H5
|
|
2403
|
+
prvX *= this.pixelRatio;
|
|
2404
|
+
prvY *= this.pixelRatio;
|
|
2405
|
+
prvWidth *= this.pixelRatio;
|
|
2406
|
+
prvHeight *= this.pixelRatio;
|
|
2407
|
+
// #endif
|
|
2408
|
+
uni.canvasPutImageData(
|
|
2409
|
+
{
|
|
2410
|
+
canvasId: 'prv-canvas-' + this.instanceId,
|
|
2411
|
+
x: prvX,
|
|
2412
|
+
y: prvY,
|
|
2413
|
+
width: prvWidth,
|
|
2414
|
+
height: prvHeight,
|
|
2415
|
+
data: target,
|
|
2416
|
+
fail() {
|
|
2417
|
+
uni.showToast({
|
|
2418
|
+
title: 'error_put',
|
|
2419
|
+
duration: 2000
|
|
2420
|
+
});
|
|
2421
|
+
},
|
|
2422
|
+
complete() {
|
|
2423
|
+
uni.hideLoading();
|
|
2424
|
+
}
|
|
2425
|
+
},
|
|
2426
|
+
this
|
|
2427
|
+
);
|
|
2428
|
+
},
|
|
2429
|
+
btop(base64) {
|
|
2430
|
+
return new Promise(function (resolve, reject) {
|
|
2431
|
+
var arr = base64.split(','),
|
|
2432
|
+
mime = arr[0].match(/:(.*?);/)[1],
|
|
2433
|
+
bstr = atob(arr[1]),
|
|
2434
|
+
n = bstr.length,
|
|
2435
|
+
u8arr = new Uint8Array(n);
|
|
2436
|
+
while (n--) {
|
|
2437
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
2438
|
+
}
|
|
2439
|
+
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([u8arr], { type: mime })));
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
2444
|
+
</script>
|
|
2445
|
+
<style scoped>
|
|
2446
|
+
.u-cropper .my-canvas {
|
|
2447
|
+
display: flex;
|
|
2448
|
+
position: fixed !important;
|
|
2449
|
+
background: #000000;
|
|
2450
|
+
left: 0;
|
|
2451
|
+
z-index: 100000;
|
|
2452
|
+
width: 100%;
|
|
2453
|
+
}
|
|
2454
|
+
.u-cropper .my-avatar {
|
|
2455
|
+
width: 150rpx;
|
|
2456
|
+
height: 150rpx;
|
|
2457
|
+
border-radius: 100%;
|
|
2458
|
+
}
|
|
2459
|
+
.u-cropper .oper-canvas {
|
|
2460
|
+
display: flex;
|
|
2461
|
+
position: fixed !important;
|
|
2462
|
+
left: 0;
|
|
2463
|
+
z-index: 100001;
|
|
2464
|
+
width: 100%;
|
|
2465
|
+
}
|
|
2466
|
+
.u-cropper .prv-canvas {
|
|
2467
|
+
display: flex;
|
|
2468
|
+
position: fixed !important;
|
|
2469
|
+
background: #000000;
|
|
2470
|
+
left: 0;
|
|
2471
|
+
z-index: 200000;
|
|
2472
|
+
width: 100%;
|
|
2473
|
+
}
|
|
2474
|
+
.u-cropper .oper-wrapper {
|
|
2475
|
+
height: 50px;
|
|
2476
|
+
position: fixed !important;
|
|
2477
|
+
box-sizing: border-box;
|
|
2478
|
+
border: 1px solid #f1f1f1;
|
|
2479
|
+
background: #ffffff;
|
|
2480
|
+
width: 100%;
|
|
2481
|
+
left: 0;
|
|
2482
|
+
bottom: 0;
|
|
2483
|
+
z-index: 100009;
|
|
2484
|
+
flex-direction: row;
|
|
2485
|
+
}
|
|
2486
|
+
.u-cropper .oper {
|
|
2487
|
+
display: flex;
|
|
2488
|
+
flex-direction: column;
|
|
2489
|
+
justify-content: center;
|
|
2490
|
+
padding: 10rpx 20rpx;
|
|
2491
|
+
width: 100%;
|
|
2492
|
+
height: 100%;
|
|
2493
|
+
box-sizing: border-box;
|
|
2494
|
+
align-self: center;
|
|
2495
|
+
}
|
|
2496
|
+
.u-cropper .btn-wrapper {
|
|
2497
|
+
display: flex;
|
|
2498
|
+
flex-direction: row;
|
|
2499
|
+
/* #ifndef H5 */
|
|
2500
|
+
flex-grow: 1;
|
|
2501
|
+
/* #endif */
|
|
2502
|
+
/* #ifdef H5 */
|
|
2503
|
+
height: 50px;
|
|
2504
|
+
/* #endif */
|
|
2505
|
+
justify-content: space-between;
|
|
2506
|
+
}
|
|
2507
|
+
.u-cropper .btn-wrapper view {
|
|
2508
|
+
display: flex;
|
|
2509
|
+
align-items: center;
|
|
2510
|
+
justify-content: center;
|
|
2511
|
+
font-size: 16px;
|
|
2512
|
+
color: #333;
|
|
2513
|
+
border: 1px solid #f1f1f1;
|
|
2514
|
+
border-radius: 6%;
|
|
2515
|
+
}
|
|
2516
|
+
.u-cropper .hover {
|
|
2517
|
+
background: #f1f1f1;
|
|
2518
|
+
border-radius: 6%;
|
|
2519
|
+
}
|
|
2520
|
+
.u-cropper .clr-wrapper {
|
|
2521
|
+
display: flex;
|
|
2522
|
+
flex-direction: row;
|
|
2523
|
+
flex-grow: 1;
|
|
2524
|
+
}
|
|
2525
|
+
.u-cropper .clr-wrapper view {
|
|
2526
|
+
display: flex;
|
|
2527
|
+
align-items: center;
|
|
2528
|
+
justify-content: center;
|
|
2529
|
+
font-size: 16px;
|
|
2530
|
+
color: #333;
|
|
2531
|
+
border: 1px solid #f1f1f1;
|
|
2532
|
+
border-radius: 6%;
|
|
2533
|
+
}
|
|
2534
|
+
.u-cropper .my-slider {
|
|
2535
|
+
flex-grow: 1;
|
|
2536
|
+
}
|
|
2537
|
+
</style>
|