From d929afa146275fbf8425087e6a543a13e335ecc3 Mon Sep 17 00:00:00 2001
From: gukai <1522776404@qq.com>
Date: Mon, 24 Jun 2024 19:30:51 +0800
Subject: [PATCH] first commit
---
.gitignore | 8 +
App.vue | 183 +
README.md | 290 ++
api/index.js | 13 +
api/modules/common.js | 181 +
api/modules/coupon.js | 39 +
api/modules/diy.js | 16 +
api/modules/home.js | 63 +
api/modules/inPersonToPay.js | 34 +
api/modules/pay.js | 33 +
api/modules/payCoupon.js | 56 +
api/modules/reservation.js | 240 +
api/modules/transfer.js | 25 +
api/modules/user.js | 178 +
components/login/loginPage.vue | 263 ++
components/login/loginPopup.vue | 185 +
components/login/logins.vue | 213 +
components/the/the-tabbar.vue | 189 +
components/tools/isPhone/index.vue | 138 +
components/tools/tools-number-step/index.vue | 95 +
env.js | 15 +
index.html | 20 +
main.js | 52 +
manifest.json | 114 +
mixin/index.js | 162 +
module/test/test.vue | 8 +
package.json | 3 +
pages.json | 110 +
pages/index/index.vue | 79 +
pages/my/images/av.png | Bin 0 -> 7627 bytes
pages/my/images/xj.png | Bin 0 -> 3426 bytes
pages/my/my.vue | 772 +++
static/css/common.scss | 48 +
static/css/uni.scss | 78 +
static/h5/jweixin-sdk.js | 1 +
store/index.js | 31 +
.../inPersonToPay/compontents/coupons.vue | 455 ++
.../inPersonToPay/compontents/twoGoods.vue | 212 +
subPackages/inPersonToPay/index/index.vue | 662 +++
subPackages/inPersonToPay/result/index.vue | 174 +
subPackages/login/forgotPassword/index.vue | 38 +
subPackages/login/forgotPassword/nuxt.vue | 321 ++
subPackages/login/login/index.vue | 27 +
subPackages/login/reg/index.vue | 174 +
subPackages/login/reg/reset.vue | 161 +
uni.scss | 78 +
uni_modules/alipayjsapi/alipayjsapi.js | 4183 +++++++++++++++++
uni_modules/lime-painter/changelog.md | 203 +
.../components/common/relation.js | 150 +
.../l-painter-image/l-painter-image.vue | 28 +
.../l-painter-qrcode/l-painter-qrcode.vue | 27 +
.../l-painter-text/l-painter-text.vue | 29 +
.../l-painter-view/l-painter-view.vue | 30 +
.../components/l-painter/l-painter.vue | 445 ++
.../lime-painter/components/l-painter/nvue.js | 190 +
.../components/l-painter/painter.js | 1 +
.../components/l-painter/props.js | 56 +
.../components/l-painter/utils.js | 363 ++
.../components/lime-painter/lime-painter.vue | 224 +
.../lime-painter/hybrid/html/index.html | 119 +
.../lime-painter/hybrid/html/painter.js | 1 +
.../hybrid/html/uni.webview.1.5.3.js | 1 +
uni_modules/lime-painter/package.json | 92 +
uni_modules/lime-painter/parser.js | 388 ++
uni_modules/lime-painter/readme.md | 963 ++++
uni_modules/uni-popup/changelog.md | 70 +
.../components/uni-popup-dialog/keypress.js | 45 +
.../uni-popup-dialog/uni-popup-dialog.vue | 275 ++
.../uni-popup-message/uni-popup-message.vue | 143 +
.../uni-popup-share/uni-popup-share.vue | 187 +
.../components/uni-popup/i18n/en.json | 7 +
.../components/uni-popup/i18n/index.js | 8 +
.../components/uni-popup/i18n/zh-Hans.json | 7 +
.../components/uni-popup/i18n/zh-Hant.json | 7 +
.../components/uni-popup/keypress.js | 45 +
.../uni-popup/components/uni-popup/popup.js | 26 +
.../components/uni-popup/uni-popup.uvue | 90 +
.../components/uni-popup/uni-popup.vue | 473 ++
uni_modules/uni-popup/package.json | 87 +
uni_modules/uni-popup/readme.md | 17 +
uni_modules/uni-scss/changelog.md | 8 +
uni_modules/uni-scss/index.scss | 1 +
uni_modules/uni-scss/package.json | 82 +
uni_modules/uni-scss/readme.md | 4 +
uni_modules/uni-scss/styles/index.scss | 7 +
.../uni-scss/styles/setting/_border.scss | 3 +
.../uni-scss/styles/setting/_color.scss | 66 +
.../uni-scss/styles/setting/_radius.scss | 55 +
.../uni-scss/styles/setting/_space.scss | 56 +
.../uni-scss/styles/setting/_styles.scss | 167 +
.../uni-scss/styles/setting/_text.scss | 24 +
.../uni-scss/styles/setting/_variables.scss | 146 +
.../uni-scss/styles/tools/functions.scss | 19 +
uni_modules/uni-scss/theme.scss | 31 +
uni_modules/uni-scss/variables.scss | 62 +
uni_modules/uni-transition/changelog.md | 22 +
.../uni-transition/createAnimation.js | 131 +
.../uni-transition/uni-transition.vue | 286 ++
uni_modules/uni-transition/package.json | 84 +
uni_modules/uni-transition/readme.md | 11 +
uni_modules/uview-ui/LICENSE | 21 +
uni_modules/uview-ui/README.md | 66 +
uni_modules/uview-ui/changelog.md | 362 ++
.../uview-ui/components/u--form/u--form.vue | 78 +
.../uview-ui/components/u--image/u--image.vue | 47 +
.../uview-ui/components/u--input/u--input.vue | 73 +
.../uview-ui/components/u--text/u--text.vue | 44 +
.../components/u--textarea/u--textarea.vue | 48 +
.../components/u-action-sheet/props.js | 54 +
.../u-action-sheet/u-action-sheet.vue | 278 ++
.../uview-ui/components/u-album/props.js | 59 +
.../uview-ui/components/u-album/u-album.vue | 259 +
.../uview-ui/components/u-alert/props.js | 44 +
.../uview-ui/components/u-alert/u-alert.vue | 243 +
.../components/u-avatar-group/props.js | 52 +
.../u-avatar-group/u-avatar-group.vue | 103 +
.../uview-ui/components/u-avatar/props.js | 78 +
.../uview-ui/components/u-avatar/u-avatar.vue | 172 +
.../uview-ui/components/u-back-top/props.js | 54 +
.../components/u-back-top/u-back-top.vue | 129 +
.../uview-ui/components/u-badge/props.js | 72 +
.../uview-ui/components/u-badge/u-badge.vue | 171 +
.../uview-ui/components/u-button/nvue.scss | 46 +
.../uview-ui/components/u-button/props.js | 161 +
.../uview-ui/components/u-button/u-button.vue | 490 ++
.../uview-ui/components/u-button/vue.scss | 80 +
.../uview-ui/components/u-calendar/header.vue | 99 +
.../uview-ui/components/u-calendar/month.vue | 579 +++
.../uview-ui/components/u-calendar/props.js | 144 +
.../components/u-calendar/u-calendar.vue | 384 ++
.../uview-ui/components/u-calendar/util.js | 85 +
.../components/u-car-keyboard/props.js | 14 +
.../u-car-keyboard/u-car-keyboard.vue | 311 ++
.../uview-ui/components/u-cell-group/props.js | 14 +
.../components/u-cell-group/u-cell-group.vue | 61 +
.../uview-ui/components/u-cell/props.js | 110 +
.../uview-ui/components/u-cell/u-cell.vue | 229 +
.../components/u-checkbox-group/props.js | 82 +
.../u-checkbox-group/u-checkbox-group.vue | 103 +
.../uview-ui/components/u-checkbox/props.js | 69 +
.../components/u-checkbox/u-checkbox.vue | 344 ++
.../components/u-circle-progress/props.js | 8 +
.../u-circle-progress/u-circle-progress.vue | 198 +
.../uview-ui/components/u-code-input/props.js | 79 +
.../components/u-code-input/u-code-input.vue | 252 +
.../uview-ui/components/u-code/props.js | 34 +
.../uview-ui/components/u-code/u-code.vue | 129 +
.../uview-ui/components/u-col/props.js | 29 +
.../uview-ui/components/u-col/u-col.vue | 162 +
.../components/u-collapse-item/props.js | 59 +
.../u-collapse-item/u-collapse-item.vue | 225 +
.../uview-ui/components/u-collapse/props.js | 19 +
.../components/u-collapse/u-collapse.vue | 90 +
.../components/u-column-notice/props.js | 55 +
.../u-column-notice/u-column-notice.vue | 160 +
.../uview-ui/components/u-count-down/props.js | 24 +
.../components/u-count-down/u-count-down.vue | 163 +
.../uview-ui/components/u-count-down/utils.js | 62 +
.../uview-ui/components/u-count-to/props.js | 59 +
.../components/u-count-to/u-count-to.vue | 184 +
.../components/u-datetime-picker/props.js | 116 +
.../u-datetime-picker/u-datetime-picker.vue | 360 ++
.../uview-ui/components/u-divider/props.js | 44 +
.../components/u-divider/u-divider.vue | 116 +
.../components/u-dropdown-item/props.js | 36 +
.../u-dropdown-item/u-dropdown-item.vue | 127 +
.../uview-ui/components/u-dropdown/props.js | 65 +
.../components/u-dropdown/u-dropdown.vue | 127 +
.../uview-ui/components/u-empty/props.js | 59 +
.../uview-ui/components/u-empty/u-empty.vue | 128 +
.../uview-ui/components/u-form-item/props.js | 48 +
.../components/u-form-item/u-form-item.vue | 235 +
.../uview-ui/components/u-form/props.js | 45 +
.../uview-ui/components/u-form/u-form.vue | 214 +
.../uview-ui/components/u-gap/props.js | 24 +
.../uview-ui/components/u-gap/u-gap.vue | 38 +
.../uview-ui/components/u-grid-item/props.js | 14 +
.../components/u-grid-item/u-grid-item.vue | 209 +
.../uview-ui/components/u-grid/props.js | 19 +
.../uview-ui/components/u-grid/u-grid.vue | 97 +
.../uview-ui/components/u-icon/icons.js | 214 +
.../uview-ui/components/u-icon/props.js | 89 +
.../uview-ui/components/u-icon/u-icon.vue | 234 +
.../uview-ui/components/u-image/props.js | 84 +
.../uview-ui/components/u-image/u-image.vue | 232 +
.../components/u-index-anchor/props.js | 29 +
.../u-index-anchor/u-index-anchor.vue | 91 +
.../uview-ui/components/u-index-item/props.js | 5 +
.../components/u-index-item/u-index-item.vue | 87 +
.../uview-ui/components/u-index-list/props.js | 29 +
.../components/u-index-list/u-index-list.vue | 440 ++
.../uview-ui/components/u-input/props.js | 187 +
.../uview-ui/components/u-input/u-input.vue | 354 ++
.../uview-ui/components/u-keyboard/props.js | 84 +
.../components/u-keyboard/u-keyboard.vue | 164 +
.../components/u-line-progress/props.js | 28 +
.../u-line-progress/u-line-progress.vue | 144 +
.../uview-ui/components/u-line/props.js | 33 +
.../uview-ui/components/u-line/u-line.vue | 62 +
.../uview-ui/components/u-link/props.js | 39 +
.../uview-ui/components/u-link/u-link.vue | 83 +
.../uview-ui/components/u-list-item/props.js | 9 +
.../components/u-list-item/u-list-item.vue | 116 +
.../uview-ui/components/u-list/props.js | 76 +
.../uview-ui/components/u-list/u-list.vue | 157 +
.../components/u-loading-icon/props.js | 59 +
.../u-loading-icon/u-loading-icon.vue | 343 ++
.../components/u-loading-page/props.js | 49 +
.../u-loading-page/u-loading-page.vue | 115 +
.../uview-ui/components/u-loadmore/props.js | 94 +
.../components/u-loadmore/u-loadmore.vue | 150 +
.../uview-ui/components/u-modal/props.js | 84 +
.../uview-ui/components/u-modal/u-modal.vue | 227 +
.../uview-ui/components/u-navbar/props.js | 84 +
.../uview-ui/components/u-navbar/u-navbar.vue | 186 +
.../uview-ui/components/u-no-network/props.js | 19 +
.../components/u-no-network/u-no-network.vue | 220 +
.../uview-ui/components/u-notice-bar/props.js | 70 +
.../components/u-notice-bar/u-notice-bar.vue | 101 +
.../uview-ui/components/u-notify/props.js | 49 +
.../uview-ui/components/u-notify/u-notify.vue | 211 +
.../uview-ui/components/u-number-box/props.js | 109 +
.../components/u-number-box/u-number-box.vue | 416 ++
.../components/u-number-keyboard/props.js | 19 +
.../u-number-keyboard/u-number-keyboard.vue | 196 +
.../uview-ui/components/u-overlay/props.js | 24 +
.../components/u-overlay/u-overlay.vue | 68 +
.../uview-ui/components/u-parse/node/node.vue | 499 ++
.../uview-ui/components/u-parse/parser.js | 1075 +++++
.../uview-ui/components/u-parse/props.js | 45 +
.../uview-ui/components/u-parse/u-parse.vue | 366 ++
.../components/u-picker-column/props.js | 5 +
.../u-picker-column/u-picker-column.vue | 27 +
.../uview-ui/components/u-picker/props.js | 79 +
.../uview-ui/components/u-picker/u-picker.vue | 254 +
.../uview-ui/components/u-popup/props.js | 79 +
.../uview-ui/components/u-popup/u-popup.vue | 304 ++
.../components/u-radio-group/props.js | 85 +
.../u-radio-group/u-radio-group.vue | 108 +
.../uview-ui/components/u-radio/props.js | 64 +
.../uview-ui/components/u-radio/u-radio.vue | 339 ++
.../uview-ui/components/u-rate/props.js | 69 +
.../uview-ui/components/u-rate/u-rate.vue | 306 ++
.../uview-ui/components/u-read-more/props.js | 61 +
.../components/u-read-more/u-read-more.vue | 157 +
.../uview-ui/components/u-row-notice/props.js | 39 +
.../components/u-row-notice/u-row-notice.vue | 330 ++
.../uview-ui/components/u-row/props.js | 19 +
.../uview-ui/components/u-row/u-row.vue | 93 +
.../components/u-safe-bottom/props.js | 5 +
.../u-safe-bottom/u-safe-bottom.vue | 56 +
.../uview-ui/components/u-scroll-list/nvue.js | 28 +
.../components/u-scroll-list/other.js | 0
.../components/u-scroll-list/props.js | 34 +
.../components/u-scroll-list/scrollWxs.wxs | 50 +
.../u-scroll-list/u-scroll-list.vue | 224 +
.../uview-ui/components/u-search/props.js | 118 +
.../uview-ui/components/u-search/u-search.vue | 303 ++
.../uview-ui/components/u-skeleton/props.js | 59 +
.../components/u-skeleton/u-skeleton.vue | 244 +
.../uview-ui/components/u-slider/mpother.js | 113 +
.../uview-ui/components/u-slider/mpwxs.js | 42 +
.../uview-ui/components/u-slider/mpwxs.wxs | 121 +
.../components/u-slider/nvue - 副本.js | 180 +
.../uview-ui/components/u-slider/nvue.js | 193 +
.../uview-ui/components/u-slider/props.js | 54 +
.../uview-ui/components/u-slider/u-slider.vue | 55 +
.../uview-ui/components/u-status-bar/props.js | 8 +
.../components/u-status-bar/u-status-bar.vue | 46 +
.../uview-ui/components/u-steps-item/props.js | 24 +
.../components/u-steps-item/u-steps-item.vue | 316 ++
.../uview-ui/components/u-steps/props.js | 39 +
.../uview-ui/components/u-steps/u-steps.vue | 80 +
.../uview-ui/components/u-sticky/props.js | 40 +
.../uview-ui/components/u-sticky/u-sticky.vue | 212 +
.../uview-ui/components/u-subsection/props.js | 49 +
.../components/u-subsection/u-subsection.vue | 299 ++
.../u-swipe-action-item/index - backup.wxs | 256 +
.../components/u-swipe-action-item/index.wxs | 225 +
.../u-swipe-action-item/nvue - backup.js | 270 ++
.../components/u-swipe-action-item/nvue.js | 174 +
.../components/u-swipe-action-item/props.js | 41 +
.../u-swipe-action-item.vue | 190 +
.../components/u-swipe-action-item/wxs.js | 15 +
.../components/u-swipe-action/props.js | 9 +
.../u-swipe-action/u-swipe-action.vue | 67 +
.../components/u-swiper-indicator/props.js | 29 +
.../u-swiper-indicator/u-swiper-indicator.vue | 110 +
.../uview-ui/components/u-swiper/props.js | 125 +
.../uview-ui/components/u-swiper/u-swiper.vue | 255 +
.../uview-ui/components/u-switch/props.js | 54 +
.../uview-ui/components/u-switch/u-switch.vue | 177 +
.../components/u-tabbar-item/props.js | 35 +
.../u-tabbar-item/u-tabbar-item.vue | 142 +
.../uview-ui/components/u-tabbar/props.js | 44 +
.../uview-ui/components/u-tabbar/u-tabbar.vue | 141 +
.../uview-ui/components/u-table/props.js | 5 +
.../uview-ui/components/u-table/u-table.vue | 29 +
.../uview-ui/components/u-tabs-item/props.js | 5 +
.../components/u-tabs-item/u-tabs-item.vue | 29 +
.../uview-ui/components/u-tabs/props.js | 64 +
.../uview-ui/components/u-tabs/u-tabs.vue | 354 ++
.../uview-ui/components/u-tag/props.js | 84 +
.../uview-ui/components/u-tag/u-tag.vue | 358 ++
uni_modules/uview-ui/components/u-td/props.js | 5 +
uni_modules/uview-ui/components/u-td/u-td.vue | 31 +
.../uview-ui/components/u-text/props.js | 110 +
.../uview-ui/components/u-text/u-text.vue | 223 +
.../uview-ui/components/u-text/value.js | 85 +
.../uview-ui/components/u-textarea/props.js | 119 +
.../components/u-textarea/u-textarea.vue | 239 +
.../uview-ui/components/u-toast/u-toast.vue | 291 ++
.../uview-ui/components/u-toolbar/props.js | 34 +
.../components/u-toolbar/u-toolbar.vue | 102 +
.../components/u-tooltip/clipboard.min.js | 58 +
.../uview-ui/components/u-tooltip/props.js | 59 +
.../components/u-tooltip/u-tooltip.vue | 365 ++
uni_modules/uview-ui/components/u-tr/props.js | 5 +
uni_modules/uview-ui/components/u-tr/u-tr.vue | 31 +
.../components/u-transition/nvue.ani-map.js | 68 +
.../uview-ui/components/u-transition/props.js | 24 +
.../components/u-transition/transition.js | 157 +
.../components/u-transition/u-transition.vue | 92 +
.../u-transition/vue.ani-style.scss | 113 +
.../uview-ui/components/u-upload/mixin.js | 21 +
.../uview-ui/components/u-upload/props.js | 124 +
.../uview-ui/components/u-upload/u-upload.vue | 558 +++
.../uview-ui/components/u-upload/utils.js | 151 +
.../uview-ui/components/uview-ui/uview-ui.vue | 15 +
uni_modules/uview-ui/index.js | 79 +
uni_modules/uview-ui/index.scss | 23 +
uni_modules/uview-ui/libs/config/color.js | 17 +
uni_modules/uview-ui/libs/config/config.js | 34 +
uni_modules/uview-ui/libs/config/props.js | 190 +
.../uview-ui/libs/config/props/actionSheet.js | 25 +
.../uview-ui/libs/config/props/album.js | 25 +
.../uview-ui/libs/config/props/alert.js | 22 +
.../uview-ui/libs/config/props/avatar.js | 28 +
.../uview-ui/libs/config/props/avatarGroup.js | 23 +
.../uview-ui/libs/config/props/backtop.js | 27 +
.../uview-ui/libs/config/props/badge.js | 27 +
.../uview-ui/libs/config/props/button.js | 42 +
.../uview-ui/libs/config/props/calendar.js | 42 +
.../uview-ui/libs/config/props/carKeyboard.js | 15 +
.../uview-ui/libs/config/props/cell.js | 35 +
.../uview-ui/libs/config/props/cellGroup.js | 17 +
.../uview-ui/libs/config/props/checkbox.js | 27 +
.../libs/config/props/checkboxGroup.js | 29 +
.../libs/config/props/circleProgress.js | 15 +
.../uview-ui/libs/config/props/code.js | 21 +
.../uview-ui/libs/config/props/codeInput.js | 29 +
uni_modules/uview-ui/libs/config/props/col.js | 19 +
.../uview-ui/libs/config/props/collapse.js | 17 +
.../libs/config/props/collapseItem.js | 25 +
.../libs/config/props/columnNotice.js | 24 +
.../uview-ui/libs/config/props/countDown.js | 18 +
.../uview-ui/libs/config/props/countTo.js | 25 +
.../libs/config/props/datetimePicker.js | 36 +
.../uview-ui/libs/config/props/divider.js | 23 +
.../uview-ui/libs/config/props/empty.js | 26 +
.../uview-ui/libs/config/props/form.js | 22 +
.../uview-ui/libs/config/props/formItem.js | 23 +
uni_modules/uview-ui/libs/config/props/gap.js | 19 +
.../uview-ui/libs/config/props/grid.js | 17 +
.../uview-ui/libs/config/props/gridItem.js | 16 +
.../uview-ui/libs/config/props/icon.js | 36 +
.../uview-ui/libs/config/props/image.js | 30 +
.../uview-ui/libs/config/props/indexAnchor.js | 19 +
.../uview-ui/libs/config/props/indexList.js | 19 +
.../uview-ui/libs/config/props/input.js | 48 +
.../uview-ui/libs/config/props/keyboard.js | 30 +
.../uview-ui/libs/config/props/line.js | 20 +
.../libs/config/props/lineProgress.js | 19 +
.../uview-ui/libs/config/props/link.js | 26 +
.../uview-ui/libs/config/props/list.js | 28 +
.../uview-ui/libs/config/props/listItem.js | 15 +
.../uview-ui/libs/config/props/loadingIcon.js | 30 +
.../uview-ui/libs/config/props/loadingPage.js | 23 +
.../uview-ui/libs/config/props/loadmore.js | 32 +
.../uview-ui/libs/config/props/modal.js | 30 +
.../uview-ui/libs/config/props/navbar.js | 32 +
.../uview-ui/libs/config/props/noNetwork.js | 18 +
.../uview-ui/libs/config/props/noticeBar.js | 27 +
.../uview-ui/libs/config/props/notify.js | 22 +
.../uview-ui/libs/config/props/numberBox.js | 35 +
.../libs/config/props/numberKeyboard.js | 17 +
.../uview-ui/libs/config/props/overlay.js | 18 +
.../uview-ui/libs/config/props/parse.js | 22 +
.../uview-ui/libs/config/props/picker.js | 29 +
.../uview-ui/libs/config/props/popup.js | 29 +
.../uview-ui/libs/config/props/radio.js | 27 +
.../uview-ui/libs/config/props/radioGroup.js | 30 +
.../uview-ui/libs/config/props/rate.js | 26 +
.../uview-ui/libs/config/props/readMore.js | 22 +
uni_modules/uview-ui/libs/config/props/row.js | 17 +
.../uview-ui/libs/config/props/rowNotice.js | 21 +
.../uview-ui/libs/config/props/scrollList.js | 20 +
.../uview-ui/libs/config/props/search.js | 37 +
.../uview-ui/libs/config/props/section.js | 24 +
.../uview-ui/libs/config/props/skeleton.js | 25 +
.../uview-ui/libs/config/props/slider.js | 25 +
.../uview-ui/libs/config/props/statusBar.js | 15 +
.../uview-ui/libs/config/props/steps.js | 21 +
.../uview-ui/libs/config/props/stepsItem.js | 18 +
.../uview-ui/libs/config/props/sticky.js | 20 +
.../uview-ui/libs/config/props/subsection.js | 23 +
.../uview-ui/libs/config/props/swipeAction.js | 15 +
.../libs/config/props/swipeActionItem.js | 21 +
.../uview-ui/libs/config/props/swiper.js | 39 +
.../libs/config/props/swipterIndicator.js | 19 +
.../uview-ui/libs/config/props/switch.js | 24 +
.../uview-ui/libs/config/props/tabbar.js | 22 +
.../uview-ui/libs/config/props/tabbarItem.js | 20 +
.../uview-ui/libs/config/props/tabs.js | 32 +
uni_modules/uview-ui/libs/config/props/tag.js | 29 +
.../uview-ui/libs/config/props/text.js | 38 +
.../uview-ui/libs/config/props/textarea.js | 36 +
.../uview-ui/libs/config/props/toast.js | 30 +
.../uview-ui/libs/config/props/toolbar.js | 21 +
.../uview-ui/libs/config/props/tooltip.js | 25 +
.../uview-ui/libs/config/props/transition.js | 18 +
.../uview-ui/libs/config/props/upload.js | 36 +
uni_modules/uview-ui/libs/config/zIndex.js | 20 +
uni_modules/uview-ui/libs/css/color.scss | 155 +
uni_modules/uview-ui/libs/css/common.scss | 97 +
uni_modules/uview-ui/libs/css/components.scss | 15 +
uni_modules/uview-ui/libs/css/flex.scss | 257 +
uni_modules/uview-ui/libs/css/h5.scss | 0
uni_modules/uview-ui/libs/css/mixin.scss | 8 +
uni_modules/uview-ui/libs/css/mp.scss | 0
uni_modules/uview-ui/libs/css/nvue.scss | 0
uni_modules/uview-ui/libs/css/vue.scss | 27 +
.../uview-ui/libs/function/colorGradient.js | 134 +
.../uview-ui/libs/function/debounce.js | 29 +
uni_modules/uview-ui/libs/function/digit.js | 167 +
uni_modules/uview-ui/libs/function/index.js | 731 +++
.../uview-ui/libs/function/platform.js | 75 +
uni_modules/uview-ui/libs/function/test.js | 288 ++
.../uview-ui/libs/function/throttle.js | 30 +
.../libs/luch-request/adapters/index.js | 97 +
.../luch-request/core/InterceptorManager.js | 50 +
.../libs/luch-request/core/Request.js | 198 +
.../libs/luch-request/core/buildFullPath.js | 20 +
.../libs/luch-request/core/defaults.js | 29 +
.../libs/luch-request/core/dispatchRequest.js | 3 +
.../libs/luch-request/core/mergeConfig.js | 103 +
.../uview-ui/libs/luch-request/core/settle.js | 16 +
.../libs/luch-request/helpers/buildURL.js | 69 +
.../libs/luch-request/helpers/combineURLs.js | 14 +
.../luch-request/helpers/isAbsoluteURL.js | 14 +
.../uview-ui/libs/luch-request/index.d.ts | 116 +
.../uview-ui/libs/luch-request/index.js | 3 +
.../uview-ui/libs/luch-request/utils.js | 131 +
.../uview-ui/libs/luch-request/utils/clone.js | 264 ++
uni_modules/uview-ui/libs/mixin/button.js | 13 +
uni_modules/uview-ui/libs/mixin/mixin.js | 160 +
uni_modules/uview-ui/libs/mixin/mpMixin.js | 8 +
uni_modules/uview-ui/libs/mixin/mpShare.js | 13 +
uni_modules/uview-ui/libs/mixin/openType.js | 25 +
uni_modules/uview-ui/libs/mixin/style.js | 228 +
uni_modules/uview-ui/libs/mixin/touch.js | 59 +
.../uview-ui/libs/util/async-validator.js | 1343 ++++++
uni_modules/uview-ui/libs/util/calendar.js | 546 +++
uni_modules/uview-ui/libs/util/dayjs.js | 308 ++
uni_modules/uview-ui/libs/util/emitter.js | 51 +
uni_modules/uview-ui/libs/util/route.js | 124 +
uni_modules/uview-ui/package.json | 84 +
uni_modules/uview-ui/theme.scss | 44 +
uni_modules/x-skeleton/changelog.md | 11 +
.../components/x-skeleton/x-skeleton copy.vue | 311 ++
.../x-skeleton/x-skeleton-configs.js | 147 +
.../components/x-skeleton/x-skeleton.vue | 311 ++
uni_modules/x-skeleton/package.json | 84 +
uni_modules/x-skeleton/readme.md | 93 +
uni_modules/y-tabs/changelog.md | 69 +
uni_modules/y-tabs/components/css/index.less | 505 ++
uni_modules/y-tabs/components/js/const.js | 196 +
.../y-tabs/components/js/touchMixin.js | 65 +
uni_modules/y-tabs/components/js/uitls.js | 173 +
uni_modules/y-tabs/components/js/utilMixin.js | 8 +
uni_modules/y-tabs/components/y-tab/y-tab.vue | 238 +
.../y-tabs/components/y-tabs/y-tabs.vue | 1256 +++++
uni_modules/y-tabs/package.json | 85 +
uni_modules/y-tabs/readme.md | 456 ++
utils/app.js | 122 +
utils/h5init.js | 49 +
utils/pay.js | 48 +
utils/regExp.js | 8 +
utils/request.js | 93 +
utils/utils.js | 189 +
utils/wxConfig.js | 67 +
vue.config.js | 15 +
492 files changed, 59548 insertions(+)
create mode 100644 .gitignore
create mode 100644 App.vue
create mode 100644 README.md
create mode 100644 api/index.js
create mode 100644 api/modules/common.js
create mode 100644 api/modules/coupon.js
create mode 100644 api/modules/diy.js
create mode 100644 api/modules/home.js
create mode 100644 api/modules/inPersonToPay.js
create mode 100644 api/modules/pay.js
create mode 100644 api/modules/payCoupon.js
create mode 100644 api/modules/reservation.js
create mode 100644 api/modules/transfer.js
create mode 100644 api/modules/user.js
create mode 100644 components/login/loginPage.vue
create mode 100644 components/login/loginPopup.vue
create mode 100644 components/login/logins.vue
create mode 100644 components/the/the-tabbar.vue
create mode 100644 components/tools/isPhone/index.vue
create mode 100644 components/tools/tools-number-step/index.vue
create mode 100644 env.js
create mode 100644 index.html
create mode 100644 main.js
create mode 100644 manifest.json
create mode 100644 mixin/index.js
create mode 100644 module/test/test.vue
create mode 100644 package.json
create mode 100644 pages.json
create mode 100644 pages/index/index.vue
create mode 100644 pages/my/images/av.png
create mode 100644 pages/my/images/xj.png
create mode 100644 pages/my/my.vue
create mode 100644 static/css/common.scss
create mode 100644 static/css/uni.scss
create mode 100644 static/h5/jweixin-sdk.js
create mode 100644 store/index.js
create mode 100644 subPackages/inPersonToPay/compontents/coupons.vue
create mode 100644 subPackages/inPersonToPay/compontents/twoGoods.vue
create mode 100644 subPackages/inPersonToPay/index/index.vue
create mode 100644 subPackages/inPersonToPay/result/index.vue
create mode 100644 subPackages/login/forgotPassword/index.vue
create mode 100644 subPackages/login/forgotPassword/nuxt.vue
create mode 100644 subPackages/login/login/index.vue
create mode 100644 subPackages/login/reg/index.vue
create mode 100644 subPackages/login/reg/reset.vue
create mode 100644 uni.scss
create mode 100644 uni_modules/alipayjsapi/alipayjsapi.js
create mode 100644 uni_modules/lime-painter/changelog.md
create mode 100644 uni_modules/lime-painter/components/common/relation.js
create mode 100644 uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue
create mode 100644 uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue
create mode 100644 uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue
create mode 100644 uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue
create mode 100644 uni_modules/lime-painter/components/l-painter/l-painter.vue
create mode 100644 uni_modules/lime-painter/components/l-painter/nvue.js
create mode 100644 uni_modules/lime-painter/components/l-painter/painter.js
create mode 100644 uni_modules/lime-painter/components/l-painter/props.js
create mode 100644 uni_modules/lime-painter/components/l-painter/utils.js
create mode 100644 uni_modules/lime-painter/components/lime-painter/lime-painter.vue
create mode 100644 uni_modules/lime-painter/hybrid/html/index.html
create mode 100644 uni_modules/lime-painter/hybrid/html/painter.js
create mode 100644 uni_modules/lime-painter/hybrid/html/uni.webview.1.5.3.js
create mode 100644 uni_modules/lime-painter/package.json
create mode 100644 uni_modules/lime-painter/parser.js
create mode 100644 uni_modules/lime-painter/readme.md
create mode 100644 uni_modules/uni-popup/changelog.md
create mode 100644 uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
create mode 100644 uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
create mode 100644 uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
create mode 100644 uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
create mode 100644 uni_modules/uni-popup/components/uni-popup/i18n/en.json
create mode 100644 uni_modules/uni-popup/components/uni-popup/i18n/index.js
create mode 100644 uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
create mode 100644 uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
create mode 100644 uni_modules/uni-popup/components/uni-popup/keypress.js
create mode 100644 uni_modules/uni-popup/components/uni-popup/popup.js
create mode 100644 uni_modules/uni-popup/components/uni-popup/uni-popup.uvue
create mode 100644 uni_modules/uni-popup/components/uni-popup/uni-popup.vue
create mode 100644 uni_modules/uni-popup/package.json
create mode 100644 uni_modules/uni-popup/readme.md
create mode 100644 uni_modules/uni-scss/changelog.md
create mode 100644 uni_modules/uni-scss/index.scss
create mode 100644 uni_modules/uni-scss/package.json
create mode 100644 uni_modules/uni-scss/readme.md
create mode 100644 uni_modules/uni-scss/styles/index.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_border.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_color.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_radius.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_space.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_styles.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_text.scss
create mode 100644 uni_modules/uni-scss/styles/setting/_variables.scss
create mode 100644 uni_modules/uni-scss/styles/tools/functions.scss
create mode 100644 uni_modules/uni-scss/theme.scss
create mode 100644 uni_modules/uni-scss/variables.scss
create mode 100644 uni_modules/uni-transition/changelog.md
create mode 100644 uni_modules/uni-transition/components/uni-transition/createAnimation.js
create mode 100644 uni_modules/uni-transition/components/uni-transition/uni-transition.vue
create mode 100644 uni_modules/uni-transition/package.json
create mode 100644 uni_modules/uni-transition/readme.md
create mode 100644 uni_modules/uview-ui/LICENSE
create mode 100644 uni_modules/uview-ui/README.md
create mode 100644 uni_modules/uview-ui/changelog.md
create mode 100644 uni_modules/uview-ui/components/u--form/u--form.vue
create mode 100644 uni_modules/uview-ui/components/u--image/u--image.vue
create mode 100644 uni_modules/uview-ui/components/u--input/u--input.vue
create mode 100644 uni_modules/uview-ui/components/u--text/u--text.vue
create mode 100644 uni_modules/uview-ui/components/u--textarea/u--textarea.vue
create mode 100644 uni_modules/uview-ui/components/u-action-sheet/props.js
create mode 100644 uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue
create mode 100644 uni_modules/uview-ui/components/u-album/props.js
create mode 100644 uni_modules/uview-ui/components/u-album/u-album.vue
create mode 100644 uni_modules/uview-ui/components/u-alert/props.js
create mode 100644 uni_modules/uview-ui/components/u-alert/u-alert.vue
create mode 100644 uni_modules/uview-ui/components/u-avatar-group/props.js
create mode 100644 uni_modules/uview-ui/components/u-avatar-group/u-avatar-group.vue
create mode 100644 uni_modules/uview-ui/components/u-avatar/props.js
create mode 100644 uni_modules/uview-ui/components/u-avatar/u-avatar.vue
create mode 100644 uni_modules/uview-ui/components/u-back-top/props.js
create mode 100644 uni_modules/uview-ui/components/u-back-top/u-back-top.vue
create mode 100644 uni_modules/uview-ui/components/u-badge/props.js
create mode 100644 uni_modules/uview-ui/components/u-badge/u-badge.vue
create mode 100644 uni_modules/uview-ui/components/u-button/nvue.scss
create mode 100644 uni_modules/uview-ui/components/u-button/props.js
create mode 100644 uni_modules/uview-ui/components/u-button/u-button.vue
create mode 100644 uni_modules/uview-ui/components/u-button/vue.scss
create mode 100644 uni_modules/uview-ui/components/u-calendar/header.vue
create mode 100644 uni_modules/uview-ui/components/u-calendar/month.vue
create mode 100644 uni_modules/uview-ui/components/u-calendar/props.js
create mode 100644 uni_modules/uview-ui/components/u-calendar/u-calendar.vue
create mode 100644 uni_modules/uview-ui/components/u-calendar/util.js
create mode 100644 uni_modules/uview-ui/components/u-car-keyboard/props.js
create mode 100644 uni_modules/uview-ui/components/u-car-keyboard/u-car-keyboard.vue
create mode 100644 uni_modules/uview-ui/components/u-cell-group/props.js
create mode 100644 uni_modules/uview-ui/components/u-cell-group/u-cell-group.vue
create mode 100644 uni_modules/uview-ui/components/u-cell/props.js
create mode 100644 uni_modules/uview-ui/components/u-cell/u-cell.vue
create mode 100644 uni_modules/uview-ui/components/u-checkbox-group/props.js
create mode 100644 uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue
create mode 100644 uni_modules/uview-ui/components/u-checkbox/props.js
create mode 100644 uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue
create mode 100644 uni_modules/uview-ui/components/u-circle-progress/props.js
create mode 100644 uni_modules/uview-ui/components/u-circle-progress/u-circle-progress.vue
create mode 100644 uni_modules/uview-ui/components/u-code-input/props.js
create mode 100644 uni_modules/uview-ui/components/u-code-input/u-code-input.vue
create mode 100644 uni_modules/uview-ui/components/u-code/props.js
create mode 100644 uni_modules/uview-ui/components/u-code/u-code.vue
create mode 100644 uni_modules/uview-ui/components/u-col/props.js
create mode 100644 uni_modules/uview-ui/components/u-col/u-col.vue
create mode 100644 uni_modules/uview-ui/components/u-collapse-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-collapse-item/u-collapse-item.vue
create mode 100644 uni_modules/uview-ui/components/u-collapse/props.js
create mode 100644 uni_modules/uview-ui/components/u-collapse/u-collapse.vue
create mode 100644 uni_modules/uview-ui/components/u-column-notice/props.js
create mode 100644 uni_modules/uview-ui/components/u-column-notice/u-column-notice.vue
create mode 100644 uni_modules/uview-ui/components/u-count-down/props.js
create mode 100644 uni_modules/uview-ui/components/u-count-down/u-count-down.vue
create mode 100644 uni_modules/uview-ui/components/u-count-down/utils.js
create mode 100644 uni_modules/uview-ui/components/u-count-to/props.js
create mode 100644 uni_modules/uview-ui/components/u-count-to/u-count-to.vue
create mode 100644 uni_modules/uview-ui/components/u-datetime-picker/props.js
create mode 100644 uni_modules/uview-ui/components/u-datetime-picker/u-datetime-picker.vue
create mode 100644 uni_modules/uview-ui/components/u-divider/props.js
create mode 100644 uni_modules/uview-ui/components/u-divider/u-divider.vue
create mode 100644 uni_modules/uview-ui/components/u-dropdown-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-dropdown-item/u-dropdown-item.vue
create mode 100644 uni_modules/uview-ui/components/u-dropdown/props.js
create mode 100644 uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue
create mode 100644 uni_modules/uview-ui/components/u-empty/props.js
create mode 100644 uni_modules/uview-ui/components/u-empty/u-empty.vue
create mode 100644 uni_modules/uview-ui/components/u-form-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-form-item/u-form-item.vue
create mode 100644 uni_modules/uview-ui/components/u-form/props.js
create mode 100644 uni_modules/uview-ui/components/u-form/u-form.vue
create mode 100644 uni_modules/uview-ui/components/u-gap/props.js
create mode 100644 uni_modules/uview-ui/components/u-gap/u-gap.vue
create mode 100644 uni_modules/uview-ui/components/u-grid-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-grid-item/u-grid-item.vue
create mode 100644 uni_modules/uview-ui/components/u-grid/props.js
create mode 100644 uni_modules/uview-ui/components/u-grid/u-grid.vue
create mode 100644 uni_modules/uview-ui/components/u-icon/icons.js
create mode 100644 uni_modules/uview-ui/components/u-icon/props.js
create mode 100644 uni_modules/uview-ui/components/u-icon/u-icon.vue
create mode 100644 uni_modules/uview-ui/components/u-image/props.js
create mode 100644 uni_modules/uview-ui/components/u-image/u-image.vue
create mode 100644 uni_modules/uview-ui/components/u-index-anchor/props.js
create mode 100644 uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue
create mode 100644 uni_modules/uview-ui/components/u-index-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-index-item/u-index-item.vue
create mode 100644 uni_modules/uview-ui/components/u-index-list/props.js
create mode 100644 uni_modules/uview-ui/components/u-index-list/u-index-list.vue
create mode 100644 uni_modules/uview-ui/components/u-input/props.js
create mode 100644 uni_modules/uview-ui/components/u-input/u-input.vue
create mode 100644 uni_modules/uview-ui/components/u-keyboard/props.js
create mode 100644 uni_modules/uview-ui/components/u-keyboard/u-keyboard.vue
create mode 100644 uni_modules/uview-ui/components/u-line-progress/props.js
create mode 100644 uni_modules/uview-ui/components/u-line-progress/u-line-progress.vue
create mode 100644 uni_modules/uview-ui/components/u-line/props.js
create mode 100644 uni_modules/uview-ui/components/u-line/u-line.vue
create mode 100644 uni_modules/uview-ui/components/u-link/props.js
create mode 100644 uni_modules/uview-ui/components/u-link/u-link.vue
create mode 100644 uni_modules/uview-ui/components/u-list-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-list-item/u-list-item.vue
create mode 100644 uni_modules/uview-ui/components/u-list/props.js
create mode 100644 uni_modules/uview-ui/components/u-list/u-list.vue
create mode 100644 uni_modules/uview-ui/components/u-loading-icon/props.js
create mode 100644 uni_modules/uview-ui/components/u-loading-icon/u-loading-icon.vue
create mode 100644 uni_modules/uview-ui/components/u-loading-page/props.js
create mode 100644 uni_modules/uview-ui/components/u-loading-page/u-loading-page.vue
create mode 100644 uni_modules/uview-ui/components/u-loadmore/props.js
create mode 100644 uni_modules/uview-ui/components/u-loadmore/u-loadmore.vue
create mode 100644 uni_modules/uview-ui/components/u-modal/props.js
create mode 100644 uni_modules/uview-ui/components/u-modal/u-modal.vue
create mode 100644 uni_modules/uview-ui/components/u-navbar/props.js
create mode 100644 uni_modules/uview-ui/components/u-navbar/u-navbar.vue
create mode 100644 uni_modules/uview-ui/components/u-no-network/props.js
create mode 100644 uni_modules/uview-ui/components/u-no-network/u-no-network.vue
create mode 100644 uni_modules/uview-ui/components/u-notice-bar/props.js
create mode 100644 uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue
create mode 100644 uni_modules/uview-ui/components/u-notify/props.js
create mode 100644 uni_modules/uview-ui/components/u-notify/u-notify.vue
create mode 100644 uni_modules/uview-ui/components/u-number-box/props.js
create mode 100644 uni_modules/uview-ui/components/u-number-box/u-number-box.vue
create mode 100644 uni_modules/uview-ui/components/u-number-keyboard/props.js
create mode 100644 uni_modules/uview-ui/components/u-number-keyboard/u-number-keyboard.vue
create mode 100644 uni_modules/uview-ui/components/u-overlay/props.js
create mode 100644 uni_modules/uview-ui/components/u-overlay/u-overlay.vue
create mode 100644 uni_modules/uview-ui/components/u-parse/node/node.vue
create mode 100644 uni_modules/uview-ui/components/u-parse/parser.js
create mode 100644 uni_modules/uview-ui/components/u-parse/props.js
create mode 100644 uni_modules/uview-ui/components/u-parse/u-parse.vue
create mode 100644 uni_modules/uview-ui/components/u-picker-column/props.js
create mode 100644 uni_modules/uview-ui/components/u-picker-column/u-picker-column.vue
create mode 100644 uni_modules/uview-ui/components/u-picker/props.js
create mode 100644 uni_modules/uview-ui/components/u-picker/u-picker.vue
create mode 100644 uni_modules/uview-ui/components/u-popup/props.js
create mode 100644 uni_modules/uview-ui/components/u-popup/u-popup.vue
create mode 100644 uni_modules/uview-ui/components/u-radio-group/props.js
create mode 100644 uni_modules/uview-ui/components/u-radio-group/u-radio-group.vue
create mode 100644 uni_modules/uview-ui/components/u-radio/props.js
create mode 100644 uni_modules/uview-ui/components/u-radio/u-radio.vue
create mode 100644 uni_modules/uview-ui/components/u-rate/props.js
create mode 100644 uni_modules/uview-ui/components/u-rate/u-rate.vue
create mode 100644 uni_modules/uview-ui/components/u-read-more/props.js
create mode 100644 uni_modules/uview-ui/components/u-read-more/u-read-more.vue
create mode 100644 uni_modules/uview-ui/components/u-row-notice/props.js
create mode 100644 uni_modules/uview-ui/components/u-row-notice/u-row-notice.vue
create mode 100644 uni_modules/uview-ui/components/u-row/props.js
create mode 100644 uni_modules/uview-ui/components/u-row/u-row.vue
create mode 100644 uni_modules/uview-ui/components/u-safe-bottom/props.js
create mode 100644 uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue
create mode 100644 uni_modules/uview-ui/components/u-scroll-list/nvue.js
create mode 100644 uni_modules/uview-ui/components/u-scroll-list/other.js
create mode 100644 uni_modules/uview-ui/components/u-scroll-list/props.js
create mode 100644 uni_modules/uview-ui/components/u-scroll-list/scrollWxs.wxs
create mode 100644 uni_modules/uview-ui/components/u-scroll-list/u-scroll-list.vue
create mode 100644 uni_modules/uview-ui/components/u-search/props.js
create mode 100644 uni_modules/uview-ui/components/u-search/u-search.vue
create mode 100644 uni_modules/uview-ui/components/u-skeleton/props.js
create mode 100644 uni_modules/uview-ui/components/u-skeleton/u-skeleton.vue
create mode 100644 uni_modules/uview-ui/components/u-slider/mpother.js
create mode 100644 uni_modules/uview-ui/components/u-slider/mpwxs.js
create mode 100644 uni_modules/uview-ui/components/u-slider/mpwxs.wxs
create mode 100644 uni_modules/uview-ui/components/u-slider/nvue - 副本.js
create mode 100644 uni_modules/uview-ui/components/u-slider/nvue.js
create mode 100644 uni_modules/uview-ui/components/u-slider/props.js
create mode 100644 uni_modules/uview-ui/components/u-slider/u-slider.vue
create mode 100644 uni_modules/uview-ui/components/u-status-bar/props.js
create mode 100644 uni_modules/uview-ui/components/u-status-bar/u-status-bar.vue
create mode 100644 uni_modules/uview-ui/components/u-steps-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-steps-item/u-steps-item.vue
create mode 100644 uni_modules/uview-ui/components/u-steps/props.js
create mode 100644 uni_modules/uview-ui/components/u-steps/u-steps.vue
create mode 100644 uni_modules/uview-ui/components/u-sticky/props.js
create mode 100644 uni_modules/uview-ui/components/u-sticky/u-sticky.vue
create mode 100644 uni_modules/uview-ui/components/u-subsection/props.js
create mode 100644 uni_modules/uview-ui/components/u-subsection/u-subsection.vue
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/index.wxs
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/nvue - backup.js
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/nvue.js
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/u-swipe-action-item.vue
create mode 100644 uni_modules/uview-ui/components/u-swipe-action-item/wxs.js
create mode 100644 uni_modules/uview-ui/components/u-swipe-action/props.js
create mode 100644 uni_modules/uview-ui/components/u-swipe-action/u-swipe-action.vue
create mode 100644 uni_modules/uview-ui/components/u-swiper-indicator/props.js
create mode 100644 uni_modules/uview-ui/components/u-swiper-indicator/u-swiper-indicator.vue
create mode 100644 uni_modules/uview-ui/components/u-swiper/props.js
create mode 100644 uni_modules/uview-ui/components/u-swiper/u-swiper.vue
create mode 100644 uni_modules/uview-ui/components/u-switch/props.js
create mode 100644 uni_modules/uview-ui/components/u-switch/u-switch.vue
create mode 100644 uni_modules/uview-ui/components/u-tabbar-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-tabbar-item/u-tabbar-item.vue
create mode 100644 uni_modules/uview-ui/components/u-tabbar/props.js
create mode 100644 uni_modules/uview-ui/components/u-tabbar/u-tabbar.vue
create mode 100644 uni_modules/uview-ui/components/u-table/props.js
create mode 100644 uni_modules/uview-ui/components/u-table/u-table.vue
create mode 100644 uni_modules/uview-ui/components/u-tabs-item/props.js
create mode 100644 uni_modules/uview-ui/components/u-tabs-item/u-tabs-item.vue
create mode 100644 uni_modules/uview-ui/components/u-tabs/props.js
create mode 100644 uni_modules/uview-ui/components/u-tabs/u-tabs.vue
create mode 100644 uni_modules/uview-ui/components/u-tag/props.js
create mode 100644 uni_modules/uview-ui/components/u-tag/u-tag.vue
create mode 100644 uni_modules/uview-ui/components/u-td/props.js
create mode 100644 uni_modules/uview-ui/components/u-td/u-td.vue
create mode 100644 uni_modules/uview-ui/components/u-text/props.js
create mode 100644 uni_modules/uview-ui/components/u-text/u-text.vue
create mode 100644 uni_modules/uview-ui/components/u-text/value.js
create mode 100644 uni_modules/uview-ui/components/u-textarea/props.js
create mode 100644 uni_modules/uview-ui/components/u-textarea/u-textarea.vue
create mode 100644 uni_modules/uview-ui/components/u-toast/u-toast.vue
create mode 100644 uni_modules/uview-ui/components/u-toolbar/props.js
create mode 100644 uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue
create mode 100644 uni_modules/uview-ui/components/u-tooltip/clipboard.min.js
create mode 100644 uni_modules/uview-ui/components/u-tooltip/props.js
create mode 100644 uni_modules/uview-ui/components/u-tooltip/u-tooltip.vue
create mode 100644 uni_modules/uview-ui/components/u-tr/props.js
create mode 100644 uni_modules/uview-ui/components/u-tr/u-tr.vue
create mode 100644 uni_modules/uview-ui/components/u-transition/nvue.ani-map.js
create mode 100644 uni_modules/uview-ui/components/u-transition/props.js
create mode 100644 uni_modules/uview-ui/components/u-transition/transition.js
create mode 100644 uni_modules/uview-ui/components/u-transition/u-transition.vue
create mode 100644 uni_modules/uview-ui/components/u-transition/vue.ani-style.scss
create mode 100644 uni_modules/uview-ui/components/u-upload/mixin.js
create mode 100644 uni_modules/uview-ui/components/u-upload/props.js
create mode 100644 uni_modules/uview-ui/components/u-upload/u-upload.vue
create mode 100644 uni_modules/uview-ui/components/u-upload/utils.js
create mode 100644 uni_modules/uview-ui/components/uview-ui/uview-ui.vue
create mode 100644 uni_modules/uview-ui/index.js
create mode 100644 uni_modules/uview-ui/index.scss
create mode 100644 uni_modules/uview-ui/libs/config/color.js
create mode 100644 uni_modules/uview-ui/libs/config/config.js
create mode 100644 uni_modules/uview-ui/libs/config/props.js
create mode 100644 uni_modules/uview-ui/libs/config/props/actionSheet.js
create mode 100644 uni_modules/uview-ui/libs/config/props/album.js
create mode 100644 uni_modules/uview-ui/libs/config/props/alert.js
create mode 100644 uni_modules/uview-ui/libs/config/props/avatar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/avatarGroup.js
create mode 100644 uni_modules/uview-ui/libs/config/props/backtop.js
create mode 100644 uni_modules/uview-ui/libs/config/props/badge.js
create mode 100644 uni_modules/uview-ui/libs/config/props/button.js
create mode 100644 uni_modules/uview-ui/libs/config/props/calendar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/carKeyboard.js
create mode 100644 uni_modules/uview-ui/libs/config/props/cell.js
create mode 100644 uni_modules/uview-ui/libs/config/props/cellGroup.js
create mode 100644 uni_modules/uview-ui/libs/config/props/checkbox.js
create mode 100644 uni_modules/uview-ui/libs/config/props/checkboxGroup.js
create mode 100644 uni_modules/uview-ui/libs/config/props/circleProgress.js
create mode 100644 uni_modules/uview-ui/libs/config/props/code.js
create mode 100644 uni_modules/uview-ui/libs/config/props/codeInput.js
create mode 100644 uni_modules/uview-ui/libs/config/props/col.js
create mode 100644 uni_modules/uview-ui/libs/config/props/collapse.js
create mode 100644 uni_modules/uview-ui/libs/config/props/collapseItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/columnNotice.js
create mode 100644 uni_modules/uview-ui/libs/config/props/countDown.js
create mode 100644 uni_modules/uview-ui/libs/config/props/countTo.js
create mode 100644 uni_modules/uview-ui/libs/config/props/datetimePicker.js
create mode 100644 uni_modules/uview-ui/libs/config/props/divider.js
create mode 100644 uni_modules/uview-ui/libs/config/props/empty.js
create mode 100644 uni_modules/uview-ui/libs/config/props/form.js
create mode 100644 uni_modules/uview-ui/libs/config/props/formItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/gap.js
create mode 100644 uni_modules/uview-ui/libs/config/props/grid.js
create mode 100644 uni_modules/uview-ui/libs/config/props/gridItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/icon.js
create mode 100644 uni_modules/uview-ui/libs/config/props/image.js
create mode 100644 uni_modules/uview-ui/libs/config/props/indexAnchor.js
create mode 100644 uni_modules/uview-ui/libs/config/props/indexList.js
create mode 100644 uni_modules/uview-ui/libs/config/props/input.js
create mode 100644 uni_modules/uview-ui/libs/config/props/keyboard.js
create mode 100644 uni_modules/uview-ui/libs/config/props/line.js
create mode 100644 uni_modules/uview-ui/libs/config/props/lineProgress.js
create mode 100644 uni_modules/uview-ui/libs/config/props/link.js
create mode 100644 uni_modules/uview-ui/libs/config/props/list.js
create mode 100644 uni_modules/uview-ui/libs/config/props/listItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/loadingIcon.js
create mode 100644 uni_modules/uview-ui/libs/config/props/loadingPage.js
create mode 100644 uni_modules/uview-ui/libs/config/props/loadmore.js
create mode 100644 uni_modules/uview-ui/libs/config/props/modal.js
create mode 100644 uni_modules/uview-ui/libs/config/props/navbar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/noNetwork.js
create mode 100644 uni_modules/uview-ui/libs/config/props/noticeBar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/notify.js
create mode 100644 uni_modules/uview-ui/libs/config/props/numberBox.js
create mode 100644 uni_modules/uview-ui/libs/config/props/numberKeyboard.js
create mode 100644 uni_modules/uview-ui/libs/config/props/overlay.js
create mode 100644 uni_modules/uview-ui/libs/config/props/parse.js
create mode 100644 uni_modules/uview-ui/libs/config/props/picker.js
create mode 100644 uni_modules/uview-ui/libs/config/props/popup.js
create mode 100644 uni_modules/uview-ui/libs/config/props/radio.js
create mode 100644 uni_modules/uview-ui/libs/config/props/radioGroup.js
create mode 100644 uni_modules/uview-ui/libs/config/props/rate.js
create mode 100644 uni_modules/uview-ui/libs/config/props/readMore.js
create mode 100644 uni_modules/uview-ui/libs/config/props/row.js
create mode 100644 uni_modules/uview-ui/libs/config/props/rowNotice.js
create mode 100644 uni_modules/uview-ui/libs/config/props/scrollList.js
create mode 100644 uni_modules/uview-ui/libs/config/props/search.js
create mode 100644 uni_modules/uview-ui/libs/config/props/section.js
create mode 100644 uni_modules/uview-ui/libs/config/props/skeleton.js
create mode 100644 uni_modules/uview-ui/libs/config/props/slider.js
create mode 100644 uni_modules/uview-ui/libs/config/props/statusBar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/steps.js
create mode 100644 uni_modules/uview-ui/libs/config/props/stepsItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/sticky.js
create mode 100644 uni_modules/uview-ui/libs/config/props/subsection.js
create mode 100644 uni_modules/uview-ui/libs/config/props/swipeAction.js
create mode 100644 uni_modules/uview-ui/libs/config/props/swipeActionItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/swiper.js
create mode 100644 uni_modules/uview-ui/libs/config/props/swipterIndicator.js
create mode 100644 uni_modules/uview-ui/libs/config/props/switch.js
create mode 100644 uni_modules/uview-ui/libs/config/props/tabbar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/tabbarItem.js
create mode 100644 uni_modules/uview-ui/libs/config/props/tabs.js
create mode 100644 uni_modules/uview-ui/libs/config/props/tag.js
create mode 100644 uni_modules/uview-ui/libs/config/props/text.js
create mode 100644 uni_modules/uview-ui/libs/config/props/textarea.js
create mode 100644 uni_modules/uview-ui/libs/config/props/toast.js
create mode 100644 uni_modules/uview-ui/libs/config/props/toolbar.js
create mode 100644 uni_modules/uview-ui/libs/config/props/tooltip.js
create mode 100644 uni_modules/uview-ui/libs/config/props/transition.js
create mode 100644 uni_modules/uview-ui/libs/config/props/upload.js
create mode 100644 uni_modules/uview-ui/libs/config/zIndex.js
create mode 100644 uni_modules/uview-ui/libs/css/color.scss
create mode 100644 uni_modules/uview-ui/libs/css/common.scss
create mode 100644 uni_modules/uview-ui/libs/css/components.scss
create mode 100644 uni_modules/uview-ui/libs/css/flex.scss
create mode 100644 uni_modules/uview-ui/libs/css/h5.scss
create mode 100644 uni_modules/uview-ui/libs/css/mixin.scss
create mode 100644 uni_modules/uview-ui/libs/css/mp.scss
create mode 100644 uni_modules/uview-ui/libs/css/nvue.scss
create mode 100644 uni_modules/uview-ui/libs/css/vue.scss
create mode 100644 uni_modules/uview-ui/libs/function/colorGradient.js
create mode 100644 uni_modules/uview-ui/libs/function/debounce.js
create mode 100644 uni_modules/uview-ui/libs/function/digit.js
create mode 100644 uni_modules/uview-ui/libs/function/index.js
create mode 100644 uni_modules/uview-ui/libs/function/platform.js
create mode 100644 uni_modules/uview-ui/libs/function/test.js
create mode 100644 uni_modules/uview-ui/libs/function/throttle.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/adapters/index.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/InterceptorManager.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/Request.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/buildFullPath.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/defaults.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/dispatchRequest.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/core/settle.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/helpers/buildURL.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/helpers/combineURLs.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/helpers/isAbsoluteURL.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/index.d.ts
create mode 100644 uni_modules/uview-ui/libs/luch-request/index.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/utils.js
create mode 100644 uni_modules/uview-ui/libs/luch-request/utils/clone.js
create mode 100644 uni_modules/uview-ui/libs/mixin/button.js
create mode 100644 uni_modules/uview-ui/libs/mixin/mixin.js
create mode 100644 uni_modules/uview-ui/libs/mixin/mpMixin.js
create mode 100644 uni_modules/uview-ui/libs/mixin/mpShare.js
create mode 100644 uni_modules/uview-ui/libs/mixin/openType.js
create mode 100644 uni_modules/uview-ui/libs/mixin/style.js
create mode 100644 uni_modules/uview-ui/libs/mixin/touch.js
create mode 100644 uni_modules/uview-ui/libs/util/async-validator.js
create mode 100644 uni_modules/uview-ui/libs/util/calendar.js
create mode 100644 uni_modules/uview-ui/libs/util/dayjs.js
create mode 100644 uni_modules/uview-ui/libs/util/emitter.js
create mode 100644 uni_modules/uview-ui/libs/util/route.js
create mode 100644 uni_modules/uview-ui/package.json
create mode 100644 uni_modules/uview-ui/theme.scss
create mode 100644 uni_modules/x-skeleton/changelog.md
create mode 100644 uni_modules/x-skeleton/components/x-skeleton/x-skeleton copy.vue
create mode 100644 uni_modules/x-skeleton/components/x-skeleton/x-skeleton-configs.js
create mode 100644 uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue
create mode 100644 uni_modules/x-skeleton/package.json
create mode 100644 uni_modules/x-skeleton/readme.md
create mode 100644 uni_modules/y-tabs/changelog.md
create mode 100644 uni_modules/y-tabs/components/css/index.less
create mode 100644 uni_modules/y-tabs/components/js/const.js
create mode 100644 uni_modules/y-tabs/components/js/touchMixin.js
create mode 100644 uni_modules/y-tabs/components/js/uitls.js
create mode 100644 uni_modules/y-tabs/components/js/utilMixin.js
create mode 100644 uni_modules/y-tabs/components/y-tab/y-tab.vue
create mode 100644 uni_modules/y-tabs/components/y-tabs/y-tabs.vue
create mode 100644 uni_modules/y-tabs/package.json
create mode 100644 uni_modules/y-tabs/readme.md
create mode 100644 utils/app.js
create mode 100644 utils/h5init.js
create mode 100644 utils/pay.js
create mode 100644 utils/regExp.js
create mode 100644 utils/request.js
create mode 100644 utils/utils.js
create mode 100644 utils/wxConfig.js
create mode 100644 vue.config.js
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c0ca8a4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+.project
+.hbuilderx
+.mini-ide
+.idea
+unpackage
+.DS_Store
+
+node_modules
\ No newline at end of file
diff --git a/App.vue b/App.vue
new file mode 100644
index 0000000..48bb5c7
--- /dev/null
+++ b/App.vue
@@ -0,0 +1,183 @@
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..be7edeb
--- /dev/null
+++ b/README.md
@@ -0,0 +1,290 @@
+## 支付宝交易组件
+
+```
+第一步 订购插件和关联小程序
+在接入插件之前,确保本账号或者本账号所属的主账号已经订购了本插件,并且已经关联到需要使用本插件的小程序。点击这里查看详细步骤。
+
+第二步 配置主体小程序项目
+在小程序开发工具里面打开需要使用插件的项目,然后配置app.json:
+
+{
+ "plugins": {
+ "tradePay": {
+ "version": "*",// 目前只支持设置 * 拉取当前上架最新版本
+ "provider": "2021003178648009"
+ }
+ }
+}
+注意:请修改上述文件的“tradePay”名称以和使用插件的代码匹配。
+
+
+uniapp:manifest.json插件配置
+
+"mp-alipay" : {
+ "usingComponents" : true,
+ "appid" : "2021003197674866",
+ "plugins": {
+ "tradePay": {
+ "version": "*", // 目前只支持设置 * ,自动选择版本
+ "provider": "2021003178648009" // 组件Id,固定不变
+ },
+ }
+},
+
+uniapp:pages.json,subPackages/order/preview/index,style内增加
+"usingComponents": {
+ "discount-card": "plugin://tradePay/discountCard"
+}
+
+```
+
+
+## 商品详情组件插件
+
+```
+第一步 订购插件和关联小程序
+在接入插件之前,确保本账号或者本账号所属的主账号已经订购了本插件,并且已经关联到需要使用本插件的小程序。点击这里查看详细步骤。
+
+第二步 配置主体小程序项目
+在小程序开发工具里面打开需要使用插件的项目,然后配置app.json:
+
+{
+ "plugins": {
+ "theGoodsEdit": {
+ "version": "*",// 目前只支持设置 * 拉取当前上架最新版本
+ "provider": "2021003177653028"
+ }
+ }
+}
+注意:请修改上述文件的“tradePay”名称以和使用插件的代码匹配。
+
+
+uniapp:manifest.json插件配置
+
+"mp-alipay" : {
+ "usingComponents" : true,
+ "appid" : "2021003197674866",
+ "plugins": {
+ "theGoodsEdit": {
+ "lazy",
+ "genericsImplementation": {
+ "goodsDetail": {
+ "detail-images": "/components/detail-images/detail-images" // 商家可以通过修改 /components/detail-images/detail-images 路径,传入自定义组件
+ }
+ },
+ "version": "*", // 目前只支持设置 * ,自动选择版本
+ "provider": "2021003177653028" // 组件Id,固定不变
+ },
+ }
+},
+
+```
+
+
+## 本地生活商品插件集成sop
+## [文档](https://www.yuque.com/wenheng-68qmd/dthzsu/cnfuc25naz42q61v?singleDoc#OaKw6)
+
+```
+第一步 订购插件和关联小程序
+在接入插件之前,确保本账号或者本账号所属的主账号已经订购了本插件,并且已经关联到需要使用本插件的小程序。点击这里查看详细步骤。
+
+第二步 配置主体小程序项目
+在小程序开发工具里面打开需要使用插件的项目,然后配置app.json:
+
+{
+ "plugins": {
+ "groupPurchaseoucherPlugin": {
+ "version": "*", // 目前只支持设置 * ,自动选择版本
+ "provider": "2021003190661263"
+ },
+ }
+}
+
+
+```
+
+
+## 商家会员卡
+## [文档](https://opendocs.alipay.com/open/03sx7u?pathHash=1abe9241&ref=api)
+
+```
+第一步 订购插件和关联小程序
+在接入插件之前,确保本账号或者本账号所属的主账号已经订购了本插件,并且已经关联到需要使用本插件的小程序。点击这里查看详细步骤。
+
+第二步 配置主体小程序项目
+在小程序开发工具里面打开需要使用插件的项目,然后配置app.json:
+
+{
+ "plugins": {
+ "alipassToolKit": { // 请自定义插件名称
+ "version": "*", // 目前只支持设置 * 拉取当前上架最新版本
+ "provider": "2021001107697072" // 固定值,插件 ID
+ }
+ }
+}
+
+装修组件 pages\index\components\TemplateAliMembershipCard.vue
+
+```
+
+## 支付宝支付券(领券组件)插件
+
+```
+文档:https://opendocs.alipay.com/open/08b369?pathHash=6f84a8c0
+微信公众平台,小程序设置,增加支付券插件
+
+{
+ "plugins": {
+ "couponPlugin": {
+ "version": "*", // 拉取当前上架最新版本
+ "provider": "2021002172680015" // 领券组件插件 ID,固定值
+ }
+ }
+}
+注意:请修改上述文件的“couponPlugin”名称以和使用插件的代码匹配。
+
+
+uniapp:manifest.json插件配置
+
+"plugins": {
+ "couponPlugin": {
+ "version": "*", // 拉取当前上架最新版本
+ "provider": "2021002172680015" // 领券组件插件 ID,固定值
+ }
+}
+
+uniapp:pages.json,subPackages/pay_coupon/info,style内增加
+
+"usingComponents": {
+ "get-coupon": "plugin://couponPlugin/get-coupon"
+}
+
+```
+
+
+
+## 微信支付券插件 - 暂时废弃
+
+```
+文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_3_1.shtml
+微信公众平台,小程序设置,增加支付券插件
+
+{
+ "plugins": {
+ "sendCoupon": {
+ "version": "1.4.13",
+ "provider": "wxf3f436ba9bd4be7b"
+ }
+ }
+}
+注意:请修改上述文件的“sendCoupon”名称以和使用插件的代码匹配。
+
+
+uniapp:manifest.json插件配置
+
+"mp-weixin" : {
+ "plugins": {
+ "sendCoupon": {
+ "version": "1.5.0",
+ "provider": "wxf3f436ba9bd4be7b"
+ }
+ }
+},
+
+uniapp:pages.json,subPackages/pay_coupon/index,style内增加
+"usingComponents": {
+ "send-coupon": "plugin://sendCoupon/send-coupon"
+}
+
+```
+
+
+## 微信 H5 支付
+## [参考文档 前端的微信支付(JSSDK支付)](https://juejin.cn/post/6844903954355060749#heading-11)
+## [参考文档 JSAPI调起支付API](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml)
+## [参考文档 JS-SDK说明文档](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#59)
+
+// utils/wxConfig.js
+
+// 异步获取配置数据
+```JavaScript
+async function getConfigData(url) {
+ // 接口获取签名
+ return {
+ app_id: "", // 必填,公众号的唯一标识
+ timestamp: "", // 必填,生成签名的时间戳
+ noncestr: "", // 必填,生成签名的随机串
+ signature: "", // 必填,签名
+ };
+}
+```
+ - subPackages/pay/index.vue
+ - 发起一个微信支付请求 `subPackages\pay\index.vue`
+```JavaScript
+wechatPayNow() // h5 调用
+```
+
+
+```JavaScript
+//发送给朋友
+onShareAppMessage(res) {
+ if (res.from === 'button') { // 来自页面内分享按钮
+ console.log(res.target)
+ }
+ return {
+ title: this.control.titleStyle.name,
+ path: `/pages/index/index?distributor_id=${this.getUser("id")}`,
+ summary: ""
+ }
+},
+```
+
+ · 首页 (分销ID) `/pages/index/index`
+
+ · 商品详情 (商品ID、分销ID) `/subPackages/goods/goods/index`
+
+ · 限时折扣 (折扣ID) `/subPackages/goods/goods/index`
+
+ · 满减优惠 (折扣ID) `/subPackages/goods/goods/index`
+
+ · 套餐列表 `/subPackages/goods/goods/packageList`
+
+ · 套餐详情 (套餐ID、mch_id) `/subPackages/goods/goods/package`
+
+ · 分类页面 `/pages/cat/cat`
+
+ · 附近门店 `/subPackages/stores/index/index`
+
+ · 门店详情 (门店ID) `/subPackages/stores/storesDetails/index`
+
+ · 门店列表 (点餐) `/subPackages/stores/restaurantList/index`
+
+ · 点餐页面 (门店ID) `/subPackages/takeaway/index`
+
+ · 文章列表 `/subPackages/article/index`
+
+ · 文章详情 `/subPackages/article/detail`
+
+ · 领券中心 `/subPackages/coupons/index/index`
+
+ · DIY页面 (页面ID) `/subPackages/diy/index`
+
+ · 预约中心 `/subPackages/reservation/index`
+
+ · 预约服务 `/subPackages/reservation/serve`
+
+ · 预约技师列表 (ID) `/subPackages/reservation/technician`
+
+ · 预约技师 (ID) `/subPackages/reservation/technicianDetali`
diff --git a/api/index.js b/api/index.js
new file mode 100644
index 0000000..5764708
--- /dev/null
+++ b/api/index.js
@@ -0,0 +1,13 @@
+const files = require.context("./modules", false, /\.js$/),
+ api = {};
+
+files.keys().forEach((key) => {
+ const last = key.indexOf(".js"),
+ name = key.slice(2, last);
+
+ api[name] = files(key).default;
+});
+
+export default {
+ ...api,
+};
diff --git a/api/modules/common.js b/api/modules/common.js
new file mode 100644
index 0000000..3faebb0
--- /dev/null
+++ b/api/modules/common.js
@@ -0,0 +1,181 @@
+import {
+ request,
+ uploadFile
+} from "@/utils/request";
+
+export default {
+ /**
+ * 获取图片库
+ */
+ getImages(data) {
+ return request({
+ url: "/common/getImages",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取商城信息
+ */
+ getStoreDetail(data) {
+ return request({
+ url: "/store_setting/store_detail",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 上传图片视频
+ */
+ upload(data) {
+ return uploadFile(data);
+ },
+ orderCount(data) {
+ return request({
+ url: "/common/order-count",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取商品标签信息
+ */
+ getLable(data) {
+ return request({
+ url: "/common/lable",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * isPhone
+ */
+ isPhone(data) {
+ return request({
+ url: "/user/is-phone",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+
+ /**
+ * 优惠券列表
+ */
+ list(data) {
+ return request({
+ url: "/common/List",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+
+ /**
+ * 获取门店列表
+ * @param {String} longitude 经度
+ * @param {String} latitude 纬度
+ */
+ getShopList(data) {
+ return request({
+ url: "/common/getShopList",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 折扣信息
+ */
+ discountsItem(data) {
+ return request({
+ url: "/common/discountsItem",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 折扣信息
+ */
+ packageItem(data) {
+ return request({
+ url: "/common/packageItem",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 折扣信息
+ */
+ redutionItem(data) {
+ return request({
+ url: "/common/redutionItem",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+
+ /**
+ * wechatH5
+ */
+ wechatH5(data) {
+ return request({
+ url: "/common/wechatH5",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ aliH5(data) {
+ return request({
+ url: "/common/aliH5",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ sendSms(data) {
+ return request({
+ url: "/common/sendSms",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ getFlashMch(data) {
+ return request({
+ url: "/common/FlashListMch",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ getFlashGoods(data) {
+ return request({
+ url: "/common/FlashListGoods",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+};
\ No newline at end of file
diff --git a/api/modules/coupon.js b/api/modules/coupon.js
new file mode 100644
index 0000000..e10a1a5
--- /dev/null
+++ b/api/modules/coupon.js
@@ -0,0 +1,39 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 优惠券列表
+ */
+ list(data) {
+ return request({
+ url: "/Coupon/List",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 领取优惠券
+ */
+ getCoupon(data) {
+ return request({
+ url: "/Coupon/GetCoupon",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 已领取优惠券
+ */
+ getUserCoupon(data) {
+ return request({
+ url: "/Coupon/GetUserCoupon",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+};
diff --git a/api/modules/diy.js b/api/modules/diy.js
new file mode 100644
index 0000000..42ce637
--- /dev/null
+++ b/api/modules/diy.js
@@ -0,0 +1,16 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 获取diy模板
+ */
+ showTemplate(data) {
+ return request({
+ url: "/common/diy-show",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+};
diff --git a/api/modules/home.js b/api/modules/home.js
new file mode 100644
index 0000000..6baf76f
--- /dev/null
+++ b/api/modules/home.js
@@ -0,0 +1,63 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 获取轮播图设置
+ */
+ getStoreSlideShowSetting(data) {
+ return request({
+ url: "/storeSetting/getStoreSlideShowSetting",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取分类导航设置
+ */
+ getStoreNavSetting(data) {
+ return request({
+ url: "/storeSetting/GetStoreNavSetting",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取分类导航设置
+ */
+ getCateGoods(data) {
+ return request({
+ url: "/storeSetting/GetCateGoods",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取门店分类&商品
+ */
+ GetShopGoodsList(data) {
+ return request({
+ url: "/storeSetting/GetShopGoodsList",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取首页导航设置
+ */
+ goodsClassify(data) {
+ return request({
+ url: "/goods/classify",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+};
diff --git a/api/modules/inPersonToPay.js b/api/modules/inPersonToPay.js
new file mode 100644
index 0000000..7389311
--- /dev/null
+++ b/api/modules/inPersonToPay.js
@@ -0,0 +1,34 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 当面付页面
+ */
+ storeInfo(data) {
+ return request({
+ url: "/order/PaymentInfo",
+ method: "POST",
+ data,
+ });
+ },
+
+ /**
+ * 当面付页面
+ */
+ inpersonPaymentOrder(data) {
+ return request({
+ url: "/order/InpersonPaymentOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+
+ storeInfos(data) {
+ return request({
+ url: "/common/PaymentInfo",
+ method: "POST",
+ data,
+ });
+ },
+};
diff --git a/api/modules/pay.js b/api/modules/pay.js
new file mode 100644
index 0000000..73371c9
--- /dev/null
+++ b/api/modules/pay.js
@@ -0,0 +1,33 @@
+import {
+ request
+} from "@/utils/request";
+
+export default {
+ /**
+ * 收银台页面
+ * @param {String} order_no
+ */
+ CheckStand(data) {
+ return request({
+ url: "/PayOrder/CheckStand",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 发起支付
+ * @param {String} order_no
+ * @param {String} pay_type // 1商城订单 2秒杀订单 3拼团订单
+ * @param {String} order_type 1支付宝 2 微信 3余额 4货到付款
+ */
+ OrderPayment(data) {
+ return request({
+ url: "/PayOrder/OrderPayment",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+};
\ No newline at end of file
diff --git a/api/modules/payCoupon.js b/api/modules/payCoupon.js
new file mode 100644
index 0000000..6e1d4dd
--- /dev/null
+++ b/api/modules/payCoupon.js
@@ -0,0 +1,56 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 获取列表
+ * @param {String} shop_id
+ */
+ getData(data) {
+ return request({
+ url: "/user/getPayCoupon",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ sendCoupon(data) {
+ return request({
+ url: "/user/sendCoupon",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ getCat(data) {
+ return request({
+ url: "/common/payCouponCatList",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ payCouponList(data) {
+ return request({
+ url: "/common/payCouponList",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ getCoupon(data) {
+ return request({
+ url: "/common/getPayCoupon",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ getBanner(data) {
+ return request({
+ url: "/common/getPayCouponBanner",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+};
diff --git a/api/modules/reservation.js b/api/modules/reservation.js
new file mode 100644
index 0000000..a385fed
--- /dev/null
+++ b/api/modules/reservation.js
@@ -0,0 +1,240 @@
+import {
+ request
+} from "@/utils/request";
+export default {
+ classify(data) {
+ return request({
+ url: "/book/client/classify/index",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ goodsList(data) {
+ return request({
+ url: "/book/client/goods/index",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ goodsShow(data) {
+ return request({
+ url: "/book/client/goods/show",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ staffList(data) {
+ return request({
+ url: "/book/client/common/index",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ staffShow(data) {
+ return request({
+ url: "/book/client/common/show",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ staffEvaluateList(data) {
+ return request({
+ url: "/book/client/common/evaluateList",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ getBookOrder(data) {
+ return request({
+ url: "/book/client/orders/getBookOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ appointment_time(data) {
+ return request({
+ url: "/book/client/common/appointment_time",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+
+ PlaceOrder(data) {
+ return request({
+ url: "/book/client/orders/PlaceOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ appointmenTime(data) {
+ return request({
+ url: "/book/client/common/appointment_time",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ userOrderList(data) {
+ return request({
+ url: "/book/client/orders/orderList",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ OrderEvaluate(data) {
+ return request({
+ url: "/book/client/orders/OrderEvaluate",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ orderCancel(data) {
+ return request({
+ url: "/book/client/orders/orderCancel",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ orderDetail(data) {
+ return request({
+ url: "/book/client/orders/orderDetail",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ orderDetails(data) {
+ return request({
+ url: "/book/client/orders/orderDetails",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ isStaff(data) {
+ return request({
+ url: "/book/client/staff/isStaff",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ StaffOrderList(data) {
+ return request({
+ url: "/book/client/orders/StaffOrderList",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ staffCenter(data) {
+ return request({
+ url: "/book/client/staff/staffCenter",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ takeOrder(data) {
+ return request({
+ url: "/book/client/orders/takeOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ startOrder(data) {
+ return request({
+ url: "/book/client/orders/startOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ completeOrder(data) {
+ return request({
+ url: "/book/client/orders/completeOrder",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ orderEvaluateList(data) {
+ return request({
+ url: "/book/client/orders/orderEvaluateList",
+ method: "POST",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ goodsEvaluate(data) {
+ return request({
+ url: "/book/client/goods/evaluate",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ showBanner(data) {
+ return request({
+ url: "/book/client/index/show",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ broker(data) {
+ return request({
+ url: "/book/client/staff/broker",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+ GetSkuList(data) {
+ return request({
+ url: "/book/client/orders/GetSkuList",
+ method: "GET",
+ data,
+ needLogin: true,
+ noclient: true
+ });
+ },
+};
\ No newline at end of file
diff --git a/api/modules/transfer.js b/api/modules/transfer.js
new file mode 100644
index 0000000..570cbb5
--- /dev/null
+++ b/api/modules/transfer.js
@@ -0,0 +1,25 @@
+import { request } from "@/utils/request";
+
+export default {
+ /**
+ * 获取当前积分
+ */
+ getIntegral() {
+ return request({
+ url: "/user/integral",
+ method: "GET",
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 获取当前余额
+ */
+ getBalance() {
+ return request({
+ url: "/user/balance",
+ method: "GET",
+ needLogin: true,
+ });
+ },
+};
diff --git a/api/modules/user.js b/api/modules/user.js
new file mode 100644
index 0000000..222b222
--- /dev/null
+++ b/api/modules/user.js
@@ -0,0 +1,178 @@
+import {
+ request
+} from "@/utils/request";
+
+export default {
+ // 登录
+ login(data) {
+ return request({
+ url: "/auth/login",
+ method: "POST",
+ data,
+ });
+ },
+ // 手机号注册
+ regPhone(data) {
+ return request({
+ url: "/auth/regPhone",
+ method: "POST",
+ data,
+ });
+ },
+ loginPhone(data) {
+ return request({
+ url: "/auth/loginPhone",
+ method: "POST",
+ data,
+ });
+ },
+ // 测试登录
+ testLogin(data) {
+ return request({
+ url: "/auth/testLogin",
+ method: "POST",
+ data,
+ });
+ },
+ // 置换token
+ resetToken(data) {
+ return request({
+ url: "/auth/resetToken",
+ method: "POST",
+ data,
+ });
+ },
+ userInfo(data = {}) {
+ return request({
+ url: "/auth/user",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ userMobile(data = {}) {
+ return request({
+ url: "/user/userMobile",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ setMobile(data = {}) {
+ return request({
+ url: "/user/setMobile",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ setUserInfo(data = {}) {
+ return request({
+ url: "/user/SetUserInfo",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ UpdateUser(data = {}) {
+ return request({
+ url: "/user/UpdateUser",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+
+ send(data = {}) {
+ return request({
+ url: "/user/send",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ bind_merge(data = {}) {
+ return request({
+ url: "/user/bind_merge",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ LevelInfo(data = {}) {
+ return request({
+ url: "/User/LevelInfo",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ GetLevelList(data = {}) {
+ return request({
+ url: "/User/GetLevelList",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ fix(data = {}) {
+ return request({
+ url: "/User/fix",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+
+ /**
+ * 访问记录
+*/
+ log(data) {
+ return request({
+ url: "/user/log",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ isLogin(data = {}) {
+ return request({
+ url: "/auth/isLogin",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ taimiInfo(data = {}) {
+ return request({
+ url: "/user/taimiInfo",
+ method: "GET",
+ data,
+ needLogin: true,
+ });
+ },
+ taimiSave(data = {}) {
+ return request({
+ url: "/user/taimiSave",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ taimiTongbu(data = {}) {
+ return request({
+ url: "/user/taimiTongbu",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ },
+ createVip(data = {}) {
+ return request({
+ url: "/user/createVip",
+ method: "POST",
+ data,
+ needLogin: true,
+ });
+ }
+};
\ No newline at end of file
diff --git a/components/login/loginPage.vue b/components/login/loginPage.vue
new file mode 100644
index 0000000..a93dad2
--- /dev/null
+++ b/components/login/loginPage.vue
@@ -0,0 +1,263 @@
+
+ 提示
+
+
Pnq{Dwda?=8xmD1uI;8--_CapQW=;XP<3imkO>MAz zJ;2ZZmRse_DFjn%^mWHbGop+UhW$a;&ol(^Xe=yUrO(U4(xwxnpCs+6m54aoOhb+8 z%8+8q=K^GwPeygIc7J_0H)Mxb0sP{MQZ$#|wh%#1t|b^(Vh(m@IW}Re`<7({uqqao z=9G@&U=5ZKr2i^6Rb2^0qs=y0tG>>y+LldP^=0H%{sUo8`YOR;51T>QOybnTmRD?< zmFtN%5FBP=Ng_s;iDOlmIQG!;%qhPKpbJ!GPWIJlX4zs1L6~vzc6lKnuzW4sp3H1v zWcj4k$n~2MKHiyIn(aZ@Uc{;AqMzmNnH7up;xX23#3zm=aCBB7SQL#&mJ~R&j38-} z*i%!>4q{}6-qt+;?`(A6KBUm{YJ4@oNwwAyB!i73L_xehS}*4LtD*G2sw^c4Gp{+3 zT8tJId$5xj8K_xdgje6s51UiVtndB?V8`Cv1LD}J1XISAK3KGBV9T!=Q_1p8JpwIh z8gi$gRvWd-Sx%6F<<^scaG6%4w8*hNhLuaHLN>4&gv}(m9w**r6`DPmjSG$?2#H!y zHCLu~f`xk&gr}nQ($~zjc(^uO2+~iI4*4%YaBis%v00<_lj3I+P3YYep~-irP8 zaC1HEmG6IC2*Cbn^;78073+J>QPh8m?)1Zma#C15cpz!q9$Kqx+T1vQeyuI#aBU+9 z1El3+8bc}hRlOu}!>lnhpj&nWy!&x}`0O|rd3GhhAKuD8)FzDqIQ~fIW{;tkl|Gx$ z+Md3iv(BDbJ&^xkoMu{E+DZ^+)N3Dfk1rch{*qRbu$-uO61JPE3BR?S2-^!3kg;+m zDMk+FK+_C@%5qJv*eb;KCi<6Lv^II5?_4eALd|r>k&&mBByL(# N>#PuuIO2H#I45J2 zm&lQ^x$QHA&h5pA3!6=h5QPzf5hGt3Np{bNl>^M3P9W*e#VqcC1rmiwLO?H1BI(PK zB6oOLVAesEjuIqeMZ80P5(qA1 >(~nLkFEB? z%4VPArjn`Gyg7yKiDBigg(sB$ExB3t+Z#y@RzJ5^{#IhM@NjPmyt&o_0Cv*e_G$iu zL=7-#7Kuy%2v2a&S%+rBhX_`LK%Fp_Zoj-qyvL{xE84k^Ak4`pR;CtocMHGU(S?Uw z;j|q(RRU<=g0Mlu=G}-rY}SZOAgFf1DY+5*v)fdSq`k9e2&c`h#kNv)ncd!%1Yu6z z@h6%#v08m@%jd>ZQ_Kd-h(7im`^N3*4SeQ8P9u6UZEC6jrqz%wX)LAKskQCIv9$K8 zGep-G9&{~1G5|laOnH3EF8sPyz}+gxF6CtDDciaVpT6g^pXE~3R1r)ZZQuRtR^!Ot zTunKgmRvSRywU2uO409nf-vWPw>ow9)}6w$dwXzHDbBj7ZC4M#-UIA 5$1ad>>%38_8L_q)n(sZAf4ew|2<0(2KG~L&{+pk>I0wd z#0D>d?{}L=jewn}9fk9ZUS8t{d^}B%41iCx&>f%eQ*Y|(K_8q7xM5h7W<$9Isfjgo z@8yl+k4n?zd~072gu%$pO(u_3|8v(KywJ<1@Xikj;})>f@KJ}UuYYfW + z=^KJ%9DC?hI#xvG7u)v;jpo6`H5EdD?K4JKsw<|C*>~Rj6UXGK_u@?qeMgW?7=9h6 zS*etA|F+%2TyKWP{Z^-I^{Q{qoFrb<*npq8-(vk1`j#LWC>~yxJcU$YN!NZMYDV#D z{Sf=FMgNR(7{pJg#fxXx;Wqzyc*rB)6C~s6k6)sr##O?P_Vv)BuKmC_^9DwBg#; ~$uDvkTFmeHEIJt(}##Ymk3r>`N9U!;+ zT@55bGC_W9d8(;b5%1_tLSxr{7`S68XhR^kzZD@+sw<)S=*fNGj5Unt3@R#tCP;SB zpMFceXwQE5{((L`p=&>S?5l2bhHpg( bz?FqT;AJ lxg$KI`#H>^<`@`G~*%z2ylXwI23->LMIEPo}m()(%TCsr4$?|3RIQ3 zXT3!Anwztkp-h6kA(6HVB6U`j;j0akgeOi9qeWlEYc|c(f}9{0g^$%A-qBMrH<=WV zPmwyky9bUH5i1a>A}Ql2M34lek?e~?_GB;JGIy3|Oe+sT4-v>^673_xUMZw*BURXU tSUIjLD^uP(d}QyNb{BQF2sYQL{eLo>syCenJy-w$002ovPDHLkV1k+@PP_mB literal 0 HcmV?d00001 diff --git a/pages/my/images/xj.png b/pages/my/images/xj.png new file mode 100644 index 0000000000000000000000000000000000000000..3a838b4ed829883492ab5e60370e8958a95b7f51 GIT binary patch literal 3426 zcmds)`8(9z8^=F0#*nQc+Y~cnDSNV|2s5&bU1MKDlkD3=k*%gEgD{p*q8b_urfiKZ z$`(S4jF2f*mO|OaHu}zUegBK+hjYKrbzkQ`@B6xcIj@syZ)+~dcbE?V06`0^367(E z|1MrAC)T*qN;m?F!kHTbv|*_Q&LJra6O7|kuchL*;f`ZsuiqBKEApW4k3Eu4$F=$> z$OnPO8&pxXDo(DJ^#MH;l|gUtz7^hi++;yE144B?_L$#21XLq(=!ith@f_Y9ag3bU z-Vf)o!KSVg;mc21e#^0Q`Z*Hw%r&O|mnfqLyFXu4@fs-t+>v7T@1T6>8wuP1uRD*Z z xh5D+1_b$l QwCz=)u;u_%Bt1`FzTar8pVD@!66Fu^{W_A3Mf^47Yp2hITm-UHg71sniE z@&Z&vh7W+r+_+tIfe#>^nDRMl0s>^^-$iIygMj~lxxD7PG3RyHDolAJMT1 JNzk z(O=u9w{LO%IM<0dgJ6c1UecWzi3nikv5S7N=jsUy8r4}lJ!A$U4$M?IiG7`KqKXz5 z-M8n@q@~lKXsOOG%g$5L6$2DL%~X#HfS6=!RW 56_g z HTNJq8xW8sU!g{DqcZ(R1{jPk@$2!}9Pqcmx2Tdy))7qJF z4sPv6*R7y4gb*}|YZq ie@?I`{RM&lqc!FTYERAPA1X?qseYf?8OOl<<|HxQGtZn2wK$lMJRy zP(v`CEU~FPv6e%g<3k)th@94#+NJ(|5s#c7YKAVwHvi}%)GW`em+4)s(q4=d|956| z#Z31h5bOH7H(CEDd}{wpDG#d)ad|9^{Kw^IL-_UL=xge~4o^8FRShHCiSTq$1H`=& z$9{UpHza9ytIIdN(axixJ?FHpSwY(FK}O(AhMobd&1z}?N&+yxR!7#Ii%$Mhopm(j zAM7e2qU42pb4m8L${K4YTkl15-*rm=mA&_|(Ur3>0B8J@J*KPH^3M~~FHH8|hQI^# z@%A!!sgxn(5wdMw!d45d`>1JeU>+}gZgm!BWO_bNwMmE`W4PbUBv%!zmD}*=&sDy$ zL57FaoNwA6Y&{*~77QDUCVK*I9J z%ud!nrUv!}8k|Z^Cv@1}QI&*UY?)*84?mBA$KFjg?EDRZ*fDNYc3L?vas2953hSzG zR_0#E{?xGX$x~*x*WgirNM%48;q#7aX$M 68OR`PZ{sGfqJWjsm1N61oe^ z1zoXkYWt9gj%GG>aDpTMLMK}yoGpnDBjy89+;sz z+P=sGX=Hug3y2Ef`MzZtD8#rIt6w8g7MBR1+RrUjKGZ|~(5|#Xwn!TvQo2RoR{t_S zow%6CvXK=8uw?|RD!uJBj9Dzzv81iN+{W~_(nqPeq-5o>+F5`Y>rCUB@9tIjfFPLg zVNcy0vco(ad9p|Iv<#JcC9a}EKYPYJb|P=35?5QR^b%42xi_s(5H|bt^p(XOF|Age z2T4~3F{e{9M{|s9sB|?&(>cnqkH#TKltv79eO~!1POdrmbiiwYuVXH0?8Bv}*DlUvxYzN_HW6#Yh7iT}HU%xE)Z7H9 zMrXvm{==ds^{@U6$C=TM-rnpG2ycI9xF1x!x%5;amXYEwXL}9$W~+-EHqvvSC4jCQ z9WtcFd;hG_7)aXHV>wWMI6Q8R9_y XM`;BKL{HY{{Q7Q-;-oa z*7u>D7W~{wWy- @e>l@nJ8(G5+_5G-&aaFGV!r#3;Om>{vtho?X zP$=^m2;!D}Hmc4@E~POmOx+a}8ETq!X`@C**jG5-!@ACFadPtEy-+J$59nZH8|7_~ z&0Ld#Zb<>rW79_myAtN(U1SW<)uG|@N%RA@< z+KhNs+_Na*ml=)_YHSu_`Bk?%{qnC}#ZMt}3q$|7Vx^A5CSzvxJnkyE9Bpx(8ouzB zLF_}3sjtpe9(N9}4~S_VY=VrJ`TCurky IG!_>x{UrB-yx-w9krBp2Tm$BQdw|jeiKNs$h!@-L;GuDIoA|?$ zk$j&x(0lTh{c(2=#p>-vFgZ+ItCSr1o&&k>r&HEWa?sgECNJF?AP|L&9?&^N9m4n6 zvw?%im$# + + + + + + + + + \ No newline at end of file diff --git a/static/css/common.scss b/static/css/common.scss new file mode 100644 index 0000000..5261b9c --- /dev/null +++ b/static/css/common.scss @@ -0,0 +1,48 @@ +.page-box { + min-height: 100vh !important; +} + +.flex { + display: flex; +} + +.flex-1 { + flex: 1; +} + +.flex-row { + flex-direction: row; +} + +.flex-col { + flex-direction: column; +} + +.justify-around { + justify-content: space-around; +} + +.items-center { + align-items: center; +} + +.flex-x-between { + justify-content: space-between; +} + +.flex-x-end { + justify-content: flex-end; +} + +.flex-x-center { + justify-content: center; +} + +.flex-y-center { + align-items: center; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} \ No newline at end of file diff --git a/static/css/uni.scss b/static/css/uni.scss new file mode 100644 index 0000000..66a148b --- /dev/null +++ b/static/css/uni.scss @@ -0,0 +1,78 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color:#333;//基本色 +$uni-text-color-inverse:#fff;//反色 +$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 背景颜色 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//点击状态颜色 +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 + +/* 边框颜色 */ +$uni-border-color:#c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16; + +/* 图片尺寸 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:15px; + +@import '@/uni_modules/uview-ui/theme.scss'; diff --git a/static/h5/jweixin-sdk.js b/static/h5/jweixin-sdk.js new file mode 100644 index 0000000..f05775d --- /dev/null +++ b/static/h5/jweixin-sdk.js @@ -0,0 +1 @@ +!function (e, n) { "function" == typeof define && (define.amd || define.cmd) ? define(function () { return n(e) }) : n(e, !0) }(window, function (o, e) { if (!o.jWeixin) { var n, c = { config: "preVerifyJSAPI", onMenuShareTimeline: "menu:share:timeline", onMenuShareAppMessage: "menu:share:appmessage", onMenuShareQQ: "menu:share:qq", onMenuShareWeibo: "menu:share:weiboApp", onMenuShareQZone: "menu:share:QZone", previewImage: "imagePreview", getLocation: "geoLocation", openProductSpecificView: "openProductViewWithPid", addCard: "batchAddCard", openCard: "batchViewCard", chooseWXPay: "getBrandWCPayRequest", openEnterpriseRedPacket: "getRecevieBizHongBaoRequest", startSearchBeacons: "startMonitoringBeacons", stopSearchBeacons: "stopMonitoringBeacons", onSearchBeacons: "onBeaconsInRange", consumeAndShareCard: "consumedShareCard", openAddress: "editAddress" }, a = function () { var e = {}; for (var n in c) e[c[n]] = n; return e }(), i = o.document, t = i.title, r = navigator.userAgent.toLowerCase(), s = navigator.platform.toLowerCase(), d = !(!s.match("mac") && !s.match("win")), u = -1 != r.indexOf("wxdebugger"), l = -1 != r.indexOf("micromessenger"), p = -1 != r.indexOf("android"), f = -1 != r.indexOf("iphone") || -1 != r.indexOf("ipad"), m = (n = r.match(/micromessenger\/(\d+\.\d+\.\d+)/) || r.match(/micromessenger\/(\d+\.\d+)/)) ? n[1] : "", g = { initStartTime: L(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 }, h = { version: 1, appId: "", initTime: 0, preVerifyTime: 0, networkType: "", isPreVerifyOk: 1, systemType: f ? 1 : p ? 2 : -1, clientVersion: m, url: encodeURIComponent(location.href) }, v = {}, S = { _completes: [] }, y = { state: 0, data: {} }; O(function () { g.initEndTime = L() }); var I = !1, _ = [], w = { config: function (e) { B("config", v = e); var t = !1 !== v.check; O(function () { if (t) M(c.config, { verifyJsApiList: C(v.jsApiList), verifyOpenTagList: C(v.openTagList) }, function () { S._complete = function (e) { g.preVerifyEndTime = L(), y.state = 1, y.data = e }, S.success = function (e) { h.isPreVerifyOk = 0 }, S.fail = function (e) { S._fail ? S._fail(e) : y.state = -1 }; var t = S._completes; return t.push(function () { !function () { if (!(d || u || v.debug || m < "6.0.2" || h.systemType < 0)) { var i = new Image; h.appId = v.appId, h.initTime = g.initEndTime - g.initStartTime, h.preVerifyTime = g.preVerifyEndTime - g.preVerifyStartTime, w.getNetworkType({ isInnerInvoke: !0, success: function (e) { h.networkType = e.networkType; var n = "https://open.weixin.qq.com/sdk/report?v=" + h.version + "&o=" + h.isPreVerifyOk + "&s=" + h.systemType + "&c=" + h.clientVersion + "&a=" + h.appId + "&n=" + h.networkType + "&i=" + h.initTime + "&p=" + h.preVerifyTime + "&u=" + h.url; i.src = n } }) } }() }), S.complete = function (e) { for (var n = 0, i = t.length; n < i; ++n)t[n](); S._completes = [] }, S }()), g.preVerifyStartTime = L(); else { y.state = 1; for (var e = S._completes, n = 0, i = e.length; n < i; ++n)e[n](); S._completes = [] } }), w.invoke || (w.invoke = function (e, n, i) { o.WeixinJSBridge && WeixinJSBridge.invoke(e, x(n), i) }, w.on = function (e, n) { o.WeixinJSBridge && WeixinJSBridge.on(e, n) }) }, ready: function (e) { 0 != y.state ? e() : (S._completes.push(e), !l && v.debug && e()) }, error: function (e) { m < "6.0.2" || (-1 == y.state ? e(y.data) : S._fail = e) }, checkJsApi: function (e) { M("checkJsApi", { jsApiList: C(e.jsApiList) }, (e._complete = function (e) { if (p) { var n = e.checkResult; n && (e.checkResult = JSON.parse(n)) } e = function (e) { var n = e.checkResult; for (var i in n) { var t = a[i]; t && (n[t] = n[i], delete n[i]) } return e }(e) }, e)) }, onMenuShareTimeline: function (e) { P(c.onMenuShareTimeline, { complete: function () { M("shareTimeline", { title: e.title || t, desc: e.title || t, img_url: e.imgUrl || "", link: e.link || location.href, type: e.type || "link", data_url: e.dataUrl || "" }, e) } }, e) }, onMenuShareAppMessage: function (n) { P(c.onMenuShareAppMessage, { complete: function (e) { "favorite" === e.scene ? M("sendAppMessage", { title: n.title || t, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }) : M("sendAppMessage", { title: n.title || t, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }, n) } }, n) }, onMenuShareQQ: function (e) { P(c.onMenuShareQQ, { complete: function () { M("shareQQ", { title: e.title || t, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, onMenuShareWeibo: function (e) { P(c.onMenuShareWeibo, { complete: function () { M("shareWeiboApp", { title: e.title || t, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, onMenuShareQZone: function (e) { P(c.onMenuShareQZone, { complete: function () { M("shareQZone", { title: e.title || t, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, updateTimelineShareData: function (e) { M("updateTimelineShareData", { title: e.title, link: e.link, imgUrl: e.imgUrl }, e) }, updateAppMessageShareData: function (e) { M("updateAppMessageShareData", { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl }, e) }, startRecord: function (e) { M("startRecord", {}, e) }, stopRecord: function (e) { M("stopRecord", {}, e) }, onVoiceRecordEnd: function (e) { P("onVoiceRecordEnd", e) }, playVoice: function (e) { M("playVoice", { localId: e.localId }, e) }, pauseVoice: function (e) { M("pauseVoice", { localId: e.localId }, e) }, stopVoice: function (e) { M("stopVoice", { localId: e.localId }, e) }, onVoicePlayEnd: function (e) { P("onVoicePlayEnd", e) }, uploadVoice: function (e) { M("uploadVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, downloadVoice: function (e) { M("downloadVoice", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, translateVoice: function (e) { M("translateVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, chooseImage: function (e) { M("chooseImage", { scene: "1|2", count: e.count || 9, sizeType: e.sizeType || ["original", "compressed"], sourceType: e.sourceType || ["album", "camera"] }, (e._complete = function (e) { if (p) { var n = e.localIds; try { n && (e.localIds = JSON.parse(n)) } catch (e) { } } }, e)) }, getLocation: function (e) { }, previewImage: function (e) { M(c.previewImage, { current: e.current, urls: e.urls }, e) }, uploadImage: function (e) { M("uploadImage", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, downloadImage: function (e) { M("downloadImage", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, getLocalImgData: function (e) { !1 === I ? (I = !0, M("getLocalImgData", { localId: e.localId }, (e._complete = function (e) { if (I = !1, 0 < _.length) { var n = _.shift(); wx.getLocalImgData(n) } }, e))) : _.push(e) }, getNetworkType: function (e) { M("getNetworkType", {}, (e._complete = function (e) { e = function (e) { var n = e.errMsg; e.errMsg = "getNetworkType:ok"; var i = e.subtype; if (delete e.subtype, i) e.networkType = i; else { var t = n.indexOf(":"), o = n.substring(t + 1); switch (o) { case "wifi": case "edge": case "wwan": e.networkType = o; break; default: e.errMsg = "getNetworkType:fail" } } return e }(e) }, e)) }, openLocation: function (e) { M("openLocation", { latitude: e.latitude, longitude: e.longitude, name: e.name || "", address: e.address || "", scale: e.scale || 28, infoUrl: e.infoUrl || "" }, e) }, getLocation: function (e) { M(c.getLocation, { type: (e = e || {}).type || "wgs84" }, (e._complete = function (e) { delete e.type }, e)) }, hideOptionMenu: function (e) { M("hideOptionMenu", {}, e) }, showOptionMenu: function (e) { M("showOptionMenu", {}, e) }, closeWindow: function (e) { M("closeWindow", {}, e = e || {}) }, hideMenuItems: function (e) { M("hideMenuItems", { menuList: e.menuList }, e) }, showMenuItems: function (e) { M("showMenuItems", { menuList: e.menuList }, e) }, hideAllNonBaseMenuItem: function (e) { M("hideAllNonBaseMenuItem", {}, e) }, showAllNonBaseMenuItem: function (e) { M("showAllNonBaseMenuItem", {}, e) }, scanQRCode: function (e) { M("scanQRCode", { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ["qrCode", "barCode"] }, (e._complete = function (e) { if (f) { var n = e.resultStr; if (n) { var i = JSON.parse(n); e.resultStr = i && i.scan_code && i.scan_code.scan_result } } }, e)) }, openAddress: function (e) { M(c.openAddress, {}, (e._complete = function (e) { e = function (e) { return e.postalCode = e.addressPostalCode, delete e.addressPostalCode, e.provinceName = e.proviceFirstStageName, delete e.proviceFirstStageName, e.cityName = e.addressCitySecondStageName, delete e.addressCitySecondStageName, e.countryName = e.addressCountiesThirdStageName, delete e.addressCountiesThirdStageName, e.detailInfo = e.addressDetailInfo, delete e.addressDetailInfo, e }(e) }, e)) }, openProductSpecificView: function (e) { M(c.openProductSpecificView, { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo }, e) }, addCard: function (e) { for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { var r = n[t], a = { card_id: r.cardId, card_ext: r.cardExt }; i.push(a) } M(c.addCard, { card_list: i }, (e._complete = function (e) { var n = e.card_list; if (n) { for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) { var o = n[i]; o.cardId = o.card_id, o.cardExt = o.card_ext, o.isSuccess = !!o.is_succ, delete o.card_id, delete o.card_ext, delete o.is_succ } e.cardList = n, delete e.card_list } }, e)) }, chooseCard: function (e) { M("chooseCard", { app_id: v.appId, location_id: e.shopId || "", sign_type: e.signType || "SHA1", card_id: e.cardId || "", card_type: e.cardType || "", card_sign: e.cardSign, time_stamp: e.timestamp + "", nonce_str: e.nonceStr }, (e._complete = function (e) { e.cardList = e.choose_card_info, delete e.choose_card_info }, e)) }, openCard: function (e) { for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { var r = n[t], a = { card_id: r.cardId, code: r.code }; i.push(a) } M(c.openCard, { card_list: i }, e) }, consumeAndShareCard: function (e) { M(c.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e) }, chooseWXPay: function (e) { M(c.chooseWXPay, V(e), e) }, openEnterpriseRedPacket: function (e) { M(c.openEnterpriseRedPacket, V(e), e) }, startSearchBeacons: function (e) { M(c.startSearchBeacons, { ticket: e.ticket }, e) }, stopSearchBeacons: function (e) { M(c.stopSearchBeacons, {}, e) }, onSearchBeacons: function (e) { P(c.onSearchBeacons, e) }, openEnterpriseChat: function (e) { M("openEnterpriseChat", { useridlist: e.userIds, chatname: e.groupName }, e) }, launchMiniProgram: function (e) { M("launchMiniProgram", { targetAppId: e.targetAppId, path: function (e) { if ("string" == typeof e && 0 < e.length) { var n = e.split("?")[0], i = e.split("?")[1]; return n += ".html", void 0 !== i ? n + "?" + i : n } }(e.path), envVersion: e.envVersion }, e) }, openBusinessView: function (e) { M("openBusinessView", { businessType: e.businessType, queryString: e.queryString || "", envVersion: e.envVersion }, (e._complete = function (n) { if (p) { var e = n.extraData; if (e) try { n.extraData = JSON.parse(e) } catch (e) { n.extraData = {} } } }, e)) }, miniProgram: { navigateBack: function (e) { e = e || {}, O(function () { M("invokeMiniProgramAPI", { name: "navigateBack", arg: { delta: e.delta || 1 } }, e) }) }, navigateTo: function (e) { O(function () { M("invokeMiniProgramAPI", { name: "navigateTo", arg: { url: e.url } }, e) }) }, redirectTo: function (e) { O(function () { M("invokeMiniProgramAPI", { name: "redirectTo", arg: { url: e.url } }, e) }) }, switchTab: function (e) { O(function () { M("invokeMiniProgramAPI", { name: "switchTab", arg: { url: e.url } }, e) }) }, reLaunch: function (e) { O(function () { M("invokeMiniProgramAPI", { name: "reLaunch", arg: { url: e.url } }, e) }) }, postMessage: function (e) { O(function () { M("invokeMiniProgramAPI", { name: "postMessage", arg: e.data || {} }, e) }) }, getEnv: function (e) { O(function () { e({ miniprogram: "miniprogram" === o.__wxjs_environment }) }) } } }, T = 1, k = {}; return i.addEventListener("error", function (e) { if (!p) { var n = e.target, i = n.tagName, t = n.src; if ("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) if (-1 != t.indexOf("wxlocalresource://")) { e.preventDefault(), e.stopPropagation(); var o = n["wx-id"]; if (o || (o = T++, n["wx-id"] = o), k[o]) return; k[o] = !0, wx.ready(function () { wx.getLocalImgData({ localId: t, success: function (e) { n.src = e.localData } }) }) } } }, !0), i.addEventListener("load", function (e) { if (!p) { var n = e.target, i = n.tagName; n.src; if ("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) { var t = n["wx-id"]; t && (k[t] = !1) } } }, !0), e && (o.wx = o.jWeixin = w), w } function M(n, e, i) { o.WeixinJSBridge ? WeixinJSBridge.invoke(n, x(e), function (e) { A(n, e, i) }) : B(n, i) } function P(n, i, t) { o.WeixinJSBridge ? WeixinJSBridge.on(n, function (e) { t && t.trigger && t.trigger(e), A(n, e, i) }) : B(n, t || i) } function x(e) { return (e = e || {}).appId = v.appId, e.verifyAppId = v.appId, e.verifySignType = "sha1", e.verifyTimestamp = v.timestamp + "", e.verifyNonceStr = v.nonceStr, e.verifySignature = v.signature, e } function V(e) { return { timeStamp: e.timestamp + "", nonceStr: e.nonceStr, package: e.package, paySign: e.paySign, signType: e.signType || "SHA1" } } function A(e, n, i) { "openEnterpriseChat" != e && "openBusinessView" !== e || (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail; var t = n.errMsg; t || (t = n.err_msg, delete n.err_msg, t = function (e, n) { var i = e, t = a[i]; t && (i = t); var o = "ok"; if (n) { var r = n.indexOf(":"); "confirm" == (o = n.substring(r + 1)) && (o = "ok"), "failed" == o && (o = "fail"), -1 != o.indexOf("failed_") && (o = o.substring(7)), -1 != o.indexOf("fail_") && (o = o.substring(5)), "access denied" != (o = (o = o.replace(/_/g, " ")).toLowerCase()) && "no permission to execute" != o || (o = "permission denied"), "config" == i && "function not exist" == o && (o = "ok"), "" == o && (o = "fail") } return n = i + ":" + o }(e, t), n.errMsg = t), (i = i || {})._complete && (i._complete(n), delete i._complete), t = n.errMsg || "", v.debug && !i.isInnerInvoke && alert(JSON.stringify(n)); var o = t.indexOf(":"); switch (t.substring(o + 1)) { case "ok": i.success && i.success(n); break; case "cancel": i.cancel && i.cancel(n); break; default: i.fail && i.fail(n) }i.complete && i.complete(n) } function C(e) { if (e) { for (var n = 0, i = e.length; n < i; ++n) { var t = e[n], o = c[t]; o && (e[n] = o) } return e } } function B(e, n) { if (!(!v.debug || n && n.isInnerInvoke)) { var i = a[e]; i && (e = i), n && n._complete && delete n._complete, console.log('"' + e + '",', n || "") } } function L() { return (new Date).getTime() } function O(e) { l && (o.WeixinJSBridge ? e() : i.addEventListener && i.addEventListener("WeixinJSBridgeReady", e, !1)) } }); \ No newline at end of file diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..bf83ce4 --- /dev/null +++ b/store/index.js @@ -0,0 +1,31 @@ +import Vue from "vue"; +import Vuex from "vuex"; + +Vue.use(Vuex); + +const store = new Vuex.Store({ + state: { + $Gimage: {}, + $GstoreDetail: {}, + // 购物车数量 + cartNum: 0, + }, + getters: { + cartNum: (state) => { + return state.cartNum || 0; + }, + }, + mutations: { + SET: (state, { key, val }) => { + state[key] = val + }, + }, + actions: { + setData({ commit }, { key, val }) { + commit('SET', { key, val }) + } + }, + modules: {}, +}); + +export default store; diff --git a/subPackages/inPersonToPay/compontents/coupons.vue b/subPackages/inPersonToPay/compontents/coupons.vue new file mode 100644 index 0000000..cc72555 --- /dev/null +++ b/subPackages/inPersonToPay/compontents/coupons.vue @@ -0,0 +1,455 @@ + ++ + + + ++ {{ control.titleStyle.show_title ? control.titleStyle.name : '' }} + + ++ + + + + + + + + + + + + ++ 个人中心 + + ++ + + + ++ ++ ++ + +{{ data.user_info.nickname }} ++ ++ ++ + +登录/注册 ++ + + + + + + diff --git a/subPackages/inPersonToPay/compontents/twoGoods.vue b/subPackages/inPersonToPay/compontents/twoGoods.vue new file mode 100644 index 0000000..90d0b08 --- /dev/null +++ b/subPackages/inPersonToPay/compontents/twoGoods.vue @@ -0,0 +1,212 @@ + ++ + ++ + ++ + + + + + ++ + ++ + +可用优惠券 ({{ on.length }}) + +不可用优惠券 ({{ off.length }}) + ++ + + ++ + ++ + ++ + ++ ¥{{ item.coupon.price || 0 }} + + ++ 满{{ item.coupon.full_price }}减{{ item.coupon.price }} + ++ + ++ {{ item.coupon.name }} + ++ 类型: +{{ ["优惠券", "商品", "分类", "当面付"][item.coupon.coupon_type] }}可用 ++ ++ ++ ++ + + ++ 详细信息 + ++ + +过期时间:{{ $u.timeFormat(item.end_time, 'yyyy年mm月dd日 hh:MM:ss') }} ++ + ++ ++ +确认 ++ + + + + + diff --git a/subPackages/inPersonToPay/index/index.vue b/subPackages/inPersonToPay/index/index.vue new file mode 100644 index 0000000..f85f736 --- /dev/null +++ b/subPackages/inPersonToPay/index/index.vue @@ -0,0 +1,662 @@ + + ++ ++ ++ +{{ e.lable.name }} ++ ++ + ++ + ++ + +{{ e.name }} ++ ++ + ++ + +卷后 +¥ +{{ getPrice(e.autoCouponPrice)[0] }} +.{{ getPrice(e.autoCouponPrice)[1] }} + + +¥ +{{ getPrice(e.price_min)[0] }} +.{{ getPrice(e.price_min)[1] }} + ++ + + + + + + + + \ No newline at end of file diff --git a/subPackages/inPersonToPay/result/index.vue b/subPackages/inPersonToPay/result/index.vue new file mode 100644 index 0000000..5a1a84f --- /dev/null +++ b/subPackages/inPersonToPay/result/index.vue @@ -0,0 +1,174 @@ + ++ ++ ++ + {{ info.name }} + ++ ++ + ++ + ++ + ++ + + + + ++ + + ++ +余额支付 + ++ + + + ++ +微信 + ++ + + + + ++ +支付宝 + ++ + ++ +微信 + ++ + + ++ +支付宝 + ++ + + + + + + + \ No newline at end of file diff --git a/subPackages/login/forgotPassword/index.vue b/subPackages/login/forgotPassword/index.vue new file mode 100644 index 0000000..9ee81b6 --- /dev/null +++ b/subPackages/login/forgotPassword/index.vue @@ -0,0 +1,38 @@ + ++ + + + ++ 支付成功 ++ ¥ {{ `${price} 元` }}+ + + ++ + + + + + + \ No newline at end of file diff --git a/subPackages/login/forgotPassword/nuxt.vue b/subPackages/login/forgotPassword/nuxt.vue new file mode 100644 index 0000000..dd8d177 --- /dev/null +++ b/subPackages/login/forgotPassword/nuxt.vue @@ -0,0 +1,321 @@ + ++ + ++ + ++ 账号: + ++ ++ + + + + + + + diff --git a/subPackages/login/login/index.vue b/subPackages/login/login/index.vue new file mode 100644 index 0000000..f90df75 --- /dev/null +++ b/subPackages/login/login/index.vue @@ -0,0 +1,27 @@ + ++ + + + + ++ 向您绑定的手机号 199xxxx1234 发送验证码 + + ++ + ++ + ++ + ++ + + + ++ + + 新密码 + + + ++ + + ++ + + 确认密码 + + + ++ + + + + + \ No newline at end of file diff --git a/subPackages/login/reg/index.vue b/subPackages/login/reg/index.vue new file mode 100644 index 0000000..fc0c9ec --- /dev/null +++ b/subPackages/login/reg/index.vue @@ -0,0 +1,174 @@ + ++ + + + + + + \ No newline at end of file diff --git a/subPackages/login/reg/reset.vue b/subPackages/login/reg/reset.vue new file mode 100644 index 0000000..7c70cf0 --- /dev/null +++ b/subPackages/login/reg/reset.vue @@ -0,0 +1,161 @@ + ++ ++ ++ + ++ + ++ ++ + + + + + + + + ++ + ++ + ++ + ++ + + + + + + \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..66a148b --- /dev/null +++ b/uni.scss @@ -0,0 +1,78 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color:#333;//基本色 +$uni-text-color-inverse:#fff;//反色 +$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 背景颜色 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//点击状态颜色 +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 + +/* 边框颜色 */ +$uni-border-color:#c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16; + +/* 图片尺寸 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:15px; + +@import '@/uni_modules/uview-ui/theme.scss'; diff --git a/uni_modules/alipayjsapi/alipayjsapi.js b/uni_modules/alipayjsapi/alipayjsapi.js new file mode 100644 index 0000000..a736588 --- /dev/null +++ b/uni_modules/alipayjsapi/alipayjsapi.js @@ -0,0 +1,4183 @@ +/** + * AlipayJSAPI + * @author wangyou.ly + * @version 3.1.1 + * @todo + **/ +;(function (self) { + + function PromisePolyfillImpl() { + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version 4.1.0+f9a5575b + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ES6Promise = factory()); +}(this, (function () { 'use strict'; + +function objectOrFunction(x) { + return typeof x === 'function' || typeof x === 'object' && x !== null; +} + +function isFunction(x) { + return typeof x === 'function'; +} + +var _isArray = undefined; +if (!Array.isArray) { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; +} else { + _isArray = Array.isArray; +} + +var isArray = _isArray; + +var len = 0; +var vertxNext = undefined; +var customSchedulerFn = undefined; + +var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } +}; + +function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; +} + +function setAsap(asapFn) { + asap = asapFn; +} + +var browserWindow = typeof window !== 'undefined' ? window : undefined; +var browserGlobal = browserWindow || {}; +var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; +} + +// vertx +function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); +} + +function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; +} + +// web worker +function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; +} + +function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; +} + +var queue = new Array(1000); +function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; +} + +function attemptVertx() { + try { + var r = require; + var vertx = r('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } +} + +var scheduleFlush = undefined; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof require === 'function') { + scheduleFlush = attemptVertx(); +} else { + scheduleFlush = useSetTimeout(); +} + +function then(onFulfillment, onRejection) { + var _arguments = arguments; + + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + if (_state) { + (function () { + var callback = _arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + })(); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; +} + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +function resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + _resolve(promise, object); + return promise; +} + +var PROMISE_ID = Math.random().toString(36).substring(16); + +function noop() {} + +var PENDING = void 0; +var FULFILLED = 1; +var REJECTED = 2; + +var GET_THEN_ERROR = new ErrorObject(); + +function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function getThen(promise) { + try { + return promise.then; + } catch (error) { + GET_THEN_ERROR.error = error; + return GET_THEN_ERROR; + } +} + +function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + _resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + _reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + _reject(promise, error); + } + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + _reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return _resolve(promise, value); + }, function (reason) { + return _reject(promise, reason); + }); + } +} + +function handleMaybeThenable(promise, maybeThenable, then$) { + if (maybeThenable.constructor === promise.constructor && then$ === then && maybeThenable.constructor.resolve === resolve) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$ === GET_THEN_ERROR) { + _reject(promise, GET_THEN_ERROR.error); + GET_THEN_ERROR.error = null; + } else if (then$ === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$)) { + handleForeignThenable(promise, maybeThenable, then$); + } else { + fulfill(promise, maybeThenable); + } + } +} + +function _resolve(promise, value) { + if (promise === value) { + _reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + handleMaybeThenable(promise, value, getThen(value)); + } else { + fulfill(promise, value); + } +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function _reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = undefined, + callback = undefined, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; +} + +function ErrorObject() { + this.error = null; +} + +var TRY_CATCH_ERROR = new ErrorObject(); + +function tryCatch(callback, detail) { + try { + return callback(detail); + } catch (e) { + TRY_CATCH_ERROR.error = e; + return TRY_CATCH_ERROR; + } +} + +function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = undefined, + error = undefined, + succeeded = undefined, + failed = undefined; + + if (hasCallback) { + value = tryCatch(callback, detail); + + if (value === TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value.error = null; + } else { + succeeded = true; + } + + if (promise === value) { + _reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + _resolve(promise, value); + } else if (failed) { + _reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + _reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + _resolve(promise, value); + }, function rejectPromise(reason) { + _reject(promise, reason); + }); + } catch (e) { + _reject(promise, e); + } +} + +var id = 0; +function nextId() { + return id++; +} + +function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; +} + +function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this._input = input; + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + _reject(this.promise, validationError()); + } +} + +function validationError() { + return new Error('Array Methods must be provided an Array'); +}; + +Enumerator.prototype._enumerate = function () { + var length = this.length; + var _input = this._input; + + for (var i = 0; this._state === PENDING && i < length; i++) { + this._eachEntry(_input[i], i); + } +}; + +Enumerator.prototype._eachEntry = function (entry, i) { + var c = this._instanceConstructor; + var resolve$ = c.resolve; + + if (resolve$ === resolve) { + var _then = getThen(entry); + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise) { + var promise = new c(noop); + handleMaybeThenable(promise, entry, _then); + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$) { + return resolve$(entry); + }), i); + } + } else { + this._willSettleAt(resolve$(entry), i); + } +}; + +Enumerator.prototype._settledAt = function (state, i, value) { + var promise = this.promise; + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + _reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } +}; + +Enumerator.prototype._willSettleAt = function (promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); +}; + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +function all(entries) { + return new Enumerator(this, entries).promise; +} + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } +} + +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +function reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + _reject(promise, reason); + return promise; +} + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor +*/ +function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } +} + +Promise.all = all; +Promise.race = race; +Promise.resolve = resolve; +Promise.reject = reject; +Promise._setScheduler = setScheduler; +Promise._setAsap = setAsap; +Promise._asap = asap; + +Promise.prototype = { + constructor: Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + let result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + let author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: then, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function _catch(onRejection) { + return this.then(null, onRejection); + } +}; + +function polyfill() { + var local = undefined; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise; +} + +// Strange compat.. +Promise.polyfill = polyfill; +Promise.Promise = Promise; + +Promise.polyfill(); + +return Promise; + +}))); + + } + + function shouldIgnorePolyfill(self) { + var isSupport = false; + var P = self.Promise; + + if (P) { + var promise = null; + var then = null; + try { + promise = P.resolve(); + then = promise.then; + } catch (e) { + // silently ignored + } + if (promise instanceof P && typeof then === 'function' && !P.cast) { + isSupport = true; + } + } + return isSupport; + } + + if (!shouldIgnorePolyfill(self)) { + PromisePolyfillImpl(); + } +})(self); +/** + * AP SOURCE + */ +;(function (self) { + 'use strict'; + /********************* JSAPI functions ********************/ + // AlipayJSBridge + + var _JS_BRIDGE_NAME = 'AlipayJSBridge'; + var _JS_BRIDGE = self[_JS_BRIDGE_NAME]; + var _UA = navigator.userAgent || navigator.swuserAgent; + var _MEDIA_BUSINESS = 'apm-h5'; + var _IS_SUPPORT_PROMISE; + var window = self.window; + var document = self.document; + var console = self.console; + var parseInt = self.parseInt; + /** + * å¾…æ‰§è¡Œé˜Ÿåˆ—ï¼Œå¤„ç† ready å‰çš„æŽ¥å£è°ƒç”¨ + */ + var _WAITING_QUEUE = []; + + //ç¼“å˜ + var _CACHE = { + getBAPSI: { + isListening: false, + lastState: 2, + on: function on() { + if (!_CACHE.getBAPSI.isListening) { + _JS_BRIDGE.call('startMonitorBackgroundAudio'); + _CACHE.getBAPSI.isListening = true; + AP.on('getBackgroundAudioPlayedStateInfo', _CACHE.getBAPSI.listener); + } + }, + off: function off() { + AP.off('getBackgroundAudioPlayedStateInfo', _CACHE.getBAPSI.listener); + _JS_BRIDGE.call('stopMonitorBackgroundAudio'); + _CACHE.getBAPSI.isListening = false; + }, + listener: function listener(evt) { + var data = evt.data || {}; + var state = data.status; + var triggerEvent = ['backgroundAudioPause', 'backgroundAudioPlay', 'backgroundAudioStop'][state]; + if (triggerEvent && state !== _CACHE.getBAPSI.lastState) { + AP.trigger(triggerEvent); + _CACHE.getBAPSI.lastState = state; + } + } + } + }; + /** + * JSAPI å¼‚æ¥æŽ¥å£åˆ—è¡¨ï¼Œä¸‹é¢æ˜¯åˆ—表ä¸å…·ä½“代ç 结构的说明 + * @type {Object} + * + * @String m => mapping JSAPI åç§°æ˜ å°„ï¼Œå³å¯¹åº”çš„ AlipayJSBridge 的接å£å,方便直接改å + * @Object e => extra JSAPI 扩展信æ¯ï¼Œæ–¹ä¾¿è¿½åŠ è‡ªå®šä¹‰æ ‡è¯† + * handleResultSuccess: Boolean 是å¦å¤„ç† success å—æ®µ + * handleEventData: Boolean 是å¦å¤„ç†äº‹ä»¶æºå¸¦çš„æ•°æ®ï¼Œå³è¿‡æ»¤æŽ‰ event 对象åªè¿”回 data + * optionModifier: Function 对原有 option å…¥å‚åšè¿›ä¸€æ¥å¤„ç† + * + * @Function b => before(opt, cb) å‰ç½®å¤„ç†ï¼Œå¤„ç†å…¥å‚ + * @param {Object} opt 原始入å‚ï¼Œå…¶ä¸ opt._ æ˜¯è°ƒç”¨æŽ¥å£æ—¶å¯ç›´æŽ¥ä¼ 入的æŸä¸ªå‚æ•° + * @return {Object} 处ç†è¿‡çš„å…¥å‚ + * @Function d => doing(_opt, cb, opt) 代替执行,代替原有 api 直接执行,会忽略 AlipayJSBridge.call æŽ¥å£ + * @param {Object} opt åŽŸå§‹å…¥å‚ + * @param {Object} _opt before 处ç†è¿‡çš„å…¥å‚ + * @param {Function} cb 接å£å›žè°ƒå‡½æ•°ï¼Œå·²åœ¨ AP.call ä¸å¤„ç†ï¼Œæ‰€ä»¥æ¤å¤„一定是一个 Function æ— éœ€åˆ¤æ– + * @Function a => after(res, _opt, opt) åŽç½®å¤„ç†ï¼Œå¤„ç†å‡ºå‚ï¼Œå³æŽ¥å£è¿”回给回调函数的值 + * @param {Object} opt åŽŸå§‹å…¥å‚ + * @param {Object} _opt ç» before 处ç†è¿‡çš„å…¥å‚ + * @param {Object} res JSAPI 接å£çš„原始返回值 + * @return {Object} 处ç†è¿‡çš„æŽ¥å£è¿”回值 + * + */ + var _JSAPI = { + /************************* alipayjsapi-inc 内部接å£ï¼Œä¸‹ä¸ºå ä½ç¬¦ï¼Œå¤–部å‘å¸ƒæ—¶ä¼šè¢«åˆ é™¤ *************************/ + + + /** + * 新版è“ç‰™ç›¸å…³æŽ¥å£ + */ + openBluetoothAdapter: {}, + closeBluetoothAdapter: {}, + getBluetoothAdapterState: {}, + startBluetoothDevicesDiscovery: { + b: function b(opt) { + if (__isString(opt._)) { + opt._ = [opt._]; + } + _mapping(opt, { + _: 'services' + }); + return opt; + } + }, + stopBluetoothDevicesDiscovery: {}, + getBluetoothDevices: { + b: function b(opt) { + if (__isString(opt._)) { + opt._ = [opt._]; + } + _mapping(opt, { + _: 'services' + }); + return opt; + }, + a: function a(res) { + if (__isArray(res.devices)) { + __forEach(res.devices, function (key, val) { + _mapping(val, { + manufacturerData: 'advertisData' + }); + }); + } + + return res; + } + }, + getConnectedBluetoothDevices: { + a: function a(res) { + if (__isArray(res.devices)) { + __forEach(res.devices, function (key, val) { + _mapping(val, { + manufacturerData: 'advertisData' + }); + }); + } + + return res; + } + }, + connectBLEDevice: { + b: function b(opt) { + _mapping(opt, { + _: 'deviceId' + }); + return opt; + } + }, + disconnectBLEDevice: {}, + writeBLECharacteristicValue: {}, + readBLECharacteristicValue: {}, + notifyBLECharacteristicValueChange: {}, + getBLEDeviceServices: { + b: function b(opt) { + _mapping(opt, { + _: 'deviceId' + }); + return opt; + } + }, + getBLEDeviceCharacteristics: {}, + onBLECharacteristicValueChange: { + //真æ£çš„事件åï¼Œä¼šæŠŠé¦–å—æ¯è‡ªåŠ¨è½¬æˆå°å†™ï¼Œå› æ¤è¿™é‡Œä½¿ç”¨ map å¯é¿å…这个问题 + m: 'BLECharacteristicValueChange' + + }, + offBLECharacteristicValueChange: { + m: 'BLECharacteristicValueChange' + }, + onBluetoothAdapterStateChange: {}, + offBluetoothAdapterStateChange: {}, + onBLEConnectionStateChanged: { + m: 'BLEConnectionStateChanged' + + }, + offBLEConnectionStateChanged: { + m: 'BLEConnectionStateChanged' + }, + onBluetoothDeviceFound: { + a: function a(res) { + return _mapping(res, { + manufacturerData: 'advertisData' + }); + } + }, + offBluetoothDeviceFound: {}, + /** + * end 新版è“ç‰™ç›¸å…³æŽ¥å£ + */ + + pushBizWindow: {}, + compressImage: { + b: function b(opt) { + opt.level = __isUndefined(opt.level) ? 4 : opt.level; + return _mapping(opt, { + _: 'apFilePaths', + level: 'compressLevel%d' + }); + }, + d: function d(_opt, cb) { + if (__isAndroid()) { + _JS_BRIDGE.call('compressImage', _opt, cb); + } else { + _fakeCallBack(cb, { + apFilePaths: _opt.apFilePaths || [] + }); + } + } + }, + + /** + * 获å–å¯åЍ傿•°ï¼Œå¹¶è®°å½•在 AP.launchParams + * @method getLaunchParams + * @param {String} null + * @param {Function} fn 回调 + */ + getLaunchParams: { + d: function d(opt, cb) { + AP.launchParams = window.ALIPAYH5STARTUPPARAMS || _JS_BRIDGE.startupParams || {}; + if (__isFunction(cb)) { + cb(AP.launchParams); + } + } + }, + //旧版è“牙接å£ç§»é™¤ + + onTabClick: {}, + offTabClick: {}, + onShare: { + m: 'onShare' + + }, + offShare: { + m: 'onShare' + }, + connectSocket: { + b: function b(opt) { + return _mapping(opt, { + headers: 'header' + }); + } + }, + sendSocketMessage: { + b: function b(opt) { + return _mapping(opt, { + _: 'data' + }); + } + }, + closeSocket: {}, + onSocketOpen: {}, + offSocketOpen: {}, + onSocketMessage: {}, + offSocketMessage: {}, + onSocketError: {}, + offSocketError: {}, + onSocketClose: {}, + offSocketClose: {}, + + ////////////////////////////// [AlipayJSAPI/ui] //////////////////////////// + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.content) + * 统一 alert å’Œ confirm çš„å†…å®¹å—æ®µä¸º content + */ + alert: { + b: function b(opt) { + opt = _mapping(opt, { + _: 'content', + content: 'message%s', + buttonText: 'button%s' + }); + if (!__isUndefined(opt.title)) { + opt.title = _toType('%s', opt.title); + } + return opt; + } + }, + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.content) + * 统一 alert å’Œ confirm çš„å†…å®¹å—æ®µä¸º content + */ + confirm: { + b: function b(opt) { + opt = _mapping(opt, { + _: 'content%s', + content: 'message%s', + confirmButtonText: 'okButton%s', + cancelButtonText: 'cancelButton%s' + }); + if (!__isUndefined(opt.title)) { + opt.title = _toType('%s', opt.title); + } + return opt; + }, + a: function a(res) { + return _mapping(res, { + ok: 'confirm' //更改之å‰è¿”回值里的 ok 为 confirm + }); + } + }, + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.content) + */ + showToast: { + m: 'toast', + b: function b(opt) { + //toast 内容嗿®µæœ¬æ¥å°±æ˜¯ content + _mapping(opt, { + _: 'content%s' + }); + if (!__isString(opt.content)) { + opt.content = _toType('%s', opt.content); + } + //opt.duration = opt.duration || 2000; + return opt; + } + }, + hideToast: {}, + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.content) + * æŽ¥å£æ”¹é€ opt.content => opt.text + */ + showLoading: { + b: function b(opt) { + return _mapping(opt, { + _: 'content', // %s 没必è¦åŠ ç»™ content, + content: 'text%s' // å› ä¸ºæœ€åŽè°ƒç”¨æŽ¥å£æ—¶çœŸæ£å…¥å‚是 text + }); + } + }, + hideLoading: {}, + showNavigationBarLoading: { + m: 'showTitleLoading' + }, + hideNavigationBarLoading: { + m: 'hideTitleLoading' + }, + /** + * æ•´åˆäº† setTitle, setTitleColor, setBarBottomLineColor ä¸‰ä¸ªæŽ¥å£ + * @type {Object} + */ + setNavigationBar: { + b: function b(opt) { + // JSAPI å称太长åˆå¤šæ¬¡å¼•用,ä¸åˆ©äºŽä»£ç 压缩,固å•独记录 + var st = 'setTitle'; + var stc = 'setTitleColor'; + var sblc = 'setBarBottomLineColor'; + var _opt = {}; + + _opt[st] = {}; + _opt[stc] = {}; + _opt[sblc] = {}; + + // æ˜ å°„ä¸åŒ JSAPI çš„å…¥å‚ + _opt[st] = _mapping(_opt[st], { + _: 'title', //接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.title) + title: 'title%s', + image: 'image%b' //å¤„ç† image 为 base64 的情况,为 native ç§»é™¤æ ¼å¼å¤´ + }, opt); + _opt[stc] = _mapping(_opt[stc], { + backgroundColor: 'color%c', + reset: 'reset' + }, opt); + _opt[sblc] = _mapping(_opt[sblc], { + borderBottomColor: 'color%c' + }, opt); + + return _opt; + }, + d: function d(_opt, cb) { + var st = 'setTitle'; + var stc = 'setTitleColor'; + var sblc = 'setBarBottomLineColor'; + var res = {}; + //setTitle + if (!__isEmptyObject(_opt[st])) { + _JS_BRIDGE.call(st, _opt[st]); + } + //setBarBottomLineColor + if (!__isEmptyObject(_opt[sblc])) { + _JS_BRIDGE.call(sblc, _opt[sblc]); + if (__isNaN(_opt[sblc].color)) { + res.error = 2; + res.errorMessage = '颜色值ä¸åˆæ³•'; + } + } + //setTitleColor + if (!__isEmptyObject(_opt[stc])) { + _JS_BRIDGE.call(stc, _opt[stc], function (result) { + res = __extend(result, res); + cb(res); + }); + } else { + //setTitle å’Œ setBarBottomLineColor 本身没有回调 + //ä¸ºä¿æŒæŽ¥å£ä¸€è‡´æ€§è¦æ¨¡æ‹Ÿä¸€ä¸ªå¼‚æ¥å›žè°ƒ + _fakeCallBack(cb, res); + } + } + }, + showTabBar: { + b: function b(opt) { + //创建 tabBar + opt.action = 'create'; + //默认激活第一个 tab + opt.activeIndex = opt.activeIndex || 0; + //å…¶ä»–å±žæ€§æ˜ å°„ + _mapping(opt, { + color: 'textColor%c', + activeColor: 'selectedColor%c', + activeIndex: 'selectedIndex%d' + }); + + if (__isArray(opt.items)) { + var items = opt.items; + //需è¦å¤åˆ¶ä¸€ä»½ï¼Œä¸èƒ½åœ¨åŽŸæ•°ç»„ä¸Šä¿®æ”¹ï¼Œä¼šç ´åç”¨æˆ·æ•°æ® + opt.items = []; + items.forEach(function (item, i) { + item = _mapping(__extend({}, item), { + title: 'name%s', + tag: 'tag%s', + icon: 'icon%b', + activeIcon: 'activeIcon%b', + badge: 'redDot%s' + }, { + tag: i, + // title: item.title, + // icon: item.icon, + // activeIcon: item.activeIcon, + badge: __isUndefined(item.badge) ? '-1' : item.badge + }); + item.icon = _toType('%b', item.icon); + item.activeIcon = _toType('%b', item.activeIcon); + opt.items.push(item); + }); + } + return opt; + }, + d: function d(_opt, cb, opt) { + var apiName = 'showTabBar'; + if (!__isUndefined(_CACHE.showTabBar)) { + console.error(apiName + ' must be called at most once'); + } else { + _CACHE.showTabBar = { + opt: opt + }; + } + //监å¬ç‚¹å‡»äº‹ä»¶ + AP.on('tabClick', function (evt) { + var res = {}; + _mapping(res, { + tag: 'index%d' + }, { + tag: __isObject(evt.data) && evt.data.tag ? evt.data.tag : '0' + }); + cb(res); + }); + //调用方法 + _JS_BRIDGE.call('tabBar', _opt, function (result) { + //result å¹¶éžçœŸæ£çš„返回值,但是è¦å¤„ç†æŽ¥å£é”™è¯¯ + _handleApiError(apiName, result); + }); + } + }, + setTabBarBadge: { + m: 'tabBar', + b: function b(opt) { + opt.action = 'redDot'; + _mapping(opt, { + index: 'tag%s', + badge: 'redDot%s' + }, { + index: opt.index + }); + return opt; + } + }, + showActionSheet: { + m: 'actionSheet', + b: function b(opt) { + _mapping(opt, { + items: 'btns', + cancelButtonText: 'cancelBtn%s' + }); + //æŠŠæŒ‰é’®å—æ®µè½¬æˆå—符串,éžå—符串会导致钱包闪退 + if (__isArray(opt.btns)) { + var btns = opt.btns; + opt.btns = []; + btns.forEach(function (item) { + return opt.btns.push(item + ''); + }); + } + //æŠŠå–æ¶ˆæŒ‰é’®å—段转æˆå—符串,éžå—符串会导致 actionSheet å…¨å± + if (__isUndefined(opt.cancelBtn)) { + opt.cancelBtn = 'å–æ¶ˆ'; + } + + return opt; + }, + a: function a(res, _opt) { + if (__isArray(_opt.btns) && res.index === _opt.btns.length) { + res.index = -1; + } + return res; + } + }, + redirectTo: { + /** + * å¢žåŠ opt.data 作为 queryString 拼在 url åŽé¢ + */ + b: function b(opt) { + //ç›´æŽ¥ä¼ å…¥ä¸€ä¸ªå—符串时当作 opt.url 傿•° + _mapping(opt, { + _: 'url' + }); + //如果有 data 傿•°åˆ™æž„é€ æœ‰ queryString çš„ url + if (__isObject(opt.data)) { + opt.url = __buildUrl(opt.url, opt.data); + } + return opt; + }, + d: function d(_opt) { + if (_opt.url) { + window.location.replace(_opt.url); + } + } + }, + pushWindow: { + /** + * å¢žåŠ opt.data 作为 queryString 拼在 url åŽé¢ + */ + b: function b(opt) { + //ç›´æŽ¥ä¼ å…¥ä¸€ä¸ªå—符串时当作 opt.url 傿•° + _mapping(opt, { + _: 'url', + params: 'param' + }); + if (opt.url.indexOf('?') > -1) { + console.warn('try opt.' + 'data' + ' instead of querystring'); + } + if (opt.url.indexOf('__webview_options__') > -1) { + console.warn('try opt.' + 'params' + ' instead of ' + '__webview_options__'); + } + //如果有 data 傿•°åˆ™æž„é€ æœ‰ queryString çš„ url + if (__isObject(opt.data)) { + opt.url = __buildUrl(opt.url, opt.data); + delete opt.data; + } + return opt; + } + }, + popWindow: { + b: function b(opt) { + opt = _fixOptData(opt); + if (!__isObject(opt.data)) { + opt.data = { + ___forResume___: opt.data + }; + } + return opt; + } + }, + popTo: { + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个数å—(opt.index)或者一个å—符串(opt.urlPattern) + */ + b: function b(opt) { + _mapping(opt, { + _: function () { + var key = void 0; + if (__isNumber(opt._)) { + key = 'index'; + } + if (__isString(opt._)) { + key = 'urlPattern'; + } + return key; + }() + }); + if (!__isObject(opt.data)) { + opt.data = { + ___forResume___: opt.data + }; + } + return opt; + } + }, + allowPullDownRefresh: { + d: function d(opt) { + var onPDR = 'onPullDownRefresh'; + _mapping(opt, { + _: 'allow' + }); + opt.allow = __isUndefined(opt.allow) ? true : !!opt.allow; + + if (__isObject(_CACHE[onPDR])) { + _CACHE[onPDR].allow = opt.allow; + } else { + _CACHE[onPDR] = { + allow: opt.allow + }; + //监å¬äº‹ä»¶ï¼Œé€šè¿‡ event.preventDefault() 阻æ¢ä¸‹æ‹‰åˆ·æ–° + //满足用户在没有监å¬äº‹ä»¶çš„æƒ…况下调用 AP.allowPullDownRefresh(false) ä»ç„¶ç”Ÿæ•ˆ + AP.onPullDownRefresh(); + } + if (_CACHE[onPDR].allow) { + _JS_BRIDGE.call('restorePullToRefresh'); + } else { + if (_CACHE[onPDR].event) { + _CACHE[onPDR].event.preventDefault(); + } + } + } + }, + + choosePhoneContact: { + m: 'contact' + }, + /** + * 最多选择10个è”系人,åªéœ²å‡º count 傿•°ï¼Œå…¶ä»–å±è”½ + */ + chooseAlipayContact: { + m: 'chooseContact', + b: function b(opt) { + var multi = 'multi'; + var single = 'single'; + _mapping(opt, { + _: 'count' + }); + if (__isUndefined(opt.count)) { + opt.count = 1; + } + if (opt.count === 1) { + opt.type = single; + } else { + opt.type = multi; + if (opt.count <= 0 || opt.count > 10) { + opt.multiMax = 10; + } else { + opt.multiMax = opt.count; + } + } + delete opt.count; + return opt; + }, + a: function a(res) { + if (__isArray(res.contacts)) { + res.contacts.forEach(function (contact) { + _mapping(contact, { + headImageUrl: 'avatar', + name: 'realName' + }); + delete contact.from; + }); + } + return res; + } + }, + share: { + b: function b(opt) { + var startShareOpt = {}; + var shareToChannelOpt = {}; + startShareOpt.onlySelectChannel = ['ALPContact', 'ALPTimeLine', 'ALPCommunity', 'Weibo', 'DingTalkSession', 'SMS', 'Weixin', 'WeixinTimeLine', 'QQ', 'QQZone']; + if (__hasOwnProperty(opt, 'bizType')) { + startShareOpt.bizType = opt.bizType; + } + + shareToChannelOpt = __extend({}, opt); + delete shareToChannelOpt.bizType; + delete shareToChannelOpt.onlySelectChannel; + _mapping(shareToChannelOpt, { + image: 'imageUrl' + }); + + _CACHE.share = { + startShare: startShareOpt, + shareToChannel: shareToChannelOpt + }; + return opt; + }, + d: function d(opt, cb) { + //éšè—第二行 + if (opt.showToolBar === false) { + _JS_BRIDGE.call('setToolbarMenu', { + menus: [], + override: true + }); + } + //å”¤èµ·åˆ†äº«é¢æ¿ + _JS_BRIDGE.call('startShare', _CACHE.share.startShare, function (info) { + var stcOpt = _CACHE.share.shareToChannel; + if (info.channelName) { + _JS_BRIDGE.call('shareToChannel', { + name: info.channelName, + param: stcOpt + }, cb); + } else { + cb(info); + } + }); + } + }, + datePicker: { + b: function b(opt) { + _mapping(opt, { + _: 'formate', + formate: 'mode', + currentDate: 'beginDate', + startDate: 'minDate', + endDate: 'maxDate' + }); + switch (opt.mode) { + case 'HH:mm:ss': + opt.mode = 0; + break; + case 'yyyy-MM-dd': + opt.mode = 1; + break; + case 'yyyy-MM-dd HH:mm:ss': + opt.mode = 2; + break; + default: + opt.mode = 1; + } + return opt; + }, + a: function a(res) { + if (__isString(res.date)) { + //è¿”å›žæ ¼å¼ä¸ºyyyy-MM-dd + res.date = res.date.replace(/\//g, '-').trim(); + } + // if (res.error === 2 ) { + // const currentDate = _opt.currentDate || Date.now(); + // const startDate = _opt.startDate; + // } + return res; + } + }, + chooseCity: { + m: 'getCities', + b: function b(opt) { + var customCities; + var customHotCities; + _mapping(opt, { + showHotCities: 'needHotCity', + cities: 'customCities', + hotCities: 'customHotCities' + }); + //显示定ä½åŸŽå¸‚ + if (opt.showLocatedCity === true) { + opt.currentCity = ''; + opt.adcode = ''; + } else { + delete opt.currentCity; + delete opt.adcode; + } + delete opt.showLocatedCity; + + //自定义城市 + customCities = opt.customCities; + if (!__isUndefined(opt.customCities)) { + opt.customCities = mapArray(customCities); + } + //自定义çƒé—¨åŸŽå¸‚ + customHotCities = opt.customHotCities; + if (!__isUndefined(opt.customHotCities)) { + opt.customHotCities = mapArray(customHotCities); + } + + function mapArray(arr) { + var tempArr; + if (__isArray(arr)) { + tempArr = []; + arr.forEach(function (city) { + tempArr.push(_mapping({}, { + city: 'name', + adCode: 'adcode%s', + spell: 'pinyin' + }, city)); + }); + arr = tempArr; + } + return arr; + } + + return opt; + }, + a: function a(res) { + _mapping(res, { + adcode: 'adCode' + }); + return res; + } + }, + + ////////////////////////////// 事件 ///////////////////////////////// + onBack: { + a: function a(evt) { + var res = {}; + var onBack = 'onBack'; + if (__isObject(_CACHE[onBack])) { + _CACHE[onBack].event = evt; + } else { + _CACHE[onBack] = { + event: evt, + allowButton: true + }; + } + if (_CACHE[onBack].allowButton === false) { + evt.preventDefault(); + } + res.backAvailable = _CACHE[onBack].allowButton; + return res; + }, + + e: { + handleEventData: false + } + }, + offBack: {}, + + onResume: { + a: function a(evt) { + var res = {}; + if (!__isUndefined(evt.data)) { + res.data = evt.data; + } + if (__hasOwnProperty(evt.data, '___forResume___')) { + res.data = evt.data.___forResume___; + } + return res; + }, + + e: { + handleEventData: false + } + }, + offResume: {}, + + onPause: {}, + offPause: {}, + + onPageResume: { + a: function a(evt) { + var res = {}; + if (!__isUndefined(evt.data)) { + res.data = evt.data; + } + if (__hasOwnProperty(evt.data, '___forResume___')) { + res.data = evt.data.___forResume___; + } + return res; + }, + + e: { + handleEventData: false + } + }, + offPageResume: {}, + onPagePause: {}, + offPagePause: {}, + + onTitleClick: {}, + offTitleClick: {}, + + //onSubTitleClick: {}, + onPullDownRefresh: { + m: 'firePullToRefresh', + a: function a(evt) { + var res = {}; + var onPDR = 'onPullDownRefresh'; + if (__isObject(_CACHE[onPDR])) { + _CACHE[onPDR].event = evt; + } else { + _CACHE[onPDR] = { + event: evt, + allow: true + }; + } + if (_CACHE[onPDR].allow === false) { + _CACHE[onPDR].event.preventDefault(); + } + res.refreshAvailable = _CACHE[onPDR].allow; + return res; + }, + + e: { + handleEventData: false + } + }, + offPullDownRefresh: { + m: 'firePullToRefresh' + }, + + onNetworkChange: { + d: function d(_opt, _cb, opt, cb) { + //直接调用一次 getNetworkType å回当å‰ç½‘ç»œçŠ¶æ€ + var handler = function handler() { + return AP.getNetworkType(_cb); + }; + _cacheEventHandler('h5NetworkChange', cb, handler); + AP.on('h5NetworkChange', handler); + } + }, + offNetworkChange: { + d: function d(_opt, _cb, opt, cb) { + _removeEventHandler('h5NetworkChange', cb); + } + }, + onAccelerometerChange: { + b: function b() { + _JS_BRIDGE.call('watchShake', { monitorAccelerometer: true }); + }, + a: function a(evt) { + var res = {}; + _mapping(res, { + x: 'x', + y: 'y', + z: 'z' + }, __isObject(evt.data) ? evt.data : evt); + return res; + }, + + e: { + handleEventData: false + } + }, + offAccelerometerChange: { + b: function b() { + _JS_BRIDGE.call('watchShake', { monitorAccelerometer: false }); + } + }, + onCompassChange: { + b: function b() { + _JS_BRIDGE.call('watchShake', { monitorCompass: true }); + }, + a: function a(evt) { + var res = {}; + _mapping(res, { + direction: 'direction' + }, __isObject(evt.data) ? evt.data : evt); + return res; + }, + + e: { + handleEventData: false + } + }, + offCompassChange: { + b: function b() { + _JS_BRIDGE.call('watchShake', { monitorCompass: false }); + } + }, + + onBackgroundAudioPlay: { + b: function b(opt) { + _CACHE.getBAPSI.on(); + return opt; + } + }, + offBackgroundAudioPlay: {}, + + onBackgroundAudioPause: { + b: function b(opt) { + _CACHE.getBAPSI.on(); + return opt; + } + }, + offBackgroundAudioPause: {}, + + onBackgroundAudioStop: { + b: function b(opt) { + _CACHE.getBAPSI.on(); + return opt; + } + }, + offBackgroundAudioStop: {}, + + onAppResume: {}, + offAppResume: {}, + onAppPause: {}, + offAppPause: {}, + + ///////////////////////////// device ///////////////////////////// + getNetworkType: { + a: function a(res) { + if (!__isUndefined(res.networkInfo)) { + res.networkType = __tuc(res.networkInfo); + } + //æ— éœ€è¿™ä¹ˆå¤šå—æ®µ + delete res.err_msg; + delete res.networkInfo; + return res; + } + }, + scan: { + b: function b(opt) { + _mapping(opt, { + _: 'type' + }); + opt.type = opt.type || 'qr'; + return opt; + }, + a: function a(res) { + if (res.qrCode || res.barCode) { + res.code = res.qrCode || res.barCode; + delete res.qrCode; + delete res.barCode; + } + + return res; + } + }, + watchShake: { + b: function b(opt) { + //用户真æ£ä½¿ç”¨æ¤æŽ¥å£æ—¶ä¸éœ€è¦ä¼ 入任何傿•° + //移除所有入å‚,入å‚è¢«ä¼ æ„Ÿå™¨äº‹ä»¶ç›‘å¬å¼€å…³å 用 + //如果有入å‚,ios ä¸ä¼šè°ƒç”¨å›žè°ƒï¼Œandroid 会直接调用回调。 + if (__isEmptyObject(opt)) { + opt = null; + } + return opt; + } + }, + getLocation: { + b: function b(opt) { + _mapping(opt, { + accuracy: 'horizontalAccuracy', + type: 'requestType%d' + }); + if (__isUndefined(opt.requestType)) { + opt.requestType = 2; + } + if (__isAndroid()) { + if (__isUndefined(opt.isHighAccuracy)) { + opt.isHighAccuracy = true; + } + if (__isUndefined(opt.isNeedSpeed)) { + opt.isNeedSpeed = true; + } + } + return opt; + }, + a: function a(res) { + _mapping(res, { + citycode: 'cityCode', + adcode: 'adCode' + }); + if (__isUndefined(res.city) && res.province) { + res.city = res.province; + } + if (res.latitude) { + res.latitude = _toType('%s', res.latitude); + } + if (res.longitude) { + res.longitude = _toType('%s', res.longitude); + } + if (res.accuracy) { + res.accuracy = _toType('%f', res.accuracy); + } + if (res.speed) { + res.speed = _toType('%f', res.speed); + } + return res; + } + }, + getSystemInfo: { + a: function a(res) { + var pixelRatio = 'pixelRatio'; + var windowWidth = 'windowWidth'; + var windowHeight = 'windowHeight'; + var language = 'language'; + if (!__hasOwnProperty(res, 'error')) { + res[pixelRatio] = _toType('%f', res[pixelRatio]); + res[windowWidth] = _toType('%d', res[windowWidth]); + res[language] = (res[language] || '').replace(/\s?\w+\/((?:\w|-)+)$/, '$1'); + res[windowHeight] = _toType('%d', res[windowHeight]); + try { + if (__isIOS() && AP.compareVersion('10.0.12') < 0) { + res[windowHeight] = window.screen.height - 64; + } + } catch (err) {} + } + return res; + } + }, + vibrate: {}, + getServerTime: {}, + + /////////////////////////// media ////////////////////////// + previewImage: { + m: 'imageViewer', + /** + * æŽ¥å£æ”¹é€ opt.current => opt.init + * opt.urls => opt.images + * 默认支æŒç›´æŽ¥ä¼ 入一个数组作为 opt.urls + */ + b: function b(opt) { + _mapping(opt, { + _: 'urls', + current: 'init%d' + }); + //处ç†é»˜è®¤ç´¢å¼• + if (__isUndefined(opt.init)) { + opt.init = 0; + } + //处ç†å›¾ç‰‡é“¾æŽ¥ + opt.images = []; + (opt.urls || []).forEach(function (url) { + opt.images.push({ + u: url + }); + }); + delete opt.urls; + + return opt; + } + }, + chooseImage: { + b: function b(opt) { + _mapping(opt, { + _: 'count%d' + }); + if (__isUndefined(opt.count)) { + opt.count = 1; + } + if (__isString(opt.sourceType)) { + opt.sourceType = [opt.sourceType]; + } + return opt; + }, + a: function a(res) { + _mapping(res, { + errorCode: 'error', + errorDesc: 'errorMessage', + localIds: 'apFilePaths', + tempFilePaths: 'apFilePaths' + }); + //åˆ é™¤æ— ç”¨å±žæ€§ + delete res.scene; + delete res.localIds; + delete res.tempFilePaths; + + //android 返回å—符串 + if (__isString(res.apFilePaths)) { + res.apFilePaths = __parseJSON(res.apFilePaths); + } + + return res; + } + }, + chooseVideo: { + b: function b(opt) { + _mapping(opt, { + _: 'maxDuration%d' + }); + if (__isString(opt.sourceType)) { + opt.sourceType = [opt.sourceType]; + } + if (__isString(opt.camera)) { + opt.camera = [opt.camera]; + } + return opt; + }, + a: function a(res) { + _mapping(res, { + errorCode: 'error', //android errorCode + errorDesc: 'errorMessage', // android errorDesc + msg: 'errorMessage', // ios msg + localId: 'apFilePath', + tempFilePath: 'apFilePath', + tempFile: 'apFilePath' + }); + //åˆ é™¤æ— ç”¨å±žæ€§ + delete res.localId; + delete res.tempFilePath; + delete res.tempFile; + + switch (res.error) { + case 0: + //ios æˆåŠŸ + delete res.error; + break; + case 1: + //ios 傿•°å‡ºé”™ + res.error = 2; //é€šç”¨å‚æ•°æ— 效 + break; + case 2: + //ios ç”¨æˆ·å–æ¶ˆ + res.error = 10; //android ç”¨æˆ·å–æ¶ˆ + break; + case 3: + //ios æ“作失败 + res.error = 11; //android æ“作失败 + break; + case 4: + //ios æ•°æ®å¤„ç†å¤±è´¥ + res.error = 12; + break; + default: + } + + return res; + } + }, + uploadFile: { + b: function b(opt) { + _mapping(opt, { + headers: 'header', + fileName: 'name', + fileType: 'type' + }); + if (_isLocalId(opt.filePath)) { + opt.localId = opt.filePath; + delete opt.filePath; + } + return opt; + }, + a: function a(res) { + if (res.error === 2) { + res.error = 11; + } + return res; + } + }, + saveImage: { + b: function b(opt, cb) { + _mapping(opt, { + _: 'url', + url: 'src' + }); + if (__isFunction(cb)) { + opt.cusHandleResult = true; + } + return opt; + } + }, + downloadFile: { + b: function b(opt) { + _mapping(opt, { + headers: 'header' + }); + return opt; + }, + a: function a(res) { + _mapping(res, { + tempFilePath: 'apFilePath', + errorCode: 'error' + }); + delete res.tempFilePath; + return res; + } + }, + + ///////////////////////////////// æ•°æ® //////////////////////////////// + setSessionData: { + b: function b(opt) { + opt = _fixOptData(opt); + if (!__isObject(opt.data)) { + opt.data = { + data: opt.data + }; + } + __forEach(opt.data, function (key, value) { + opt.data[key] = JSON.stringify(value); + }); + return opt; + } + }, + getSessionData: { + b: function b(opt) { + //ç›´æŽ¥ä¼ å…¥ä¸€ä¸ª key + if (__isString(opt._)) { + opt.keys = [opt._]; + } + //ç›´æŽ¥ä¼ å…¥ä¸€ä¸ªæ•°ç»„ + if (__isArray(opt._)) { + opt.keys = opt._; + } + delete opt._; + return opt; + }, + a: function a(res) { + __forEach(res.data, function (key, value) { + res.data[key] = __parseJSON(value); + }); + return res; + } + }, + ////////////////////////////// å¼€æ”¾æŽ¥å£ //////////////////////////////// + startBizService: { + b: function b(opt) { + _mapping(opt, { + _: 'name', + params: 'param%s' + }); + return opt; + } + }, + tradePay: { + b: function b(opt) { + _mapping(opt, { + _: 'orderStr' + }); + return opt; + } + }, + getAuthCode: { + b: function b(opt) { + _mapping(opt, { + _: 'scopes' + }); + if (__isString(opt.scopes)) { + opt.scopeNicks = [opt.scopes]; + } else if (__isArray(opt.scopes)) { + opt.scopeNicks = opt.scopes; + } else { + opt.scopeNicks = ['auth_base']; + } + delete opt.scopes; + + return opt; + }, + a: function a(res) { + _mapping(res, { + authcode: 'authCode' + }); + return res; + } + }, + getAuthUserInfo: { + a: function a(res) { + _mapping(res, { + nick: 'nickName', + userAvatar: 'avatar' + }); + return res; + } + }, + ////////////////////////// v0.1.3+ /////////////////////////////// + openInBrowser: { + /** + * 接å£å¯ç›´æŽ¥ä¼ 入一个å—符串(opt.url) + */ + b: function b(opt) { + return _mapping(opt, { + _: 'url' + }); + } + }, + openLocation: { + b: function b(opt) { + if (__isUndefined(opt.scale)) { + opt.scale = 15; //默认缩放15级 + } + return opt; + } + }, + showPopMenu: { + b: function b(opt) { + //å…¶ä»–å±žæ€§æ˜ å°„ + _mapping(opt, { + _: 'items', + items: 'menus' + }); + + //popMenuClick事件åªç›‘å¬ä¸€æ¬¡ï¼Œé˜²æ¢å¤šæ¬¡å›žè°ƒ + if (__isObject(_CACHE.showPopMenu)) { + _CACHE.showPopMenu.menus = {}; + } else { + _CACHE.showPopMenu = { + menus: {} + }; + } + if (__isArray(opt.menus)) { + var menus = opt.menus; + //需è¦å¤åˆ¶ä¸€ä»½ï¼Œä¸èƒ½åœ¨åŽŸæ•°ç»„ä¸Šä¿®æ”¹ï¼Œä¼šç ´åç”¨æˆ·æ•°æ® + opt.menus = []; + menus.forEach(function (item, i) { + //支æŒèœå•直接是个å—符串数组 + if (__isString(item)) { + item = { + title: item + }; + } + item = _mapping(__extend({}, item), { + title: 'name%s', + tag: 'tag%s', + badge: 'redDot%s' + }, { + tag: i, + title: item.title, + badge: __isUndefined(item.badge) ? '-1' : item.badge + }); + if (!__isUndefined(item.icon)) { + item.icon = _toType('%b', item.icon); + } + opt.menus.push(item); + _CACHE.showPopMenu.menus[item.name] = i; + }); + } + return opt; + }, + d: function d(_opt, cb) { + var apiName = 'showPopMenu'; + if (_CACHE.showPopMenu.onEvent !== true) { + _CACHE.showPopMenu.onEvent = true; + //监å¬ç‚¹å‡»äº‹ä»¶ + AP.on('popMenuClick', function (evt) { + var res = {}; + _mapping(res, { + title: 'index%d' + }, { + title: __isObject(evt.data) && evt.data.title ? _CACHE.showPopMenu.menus[evt.data.title] : '-1' + }); + cb(res); + }); + } + + //调用方法 + _JS_BRIDGE.call(apiName, _opt, function (result) { + //result å¹¶éžçœŸæ£çš„返回值,但是è¦å¤„ç†æŽ¥å£é”™è¯¯ + _handleApiError(apiName, result); + }); + } + }, + setOptionButton: { + m: 'setOptionMenu', + b: function b(opt) { + if (__isString(opt._)) { + opt.title = opt._; + delete opt._; + } + if (__isArray(opt._)) { + opt.items = opt._; + delete opt._; + } + _mapping(opt, { + items: 'menus', + type: 'iconType', + badge: 'redDot%s' + }); + if (!__isUndefined(opt.icon)) { + opt.icon = _toType('%b', opt.icon); + } + //optionMenu事件åªç›‘å¬ä¸€æ¬¡ï¼Œé˜²æ¢å¤šæ¬¡å›žè°ƒ + if (__isObject(_CACHE.setOptionButton)) { + _CACHE.setOptionButton.menus = []; + } else { + _CACHE.setOptionButton = { + menus: [] + }; + } + if (__isArray(opt.menus)) { + var menus = opt.menus; + //需è¦å¤åˆ¶ä¸€ä»½ï¼Œä¸èƒ½åœ¨åŽŸæ•°ç»„ä¸Šä¿®æ”¹ï¼Œä¼šç ´åç”¨æˆ·æ•°æ® + opt.menus = []; + menus.forEach(function (item, i) { + item = _mapping(__extend({}, item), { + type: 'icontype', + badge: 'redDot%s' + }, { + badge: __isUndefined(item.badge) ? '-1' : item.badge + }); + if (!__isUndefined(item.icon)) { + item.icon = _toType('%b', item.icon); + } + opt.menus.unshift(item); + _CACHE.setOptionButton.menus[menus.length - 1 - i] = i; + }); + if (opt.menus.length > 0 && __isUndefined(opt.override)) { + opt.override = true; + } + } + //æ¯æ¬¡ setOptionMenu è¦æ³¨å†Œæ–°çš„事件 + if (__isFunction(_CACHE.setOptionButton.onEvent)) { + AP.off('optionMenu', _CACHE.setOptionButton.onEvent); + } + if (__isFunction(opt.onClick)) { + var onClick = opt.onClick; + var eventHandler = function eventHandler(evt) { + var index = 0; + var res = {}; + if (__isObject(evt.data) && __isNumber(evt.data.index) && _CACHE.setOptionButton.menus.length > 0) { + index = _CACHE.setOptionButton.menus[evt.data.index]; + } + res.index = _toType('%d', index); + onClick(res); + }; + _CACHE.setOptionButton.onEvent = eventHandler; + //监å¬ç‚¹å‡»äº‹ä»¶ + if (opt.reset !== true) { + AP.on('optionMenu', eventHandler); + } + delete opt.onClick; + } + return opt; + }, + d: function d(_opt, cb) { + _JS_BRIDGE.call('setOptionMenu', _opt, cb); + //iOS 没有回调, 10.0.8 + if (__isIOS()) { + _fakeCallBack(cb, {}); + } + AP.showOptionButton(); + } + }, + showOptionButton: { + m: 'showOptionMenu' + }, + hideOptionButton: { + m: 'hideOptionMenu' + }, + showBackButton: {}, + hideBackButton: {}, + allowBack: { + d: function d(opt) { + var onBack = 'onBack'; + _mapping(opt, { + _: 'allowButton' + }); + opt.allowButton = __isUndefined(opt.allowButton) ? true : !!opt.allowButton; + + if (__isBoolean(opt.allowGesture)) { + _JS_BRIDGE.call('setGestureBack', { + val: opt.allowGesture + }); + } + if (__isObject(_CACHE[onBack])) { + _CACHE[onBack].allowButton = opt.allowButton; + } else { + _CACHE[onBack] = { + allowButton: opt.allowButton + }; + AP.onBack(); + } + if (opt.allowButton === false && _CACHE[onBack].event) { + _CACHE[onBack].event.preventDefault(); + } + } + }, + startRecord: { + m: 'startAudioRecord', + b: function b(opt) { + _mapping(opt, { + maxDuration: 'maxRecordTime%f', + minDuration: 'minRecordTime%f', + bizType: 'business' + }, { + maxDuration: opt.maxDuration || 60, + minDuration: opt.minDuration || 1 + }); + if (__isUndefined(opt.business)) { + opt.business = _MEDIA_BUSINESS; + } + // 10.0.5统一æˆç§’ + // opt.maxRecordTime *= 1000; + // opt.minRecordTime *= 1000; + return opt; + }, + a: function a(res) { + _mapping(res, { + tempFilePath: 'apFilePath', + identifier: 'apFilePath' + }); + return res; + } + }, + stopRecord: { + m: 'stopAudioRecord' + }, + cancelRecord: { + m: 'cancelAudioRecord' + }, + playVoice: { + m: 'startPlayAudio', + b: function b(opt) { + _mapping(opt, { + _: 'filePath', + filePath: 'identifier', + bizType: 'business' + }); + if (__isUndefined(opt.business)) { + opt.business = _MEDIA_BUSINESS; + } + return opt; + }, + a: function a(res) { + _mapping(res, { + identifier: 'filePath' + }); + return res; + } + }, + pauseVoice: { + m: 'pauseAudioPlay' + }, + resumeVoice: { + m: 'resumeAudioPlay' + }, + stopVoice: { + m: 'stopAudioPlay' + }, + makePhoneCall: { + d: function d(opt, cb) { + var url = 'tel:'; + _mapping(opt, { + _: 'number' + }); + url += opt.number; + _JS_BRIDGE.call('openInBrowser', { url: url }, cb); + } + }, + playBackgroundAudio: { + b: function b(opt) { + _mapping(opt, { + _: 'url', + url: 'audioDataUrl%s', + title: 'audioName%s', + singer: 'singerName%s', + describe: 'audioDescribe%s', + logo: 'audioLogoUrl%s', + cover: 'coverImgUrl%s', + bizType: 'business' + }, { + bizType: opt.bizType || _MEDIA_BUSINESS + }); + return opt; + }, + a: function a(res) { + _mapping(res, { + describe: 'errorMessage' + }); + _handleResultSuccess(res, 12, 0); + return res; + } + }, + pauseBackgroundAudio: { + a: function a(res) { + _mapping(res, { + describe: 'errorMessage' + }); + _handleResultSuccess(res, 12, 0); + return res; + } + }, + stopBackgroundAudio: { + a: function a(res) { + _mapping(res, { + describe: 'errorMessage' + }); + _handleResultSuccess(res, 12, 0); + return res; + } + }, + seekBackgroundAudio: { + b: function b(opt) { + _mapping(opt, { + _: 'position', + bizType: 'business' + }, { + bizType: opt.bizType || _MEDIA_BUSINESS + }); + opt.position = _toType('%f', opt.position); + return opt; + }, + a: function a(res) { + _mapping(res, { + describe: 'errorMessage' + }); + _handleResultSuccess(res, 12, 0); + return res; + } + }, + getBackgroundAudioPlayerState: { + a: function a(res) { + _mapping(res, { + audioDataUrl: 'url', + describe: 'errorMessage' + }); + _handleResultSuccess(res, 12, 0); + return res; + } + } + + //////////////////////////// 未开放方法 ////////////////////////////// + + //numInput: {}, + //inputFocus: {}, + //inputBackFill: {}, + //numInputReset: {}, + //inputBlur: {}, + //downloadApp: {}, + //getSwitchControlStatus: {}, + //setToolbarMenu: {}, + + + //uploadImage: {}, ?apFilePath + //downloadImage: {}, ?apFilePath + //saveFile: {}, + //rpc: {}, + //startApp: {}, + //remoteLog: {}, + //getConfig: {}, + //getUserInfo: {}, + //setSharedData: {}, + //getSharedData: {}, + //removeSharedData: {}, + //setClipboard: {}, + //getClipboard: {}, + //login: {}, + //sendSMS: {}, + //isSupportShortCut: {}, + //setShortCut: {}, + //removeShortCut: {}, + //registerSync: {}, + //responseSyncNotify: {}, + //unregisterSync: {}, + //refreshSyncSkey: {}, + //getScreenBrightness: {}, + //setScreenBrightness: {}, + //isInstalledApp: {}, + //getAllContacts: {}, + //preRender: {}, + //finishRender: {}, + //clearRender: {}, + + + //setPullDownText: {}, + //hideTransBack: {}, + //limitAlert: {}, + //startPackage: {}, + //getClientInfo: {}, + //reportData: {}, + //getSceneStackInfo: {}, + //getAppInfo: {}, + //rsa: {}, + //shareToken: {}, + //snapshot: {}, + //getAppToken: {}, + //ping: {}, + //checkJSAPI: {}, + //checkApp: {}, + //commonList: {}, + //beehiveOptionsPicker: {}, + //beehiveGetPOI: {}, + //addEventCal: {}, + //removeEventCal: {}, + //speech: {}, + //selectAddress: {}, + //nfch5plugin: {}, + }; + /********************* AP å¯¹è±¡å…¶ä»–é™æ€å±žæ€§åŠåŒæ¥æ–¹æ³• ************************/ + + //Alipay 缩写 + var AP = { + version: '3.1.1', + ua: _UA, + isAlipay: __inUA(/AlipayClient/), + alipayVersion: function () { + var version = _UA.match(/AlipayClient[a-zA-Z]*\/(\d+(?:\.\d+)+)/); + return version && version.length ? version[1] : ''; + }(), + /////////////////////////////// AP åŒæ¥æ–¹æ³• ///////////////////////////// + /** + * 版本比较 + * @method compareVersion + * @param {String} targetVersion ç›®æ ‡ç‰ˆæœ¬ + * @return {Number} 比较结果,1代表当å‰ç‰ˆæœ¬å¤§äºŽç›®æ ‡ç‰ˆæœ¬ï¼Œ-1相å,相åŒä¸º0 + */ + compareVersion: function compareVersion(targetVersion) { + var alipayVersion = AP.alipayVersion.split('.'); + + targetVersion = targetVersion.split('.'); + for (var i = 0, n1, n2; i < alipayVersion.length; i++) { + n1 = parseInt(targetVersion[i], 10) || 0; + n2 = parseInt(alipayVersion[i], 10) || 0; + if (n1 > n2) return -1; + if (n1 < n2) return 1; + } + return 0; + }, + + /** + * èŽ·å– url ä¸Šçš„å…¨éƒ¨ä¼ å‚并转æˆå¯¹è±¡ + * @method parseQueryString + * @param {String} queryString + * @return {Object} location.search 对应的键值对象 + */ + parseQueryString: function parseQueryString(queryString) { + var result = {}; + var searchStr = queryString || window.location.search; + var bool = { + true: true, + false: false + }; + var kv; + searchStr = searchStr.indexOf('?') === 0 ? searchStr.substr(1) : searchStr; + searchStr = searchStr ? searchStr.split('&') : ''; + for (var i = 0; i < searchStr.length; i++) { + kv = searchStr[i].split('='); + kv[1] = decodeURIComponent(kv[1]); + //Boolean + kv[1] = __isUndefined(bool[kv[1]]) ? kv[1] : bool[kv[1]]; + //Number + //kv[1] = +kv[1] + '' === kv[1] ? +kv[1] : kv[1]; + result[kv[0]] = kv[1]; + } + _apiRemoteLog('parseQueryString'); + return result; + }, + + /** + * å¼€å¯ debug 模å¼ï¼ŒæŽ§åˆ¶å°æ‰“尿ޥå£è°ƒç”¨æ—¥å¿— + * @type {Object} + */ + enableDebug: function enableDebug() { + AP.debug = true; + }, + + + /** + * 绑定全局事件 + * @method on + * @param {String} evts äº‹ä»¶ç±»åž‹ï¼Œå¤šä¸ªäº‹ä»¶ç”¨ç©ºæ ¼åˆ†éš” + * @param {Function} fn 事件回调 + */ + on: function on(evts, fn) { + var isReady = evts === 'ready'; + var isSimple = isReady || evts === 'back'; + + if (isSimple) { + document.addEventListener(isReady ? _JS_BRIDGE_NAME + 'Ready' : evts, fn, false); + } else { + evts = evts.replace(/ready/, _JS_BRIDGE_NAME + 'Ready'); + evts.split(/\s+/g).forEach(function (eventName) { + document.addEventListener(eventName, fn, false); + }); + } + }, + + /** + * ç§»é™¤äº‹ä»¶ç›‘å¬ + * @method off + * @param {String} evt 事件类型 + * @param {Function} fn 事件回调 + */ + off: function off(evt, fn) { + document.removeEventListener(evt, fn, false); + }, + trigger: function trigger(evtName, data) { + var evt = document.createEvent('Events'); + evt.initEvent(evtName, false, true); + evt.data = data || {}; + document.dispatchEvent(evt); + return evt; + }, + + + /** + * ready事件独立方法 + * @method ready + * @param {Function} fn ready 回调 + */ + ready: function ready(fn) { + if (__isSupportPromise()) { + return new Promise(realReady); + } else { + realReady(); + } + + function realReady(resolve) { + if (_isBridgeReady()) { + if (__isFunction(fn)) { + fn(); + } + if (__isFunction(resolve)) { + resolve(); + } + } else { + AP.on('ready', function () { + //é˜²æ¢ jsbridge 晚注入 + _isBridgeReady(); + + if (__isFunction(fn)) { + fn(); + } + if (__isFunction(resolve)) { + resolve(); + } + }); + } + } + }, + + + + /** + * 通用接å£ï¼Œè°ƒç”¨æ–¹å¼ç‰åŒAlipayJSBridge.call + * æ— éœ€è€ƒè™‘readyäº‹ä»¶ï¼Œä¼šè‡ªåŠ¨åŠ å…¥åˆ°å¾…æ‰§è¡Œé˜Ÿåˆ— + * @method call + */ + call: function call() { + var args = __argumentsToArg(arguments); + if (__isSupportPromise()) { + return AP.ready().then(function () { + return new Promise(realCall); + }); + } else { + //å¦‚æžœç›´æŽ¥åŠ åˆ° ready 事件里会有ä¸è§¦å‘调用的情况 + //AP.ready(realCall); + + if (_isBridgeReady()) { + realCall(); + } else { + //ä¿å˜åœ¨å¾…执行队列 + _WAITING_QUEUE.push(args); + } + } + + function realCall(resolve, reject) { + var apiName; + var opt; //原始 option + var cb; //原始 callback + var _opt; //处ç†è¿‡çš„ option + var _cbSFC; //ä¸åŒçжæ€å›žè°ƒ + var _cb; //处ç†è¿‡çš„ callback + var onEvt; + var offEvt; + var doingFn; + var logOpt; + //强制转为 name + object + function å½¢å¼çš„å…¥å‚ + apiName = args[0] + ''; + opt = args[1]; + cb = args[2]; + //å¤„ç† cb å’Œ opt çš„é¡ºåº + if (__isUndefined(cb) && __isFunction(opt)) { + cb = opt; + opt = {}; + } + //æŽ¥å£æœ‰éžå¯¹è±¡å…¥å‚,设为快æ·å…¥å‚ + if (!__isObject(opt) && args.length >= 2) { + //beforeã€doingã€after 方法ä¸ç›´æŽ¥å– opt._ ä½œä¸ºå‚æ•° + opt = { + _: opt + }; + } + //兜底 + if (__isUndefined(opt)) { + opt = {}; + } + + //处ç†å…¥å‚ + _opt = _getApiOption(apiName, opt, cb); + + //获å–回调 + _cbSFC = _getApiCallBacks(apiName, _opt); + + if (__isUndefined(_opt)) { + console.error('please confirm ' + apiName + '.before() returns the options.'); + } + //èŽ·å– api çš„ d 方法 + doingFn = _getApiDoing(apiName); + + //è¾“å‡ºå…¥å‚ + logOpt = __hasOwnProperty(opt, '_') ? opt._ : opt; + _apiLog(apiName, logOpt, _opt); + + //æ˜¯å¦æ˜¯äº‹ä»¶ç›‘å¬ + onEvt = _getApiOnEvent(apiName); + //æ˜¯å¦æ˜¯äº‹ä»¶ç§»é™¤ + offEvt = _getApiOffEvent(apiName); + + //处ç†å›žè°ƒ + _cb = function _cb(res) { + var _res = void 0; + res = res || {}; + + if (onEvt && _getApiExtra(apiName, 'handleEventData') !== false) { + _res = _handleEventData(res); + } + + //处ç†ç»“æžœ + _res = _getApiResult(apiName, _res || res, _opt, opt, cb); + if (__isUndefined(_res)) { + console.error('please confirm ' + apiName + '.after() returns the result.'); + } + //处ç†é”™è¯¯ç + _res = _handleApiError(apiName, _res); + //æ‰“å° debug 日志 + _apiLog(apiName, logOpt, _opt, res, _res); + + if (__hasOwnProperty(_res, 'error') || __hasOwnProperty(_res, 'errorMessage')) { + if (__isFunction(reject)) { + reject(_res); + } + if (__isFunction(_cbSFC.fail)) { + _cbSFC.fail(_res); + } + } else { + if (__isFunction(resolve)) { + resolve(_res); + } + if (__isFunction(_cbSFC.success)) { + _cbSFC.success(_res); + } + } + if (__isFunction(_cbSFC.complete)) { + _cbSFC.complete(_res); + } + //执行用户的回调 + if (__isFunction(cb)) { + cb(_res); + } + }; + + //如果å˜åœ¨ d 直接执行,å¦åˆ™æ‰§è¡Œ AlipayJSBridge.call + if (__isFunction(doingFn)) { + doingFn(_opt, _cb, opt, cb); + } else if (onEvt) { + _cacheEventHandler(onEvt, cb, _cb, _cbSFC); + AP.on(onEvt, _cb); + } else if (offEvt) { + _removeEventHandler(offEvt, cb); + } else { + _JS_BRIDGE.call(_getApiName(apiName), _opt, _cb); + } + _apiRemoteLog(apiName); + } + }, + + /** + * 扩展 JSAPI çš„æŽ¥å£ + */ + extendJSAPI: function extendJSAPI(JSAPI, isInitAP) { + //如果是å—符串,直接当作接å£å + if (!isInitAP && __isString(JSAPI)) { + JSAPI = [JSAPI]; + } + __forEach(JSAPI, function (key) { + var apiName = key; + // 如果是åˆå§‹åŒ–è°ƒç”¨ï¼Œåˆ™æ— éœ€å†æ³¨å†Œåˆ° _JSAPI 对象上 + if (isInitAP !== true) { + var api = JSAPI[apiName]; + //如果接å£å®šä¹‰æ˜¯ä¸€ä¸ª function,å³ä½œä¸º doing 方法 + if (__isFunction(api)) { + api = { + doing: api + }; + } + if (__isString(api)) { + apiName = api; + api = {}; + api[apiName] = {}; + } + + _JSAPI[apiName] = _mapping(_JSAPI[apiName] || {}, { + mapping: 'm', + before: 'b', + doing: 'd', + after: 'a' + }, api); + + if (__isObject(api.extra)) { + _JSAPI[apiName].e = _JSAPI[apiName].e || {}; + _JSAPI[apiName].e = __extend(_JSAPI[apiName].e, api.extra); + } + } + + // TODO: 需è¦éªŒè¯U3æ˜¯å¦æ”¯æŒbind傿•° + // AP[apiName] = AP.call.bind(null, apiName); + AP[apiName] = function () { + return AP.call.apply(null, [apiName].concat(__argumentsToArg(arguments))); + }; + }, true); + } + }; + AP.extendJSAPI.mapping = _mapping; + AP.extendJSAPI.toType = _toType; + + if (!AP.isAlipay) { + console.warn('Run ' + 'alipayjsapi' + '.js in ' + 'Alipay' + ' please!'); + } + /*********************** æ³¨å†Œå¼‚æ¥ JSAPI ***********************/ + + (function () { + // å°† JSAPI 注册到 AP 上 + AP.extendJSAPI(_JSAPI, true); + //ready å…¥å£ + AP.on('ready', function () { + if (!!_WAITING_QUEUE.length) { + next(); + } + function next() { + __raf(function () { + var args = _WAITING_QUEUE.shift(); + AP.call.apply(null, args); + if (_WAITING_QUEUE.length) next(); + }); + } + }); + })(); + /******************JSAPI ç›¸å…³è¾…åŠ©å¤„ç†æ–¹æ³• _ ********************/ + /** + * 是å¦ready + * @method _isBridgeReady + * @return {Boolean} æ˜¯å¦ å¯ä»¥è°ƒç”¨ AlipayJSBridge.call + */ + function _isBridgeReady() { + _JS_BRIDGE = _JS_BRIDGE || self[_JS_BRIDGE_NAME]; + return _JS_BRIDGE && _JS_BRIDGE.call; + } + /** + * 获å–缓å˜ç›¸å…³æŽ¥å£çš„ business + * @method _getStorageBusiness + * @return {String} business + */ + function _getStorageBusiness() { + var href = self && self.location && self.location.href ? self.location.href : ''; + var business = href.replace(/^(http|https):\/\//i, '').split('/')[0]; + return business; + } + /** + * å‡å›žè°ƒï¼Œç”¨äºŽæ²¡æœ‰å®žçŽ°å›žè°ƒçš„æŽ¥å£ + * @param {Function} cb + * @param {Object} arg + */ + function _fakeCallBack(cb, arg) { + setTimeout(function () { + cb(arg); + }, 1); + } + /** + * æ˜¯å¦æ˜¯ localId + * @method _isLocalId + * @param {String} localId 资æºå®šä½ç¬¦ + * @return {Boolean} æ˜¯å¦ localId + */ + function _isLocalId(localId) { + return (/^[a-z0-9|]+$/i.test(localId) + ); + } + /** + * æ˜¯å¦æ˜¯ apFilePath åœ°å€ + * @method _isApFilePath + * @param {String} apFilePath 10.0.2新统一资æºå®šä½ç¬¦ + * @return {Boolean} æ˜¯å¦ apFilePath + */ + // function _isApFilePath(apFilePath) { + // return /^https:\/\/resource\/[a-z0-9|]+\./i.test(apFilePath) + // } + + + /** + * ä¿®å¤æŸä¸ªå¿«æ·å…¥å‚是对象类型 + * @method _fixOptData + * @param {Object} opt å…¥å‚对象 + * @param {String} dataKey å¿«æ·å…¥å‚çš„ key + * @return {Object} 对象 + */ + function _fixOptData(opt, dataKey) { + var objectArg = false; + dataKey = dataKey || 'data'; + if (__hasOwnProperty(opt, '_')) { + //å…¥å‚䏿˜¯ä¸€ä¸ªå¯¹è±¡ + opt[dataKey] = opt._; + delete opt._; + } else { + //入傿˜¯ä¸€ä¸ªå¯¹è±¡ï¼Œä½†å¯èƒ½æœ‰é™¤äº† data 外的其他 key + __forEach(opt, function (key) { + if (key !== dataKey) { + objectArg = true; + } + }); + if (objectArg) { + objectArg = opt; + opt = {}; + opt[dataKey] = objectArg; + } + } + return opt; + } + + /** + * 判æ–äº‹ä»¶æ³¨å†Œç›‘å¬æ˜¯å¦æ˜¯åŒä¸€ä¸ªå›žè°ƒï¼Œå¹¶è¿”回æ¤å›žè°ƒå‡½æ•° + * @method _getSameHandlers + * @param {String} evt 事件å + * @param {Function} cb 相åŒå›žè°ƒå‡½æ•° + * @return {Function / false} æ˜¯å¦æ˜¯å›žè°ƒ + */ + function _getSameHandlers(evt, cb, isRemoveCache) { + var sameHandlers = false; + var sameIndex; + if (!__isUndefined(evt)) { + if (!_CACHE.EVENTS) { + _CACHE.EVENTS = {}; + } + if (!_CACHE.EVENTS[evt]) { + _CACHE.EVENTS[evt] = { + callbacks: [] + }; + } + if (!_CACHE.EVENTS[evt].callbacks) { + _CACHE.EVENTS[evt].callbacks = []; + } + + _CACHE.EVENTS[evt].callbacks.forEach(function (item, i) { + if (item.cb === cb) { + sameHandlers = item; + sameIndex = i; + } + }); + if (isRemoveCache && __isNumber(sameIndex)) { + _CACHE.EVENTS[evt].callbacks.splice(sameIndex, 1); + } + } + return sameHandlers; + } + + function _cacheEventHandler(evt, cb, _cb, _cbSFC) { + var sameCBs = _getSameHandlers(evt, cb); + if (!sameCBs) { + _CACHE.EVENTS[evt].callbacks.push({ + cb: cb, + _cb: _cb, + _cbSFC: _cbSFC + }); + } + } + + function _removeEventHandler(evt, cb) { + var handlers = _getSameHandlers(evt, cb, true); + if (!__isFunction(cb)) { + //移除全部通过 AP.onXXXXæ³¨å†Œçš„ç›‘å¬ + _CACHE.EVENTS[evt].callbacks.forEach(function (item) { + AP.off(evt, item._cb); + }); + _CACHE.EVENTS[evt].callbacks = []; + } else if (handlers) { + AP.off(evt, handlers._cb); + } + } + + /** + * 获å–è¦æ³¨å†Œçš„事件类型 + * @method _getApiOnEvent + * @param {String} apiName API åç§° + * @return {String} äº‹ä»¶ç±»åž‹ï¼Œå¦‚æžœä¸æ˜¯äº‹ä»¶ç±» API 就返回 false + */ + function _getApiOnEvent(apiName) { + return _getApiEvent('on', apiName); + } + + /** + * 获å–è¦ç§»é™¤çš„事件类型 + * @method _getApiOffEvent + * @param {String} apiName 接å£å + * @return {String} äº‹ä»¶ç±»åž‹ï¼Œå¦‚æžœä¸æ˜¯äº‹ä»¶ç±» API 就返回 false + */ + function _getApiOffEvent(apiName) { + return _getApiEvent('off', apiName); + } + + /** + * 获å–事件å + * @method _getApiEvent + * @param {String} prefix å‰ç¼€ + * @param {String} apiName 接å£å + * @return {String} 事件å + */ + function _getApiEvent(prefix, apiName) { + var jsapi = _JSAPI[apiName]; + var evt = false; + var evtApiPattern = prefix === 'off' ? /^off([A-Z])(\w+)/ : /^on([A-Z])(\w+)/; + + // 以 onã€off 开头的 api 是 事件,排除 AP.onã€AP.off 方法 + if (jsapi && evtApiPattern.test(apiName)) { + apiName = apiName.match(evtApiPattern); + evt = jsapi.m; + if (!evt && apiName[1] && apiName[2]) { + evt = __tlc(apiName[1]) + apiName[2]; + } + } + return evt; + } + + /** + * èŽ·å–æŽ¥å£æ‰©å±•å—æ®µ + * @method _getApiExtra + * @param {String} apiName 接å£å + * @param {String} extraKey æ‰©å±•å—æ®µçš„ key + * @return {Any} è¿”å›žç›¸åº”å—æ®µå€¼ + */ + function _getApiExtra(apiName, extraKey) { + var jsapi = _JSAPI[apiName] || {}; + var extra = jsapi.e || jsapi.extra || {}; + return extra[extraKey]; + } + /** + * èŽ·å– opt._,适é…ç›´æŽ¥ä¼ å…¥æŸä¸ªå‚数的场景,å³è°ƒç”¨ api æ—¶ç¬¬äºŒä¸ªå‚æ•°ä¼ å…¥çš„ä¸æ˜¯ Object 的情况 + * @method _getObjArg + * @param {Object} opt AP.call 方法的 opt å…¥å‚ + * @return {any} 一般是 String,默认是 undefined + */ + // function _getObjArg(opt, optTarget) { + // var arg = optTarget; + // if (!__isUndefined(opt._)) { + // arg = opt._; + // delete opt._; + // } + // return arg; + // } + + /** + * èŽ·å– JSAPI æ˜ å°„æŽ¥å£å + * @method _getApiName + * @param {String} apiName AP 接å£å + * @return {String} AlipayJSBridge 接å£å + */ + function _getApiName(apiName) { + var jsapi = _JSAPI[apiName]; + return jsapi && jsapi.m ? jsapi.m : apiName; + } + + /** + * å¤„ç† JSAPI çš„å…¥å‚ + * @method _getApiOption + * @param {String} apiName JSAPI åç§° + * @param {Object} opt JSAPI å…¥å‚ + * @param {Function} cb JSAPI 未处ç†è¿‡çš„回调函数 + * @return {Object} 处ç†è¿‡çš„ opt + */ + function _getApiOption(apiName, opt, cb) { + var jsapi = _JSAPI[apiName]; + var finalOpt = jsapi && jsapi.b ? jsapi.b(__extend({}, opt), cb) : opt; + var modifier = _getApiExtra(apiName, 'optionModifier'); + if (__isFunction(modifier)) { + var modifyOpt = modifier(finalOpt, cb); + if (__isObject(modifyOpt)) { + finalOpt = modifyOpt; + } + } + + return finalOpt; + } + /** + * 获å–ä¸åŒçжæ€å›žè°ƒ + * @method _getApiCallBacks + * @param {String} apiName 接å£å + * @param {Object} opt 接å£å…¥å‚ + * @return {Object} 回调对象 + */ + function _getApiCallBacks(apiName, opt) { + var cb = {}; + opt = opt || {}; + if (__isFunction(opt.success)) { + cb.success = opt.success; + delete opt.success; + } + if (__isFunction(opt.fail)) { + cb.fail = opt.fail; + delete opt.fail; + } + if (__isFunction(opt.complete)) { + cb.complete = opt.complete; + delete opt.complete; + } + return cb; + } + + /** + * èŽ·å– API çš„ doing 函数 + * @method _getApiDoing + * @param {String} apiName API åç§° + * @return {function} doing 函数 + */ + function _getApiDoing(apiName) { + var jsapi = _JSAPI[apiName]; + return jsapi && jsapi.d ? jsapi.d : false; + } + + /** + * å¤„ç† JSAPI çš„å‡ºå‚ + * @method _getApiResult + * @param {String} apiName JSAPI 接å£å + * @param {Object} opt JSAPI åŽŸå§‹å…¥å‚ + * @param {Object} _opt JSAPI before方法 处ç†è¿‡çš„å…¥å‚ + * @param {Object} res JSAPI å‡ºå‚ + * @param {Function} cb JSAPI 未处ç†è¿‡çš„回调函数 + * @return {Object} 处ç†è¿‡çš„ res + */ + function _getApiResult(apiName, res, _opt, opt, cb) { + var jsapi = _JSAPI[apiName]; + var finalRes = jsapi && jsapi.a ? jsapi.a(__isEvent(res) ? res : __extend({}, res), _opt, opt, cb) : __extend({}, res); + var modifier = _getApiExtra(apiName, 'resultModifier'); + if (__isFunction(modifier)) { + var modifyRes = modifier(finalRes, _opt, opt, cb); + if (__isObject(modifyRes)) { + finalRes = modifyRes; + } + } + return finalRes; + } + /** + * 处ç†é”™è¯¯ä¿¡æ¯ï¼Œè½¬æ¢ error å—æ®µä¸º Number 类型 + * @method _handleApiError + * @param {String} apiName 接å£å + * @param {Object} res å‡ºå‚ + * @return {Object} 处ç†è¿‡çš„ res + */ + function _handleApiError(apiName, res) { + //错误ç å¼ºåˆ¶è½¬æˆæ•°å— + if (__hasOwnProperty(res, 'error')) { + res.error = parseInt(res.error, 10); + } + //å¤„ç† success + if (_getApiExtra(apiName, 'handleResultSuccess') !== false) { + _handleResultSuccess(res); + } + //å¤„ç† error: 0 的情况,error 为 0 表示æˆåŠŸ + if (res.error === 0) { + delete res.error; + delete res.errorMessage; + } + + //有些 error ä¸ä»£è¡¨æŽ¥å£å¼‚å¸¸ï¼Œè€Œæ˜¯ç”¨æˆ·å–æ¶ˆæ“作,ä¸åº”è¯¥ç»Ÿä¸€åšæŠ¥é”™æ—¥å¿—ã€‚ + if (res.error > 0 && res.error < 10) { + console.error(apiName, res); + } + return res; + } + /** + * 处ç†ç»“æžœä¸çš„ success å—æ®µ + * @method _handleResultSuccess + * @param {Object} res 接å£è¿”回值 + * @param {Number} errorCode 对应错误ç + * @param {Any} successValue successå—æ®µå¤„ç†å€¼ + * @return {Object} 处ç†åŽçš„ result + */ + function _handleResultSuccess(res, mappingError, successValue) { + successValue = __isUndefined(successValue) ? false : successValue; + if (!__hasOwnProperty(res, 'error') && res.success === successValue) { + res.error = __isNumber(mappingError) ? mappingError : 2; //2 æ˜¯å‚æ•°é”™è¯¯ + } + delete res.success; + return res; + } + + //å–到 data + function _handleEventData(evtObj) { + var data = {}; + if (!__isUndefined(evtObj.data)) { + data = evtObj.data; + data = __isObject(data) ? data : { data: data }; + } + return data; + } + + /** + * 拆分类型键å里真æ£çš„ key 和对应的 type + * @method _separateTypeKey + * @param {String} key å¸¦ç±»åž‹æ ‡è¯†çš„é”®å + * @return {Object} 返回键åå’Œç±»åž‹æ ‡è¯†ä¸¤ä¸ªå—æ®µï¼Œ + * 如{k: 'content', t: '%s'} + */ + function _separateTypeKey(key) { + var matches = (key || '').match(/(\w+)(%\w)$/i); + var tk = { + k: key + }; + if (matches) { + tk.k = matches[1]; + tk.t = matches[2]; + } + return tk; + } + + /** + * æŠŠå€¼è½¬æ¢æˆç›¸åº”类型 + * @method _toType + * @param {String} type ç±»åž‹æ ‡è¯†ï¼Œç›®å‰æ”¯æŒ + * %s(å—符串) + * %c(16转10进制颜色) + * %h(10转16进制颜色) + * %b(移除 base64 æ•°æ®æ ¼å¼å¤´) + * %a{mimeType}(æ·»åŠ base64 æ•°æ®å¤´) + * %d(æ•´æ•°) + * %f(浮点数) + * @param {any} value 待转æ¢å€¼ï¼Œç±»åž‹æœªçŸ¥ + * @return {any} 转æ¢å¥½çš„相应类型的 + */ + function _toType(type, value) { + if (type === '%s') value = __superToString(value); + if (type === '%c') value = __h2dColor(value); + //if (type === '%h') value = __d2hColor(value); + if (type === '%b') value = __removeBase64Head(value); + if (type === '%d') value = parseInt(value, 10); + if (type === '%f') value = parseFloat(value); + return value; + } + /** + * 处ç†å¯¹è±¡æ˜ 射关系 + * @method _mapping + * @param {Object} tObj åŽŸå§‹ç›®æ ‡å¯¹è±¡ + * @param {Object} map æ˜ å°„å…³ç³»ï¼Œå¦‚{content: 'text'}, + * å³æŠŠ sObj.content 的值赋给 tObj.text, + * å¹¶åˆ é™¤ tObj çš„ content 属性, + * 所以 content 就是 sKey,text 就是 tKey。 + * å¯ä»¥æŠŠ map 对象ä¸çš„冒å·(:)ç†è§£æˆ to, + * å³ {content to text}。 + * å…¶ä¸ tKey 的值的最åŽå¯ä»¥åŠ %s ç‰ç±»åž‹æ ‡è¯†è½¬æ¢æˆç›¸åº”类型, + * 注æ„:è¦åŠ åˆ°æœ€åŽèµ‹å€¼ç»™ tObj 的那个 tKey çš„åŽé¢ã€‚ + * è¿™ä¹ˆåšæ˜¯å› 为: + * 有些接å£çš„å…¥å‚å—æ®µç›´æŽ¥ä¼ å…¥éžå—符串值时,接å£å®Œå…¨æ— å“应, + * 比如 AlipayJSBridge.call('alert',{message: 12345}) + * + * @param {Object} sObj å‚ç…§æ¥æºå¯¹è±¡ + * @return {Object} å¤„ç†æ˜ å°„åŽçš„ tObj + */ + function _mapping(tObj, map, sObj) { + var typeKey; + sObj = sObj || {}; + __forEach(map, function (sKey, tKey) { + typeKey = _separateTypeKey(map[sKey]); + //ç›®æ ‡ key + tKey = typeKey.k; + //æ˜ å°„æ¡ä»¶ï¼Œå¦åˆ™ä¸èµ‹å€¼ï¼Œé¿å…æ·»åŠ value 为 undefined çš„ key + if (!__isUndefined(tKey) //ç›®æ ‡ key 定义过 + && (__hasOwnProperty(tObj, sKey) || __hasOwnProperty(sObj, sKey)) //æºæ•°æ®è‡³å°‘有一个有效 + && __isUndefined(tObj[tKey]) //ç›®æ ‡æ•°æ®ç©ºç¼ºå¾…赋值 + ) { + //sKey æ—¢å¯ä»¥æ˜¯ sObj 的,也å¯ä»¥æ˜¯ tObj 自己的,但sObj 优先级高于原始 tObj + //å³ sObj[sKey]的值 会覆盖 tObj[sKey]的值 + //å¹¶ä¸”è¦æ ¹æ® type å ä½ç¬¦åšç›¸åº”ç±»åž‹è½¬æ¢ + tObj[tKey] = _toType(typeKey.t, __isUndefined(sObj[sKey]) ? tObj[sKey] : sObj[sKey]); + // åˆ é™¤åŽŸå§‹ tObj ä¸çš„ sKey,tKey å’Œ sKey åŒåæ—¶ä¸åšåˆ 除 + if (tKey !== sKey) { + delete tObj[sKey]; + } + } + }); + return tObj; + } + /** + * ap 接å£åŸ‹ç‚¹ + * ä¿è¯é˜Ÿåˆ—里有调用记录时æ‰å¯åŠ¨è®¡æ—¶å™¨ï¼Œåšåˆ°ä¸è°ƒç”¨ä¸è®¡æ—¶ + * @param {String} apiName 接å£å + */ + var _apiRemoteLog = function () { + var apiInvokeQueue = []; + var timerId = void 0; + var isTimerActived = false; + //å‘逿—¥å¿— + function triggerSendLog() { + setTimeout(function () { + if (apiInvokeQueue.length > 0) { + var param1 = apiInvokeQueue.join('|'); + AP.ready(function () { + _JS_BRIDGE.call('remoteLog', { + type: 'monitor', + bizType: 'ALIPAYJSAPI', + logLevel: 1, // 1 - high, 2 - medium, 3 - low + actionId: 'MonitorReport', + seedId: 'ALIPAYJSAPI_INVOKE_COUNTER', + param1: param1 + }); + }); + AP.debug && console.info('REMOTE_LOG_QUEUE>', apiInvokeQueue); + apiInvokeQueue = []; + } + // åœæ¢è®¡æ—¶å™¨ + clearTimer(); + }, 0); + } + // 计时器 + function timer() { + // è®¡æ—¶æ¿€æ´»æ ‡è‡´ + isTimerActived = true; + // å¯åŠ¨è®¡æ—¶å™¨ + timerId = setTimeout(function () { + // 日志å‘é€ + triggerSendLog(); + }, 5000); // 5 秒上报 + } + // 清除计时器 + function clearTimer() { + !__isUndefined(timerId) && clearTimeout(timerId); + isTimerActived = false; + } + // back 事件上报日志,作为兜底 + AP.on('back', function () { + triggerSendLog(); + }); + + return function (apiName) { + apiInvokeQueue.push(apiName); + // 6 个上报 + if (apiInvokeQueue.length >= 6) { + triggerSendLog(); + } else if (!isTimerActived) { + timer(); + } + }; + }(); + + function _apiLog() { + var args = __argumentsToArg(arguments); + var apiName; + var opt; + var _opt; + var res; + var _res; + var logs; + if (AP.debug) { + apiName = args[0]; + opt = args[1]; + _opt = args[2]; + res = args[3]; + _res = args[4]; + logs = [args.length > 3 ? 'RETURN>' : 'INVOKE>', apiName, __hasOwnProperty(opt, '_') ? opt._ : opt, _opt]; + if (args.length > 3) { + logs.push(res); + } + if (args.length > 4) { + logs.push(_res); + } + console.info(logs); + } + } + /****************** Util方法 __ ***********************/ + /** + * 是å¦åœ¨ UA ä¸åŒ…嫿Ÿä¸ªå—符串 + * @method _inUA + * @param {String} keyStr ç›®æ ‡å—符串 + * @return {Boolean} 是å¦åŒ…å« + */ + function __inUA(keyPattern) { + return keyPattern.test(_UA); + } + /** + * 动画帧 + * @method raf + * @param {Function} fn 回调 + * @return {Function} requestAnimationFrame + */ + var __raf = function () { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function (callback, element) { + window.setTimeout(function () { + callback(+new Date(), element); + }, 1000 / 60); + }; + }(); + /** + * 当å‰çŽ¯å¢ƒæ˜¯å¦æ”¯æŒ Promise + * @method __supportPromise + * @return {Boolean} æ˜¯å¦æ”¯æŒ + */ + function __isSupportPromise() { + if (_IS_SUPPORT_PROMISE === undefined) { + var isSupport = false; + var P = self.Promise; + + if (P) { + var promise = null; + var then = null; + try { + promise = P.resolve(); + then = promise.then; + } catch (e) { + // silently ignored + } + if (promise instanceof P && __isFunction(then) && !P.cast) { + isSupport = true; + } + } + if (!isSupport) { + console.warn('try callback since no Promise detected'); + } + _IS_SUPPORT_PROMISE = isSupport; + } + return _IS_SUPPORT_PROMISE; + } + + /** + * 超级å—ç¬¦ä¸²è½¬æ¢ + * @method __superToString + * @param {Any} content 待转æ¢å†…容 + * @return {String} 转æ¢åŽçš„å—符串 + */ + function __superToString(content) { + var str = content; + if (__isObject(content) || __isArray(content)) { + try { + str = JSON.stringify(content); + } catch (e) { + //é™é»˜ + } + } else { + str = content + ''; + } + return str; + } + + /** + * 16进制颜色转æˆ10è¿›åˆ¶æ•°å— + * @method __h2dColor + * @param {String} hex 16进制颜色å—符串 + * @return {Number} 10è¿›åˆ¶æ•°å— + */ + function __h2dColor(hex) { + var dec = '' + hex; + //å¦‚æžœåŠ äº†#å·ï¼ŒåŽ»æŽ‰ + if (dec.indexOf('#') === 0) { + dec = dec.substr(1); + } + //如果是3ä½ç®€å†™ï¼Œè¡¥å…¨æˆ6ä½ + if (dec.length === 3) { + dec = dec.replace(/(.)/g, '$1$1'); + } + dec = parseInt(dec, 16); + if (__isNaN(dec)) { + console.error(hex + ' is invalid hex color.'); + } + return dec; + } + + /** + * 10进制数å—转æˆ16进制颜色 + * @method __d2hColor + * @param {Number} dec 10è¿›åˆ¶æ•°å— + * @return {String} 16进制颜色å—符串 + */ + // function __d2hColor(dec) { + // return '#' + dec.toString(16); + // } + /** + * native è¿”å›žçš„æ— å¤´ base64 æ•°æ®ï¼Œæ·»åŠ æµè§ˆå™¨è¯†åˆ«çš„ mimeType çš„ base64æ•°æ®å¤´ + * @method __addBase64Head + * @param {String} base64 æ— å¤´æ•°æ® + * @param {String} mimeType æ•°æ®æ ¼å¼ + * @return {String} æœ‰å¤´æ•°æ® + */ + function __addBase64Head(base64, mimeType) { + if (base64 && mimeType) { + base64 = 'data:' + mimeType + ';base64,' + base64; + } + return base64; + } + + /** + * 移除 base64 æ•°æ®å¤´ï¼Œnative 接å£ä¸éœ€è¦ä¼ 入头部 + * @method __removeBase64Head + * @param {String} base64 æœ‰å¤´æ•°æ® + * @return {String} æ— å¤´æ•°æ® + */ + function __removeBase64Head(base64) { + if (__isString(base64)) { + base64 = base64.replace(/^data:(\/|\w|\-|\.)+;base64,/i, ''); + } + return base64; + } + + /** + * 把 json è½¬æˆ & ç›¸è¿žçš„è¯·æ±‚å‚æ•° + * @method __toQueryString + * @param {Object} data key: value傿•°é”®å€¼å¯¹ + * @return {String} queryString + */ + function __toQueryString(data) { + var result = []; + + __forEach(data, function (key, value) { + result.push(key + '=' + encodeURIComponent(__isUndefined(value) ? '' : value)); + }); + result = result.join('&'); + // var limits = [1024, 2048]; + // var notice; + // notice = 'query string length has more than %d,please use setSessionData interface'; + // if (result.length > limits[1]) { + // console.warn(notice, limits[1]); + // } else if (result.length > limits[0]) { + // console.warn(notice, limits[0]); + // } + return result; + } + + /** + * æž„é€ å¸¦å‚的完整 url + * @method __buildUrl + * @param {String} url 原始 url,å¯èƒ½å·²ç»æœ‰ queryString + * @param {Object} params url 傿•°å¯¹è±¡ + * @return {String} æ‹¼æŽ¥å¥½çš„å¸¦å‚ url + */ + function __buildUrl(url, params) { + var qs = params; + if (__isObject(params)) { + qs = __toQueryString(params); + } + if (!/\?/.test(url)) { + qs = '?' + qs; + } else if (!/&$/.test(url) && !/\?$/.test(url)) { + qs = '&' + qs; + } + return url + qs; + } + /** + * 一个对象是å¦å«æœ‰æŸä¸ª key + * @method __hasOwnProperty + * @param {Object} obj 对象或数组 + * @param {String} key 键值 + * @return {Boolean} 是å¦å«æœ‰æ¤é”®å€¼ + */ + function __hasOwnProperty(obj, key) { + if (__isObject(obj) || __isArray(obj)) { + return obj.hasOwnProperty(key); + } + return false; + } + /** + * é历对象 + * @method __forEach + * @param {Object} obj å¾…é历对象或数组 + * @param {Function} cb æ¯ä¸ª key 的回调 + * å›žè°ƒå…¥å‚æ˜¯ key 和对应的 value + */ + function __forEach(obj, cb, notArray) { + var i; + var key; + if (!notArray && __likeArray(obj)) { + for (i = 0; i < obj.length; i++) { + if (cb(i, obj[i]) === false) { + return obj; + } + } + } else { + for (key in obj) { + if (cb(key, obj[key]) === false) { + return obj; + } + } + } + return obj; + } + /** + * è§£æž JSON + * @method __parseJSON + * @param {String} str JSON å—符串 + * @return {Object} JSON 对象 + */ + function __parseJSON(str) { + try { + str = JSON.parse(str); + } catch (err) { + console.warn(err, str); + } + return str; + } + + /** + * 转æˆå°å†™å—æ¯ + * @method __tlc + * @param {String} str 待转æ¢å—符串 + * @return {String} å°å†™å—符串 + */ + function __tlc(str) { + if (__isString(str)) { + str = str.toLowerCase(); + } + return str; + } + + /** + * 转æˆå¤§å†™å—æ¯ + * @method __tuc + * @param {String} str 待转æ¢å—符串 + * @return {String} 大写å—符串 + */ + function __tuc(str) { + if (__isString(str)) { + str = str.toUpperCase(); + } + return str; + } + + function __isAndroid() { + return __inUA(/android/i); + } + + function __isIOS() { + return __inUA(/iPad|iPod|iPhone|iOS/i); + } + + function __isUndefined(o) { + return __type_original(o) === '[object Undefined]'; + } + + function __isNull(o) { + return __type_original(o) === '[object Null]'; + } + + function __isNaN(num) { + return parseInt(num, 10).toString() === 'NaN'; + } + function __isBoolean(val) { + return typeof val === 'boolean'; + } + + function __isFunction(fn) { + return __type_original(fn) === '[object Function]'; + } + + function __isString(str) { + return typeof str === 'string'; + } + + function __isObject(o) { + return __type_original(o) === '[object Object]'; + } + + function __isNumber(num) { + // 如果用typeof number 会生æˆSymbolPolyfill + return __type_original(num) === '[object Number]'; + } + + function __isArray(arr) { + return __type_original(arr) === '[object Array]'; + } + + function __likeArray(obj) { + return !!obj && !__isFunction(obj) && (__isArray(obj) || __isNumber(obj.length)); + } + function __isEvent(evt) { + return __type_original(evt) === '[object Event]'; + } + + function __type_original(obj) { + return Object.prototype.toString.call(obj); + } + + function __isEmptyObject(obj) { + for (var name in obj) { + return false; + } + return true; + } + + function __argumentsToArg(_arguments) { + var _startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var len = _arguments.length - _startIndex; + var arg = new Array(len); + for (var i = 0; i < len; i++) { + arg[i] = _arguments[i + _startIndex]; + } + return arg; + } + + /** + * 对象扩展 + * @method __extend + * @param {Object} obj 原始对象 + * @param {Object} args 多个继承对象 + * @return {Object} 扩展åŽå¯¹è±¡ + */ + function __extend(obj) { + var args = __argumentsToArg(arguments, 1); + var source; + var prop; + if (!__isObject(obj)) { + return obj; + } + for (var i = 0, length = args.length; i < length; i++) { + source = args[i]; + for (prop in source) { + if (hasOwnProperty.call(source, prop)) { + obj[prop] = source[prop]; + } + } + } + return obj; + } + + /***************** 输出 AP 对象 *******************/ + self._AP = AP; + + if (typeof module !== 'undefined' && module.exports) { + // 兼容 CommonJS + module.exports = AP; + } else if (typeof define === 'function' && (define.amd || define.cmd)) { + // 兼容 AMD / RequireJS / seaJS + define(function () { + return AP; + }); + } else { + // 如果ä¸ä½¿ç”¨æ¨¡å—åŠ è½½å™¨åˆ™è‡ªåŠ¨ç”Ÿæˆå…¨å±€å˜é‡ + self.ap = self.AP = AP; + } +})(self); \ No newline at end of file diff --git a/uni_modules/lime-painter/changelog.md b/uni_modules/lime-painter/changelog.md new file mode 100644 index 0000000..65a6dd9 --- /dev/null +++ b/uni_modules/lime-painter/changelog.md @@ -0,0 +1,203 @@ +## 1.9.5.7(2023-07-27) +- fix: 去掉多余的方法 +- chore: 更新文档,增加自定义字体说明 +## 1.9.5.6(2023-07-21) +- feat: 有限的支持富文本 +- feat: H5和APP 增加 `hidpi` prop,主要用于大尺寸无法生成图片时用 +- fix: 修复 钉钉小程序 缺少 `measureText` 方法 +- chore: 由于微信小程序 pc 端的 canvas 2d 时不时抽风,故不使用canvas 2d +## 1.9.5.5(2023-06-27) +- fix: 修复把`emoji`表情字符拆分成多个字符的情况 +## 1.9.5.4(2023-06-05) +- fix: 修复因`canvasToTempFilePathSync`监听导致重复调用 +## 1.9.5.3(2023-05-23) +- fix: 因isPc错写成了isPC导致小程序PC不能生成图片 +## 1.9.5.2(2023-05-22) +- feat: 删除多余文件 +## 1.9.5.1(2023-05-22) +- fix: 修复 文字行数与`line-clamp`相同但不满一行时也加了省略号的问题 +## 1.9.5(2023-05-14) +- feat: 增加 `text-indent` 和 `calc` 方法 +- feat: 优化 布局时间 +## 1.9.4.4(2023-04-15) +- fix: 修复无法匹配负值 +- fix: 修复 Nvue IOS getImageInfo `useCORS` 为 undefined +## 1.9.4.3(2023-04-01) +- feat: 增加支持文字描边 `text-stroke: '5rpx #fff'` +## 1.9.4.2(2023-03-30) +- fix: 修复 支付宝小程序 isPC 在手机也为true的问题 +- feat: 由 微信开发工具 3060 版 无法获取图片尺寸,现 微信开发工具 3220 版 修复该问题,故还原上一版的获取图片方式。 +## 1.9.4.1(2023-03-28) +- fix: 修复固定高度不正确问题 +## 1.9.4(2023-03-17) +- fix: nvue ios getImageInfo缺少this报错 +- fix: pathType 非2d无效问题 +- fix: 修复 小米9se 可能会存在多次init 导致画面多次放大 +- fix: 修复 border 分开写 width style无效问题 +- fix: 修复 支付宝小程序IOS 再次进入不渲染的问题 +- fix: 修复 支付宝小程序安卓Zindex排序错乱问题 +- fix: 修复 微信开发工具 3060 版 无法获取图片的问题 +- feat: 把 for in 改为 forEach +- feat: 增加 hidden +- feat: 根节点 box-sizing 默认 `border-box` +- feat: 增加支持 `vw` `wh` +- chore: pathType 取消 默认值,因为字节开发工具不能显示 +- chore: 支付宝小程序开发工具不支持 生成图片 请以真机调试为准 +- bug: 企业微信 2.20.3无法使用 +## 1.9.3.5(2022-06-29) +- feat: justifyContent 增加 `space-around`、`space-between` +- feat: canvas 2d 也使用`getImageInfo` +- fix: 修复 `text`的 `text-decoration`错位 +## 1.9.3.4(2022-06-20) +- fix: 修复 因创建节点速度问题导致顺序出错。 +- fix: 修复 微信小程序 PC 无法显示本地图片 +- fix: 修复 flex-box 对齐问题 +- feat: 增加 `text-shadow` +- feat: 重写 `text` 对齐方式 +- chore: 更新文档 +## 1.9.3.3(2022-06-17) +- fix: 修复 支付宝小程序 canvas 2d 存在ctx.draw问题导致报错 +- fix: 修复 支付宝小程序 toDataURL 存在权限问题改用 `toTempFilePath` +- fix: 修复 支付宝小程序 image size 问题导致 `objectFit` 无效 +## 1.9.3.2(2022-06-14) +- fix: 修复 image 设置背景色不生效问题 +- fix: 修复 nvue 环境判断缺少参数问题 +## 1.9.3.1(2022-06-14) +- fix: 修复 bottom 定位不对问题 +- fix: 修复 因小数导致计算出错换行问题 +- feat: 增加 `useCORS` h5端图片跨域 在设置请求头无效果后试一下设置这个值 +- chore: 更新文档 +## 1.9.3(2022-06-13) +- feat: 增加 `zIndex` +- feat: 增加 `flex-box` 该功能处于原始阶段,非常简陋。 +- tips: QQ小程序 vue3 不支持, 为 uni 官方BUG +## 1.9.2.9(2022-06-10) +- fix: 修复`text-align`及`margin`居中问题 +## 1.9.2.8(2022-06-10) +- fix: 修复 Nvue `canvasToTempFilePathSync` 不生效问题 +## 1.9.2.7(2022-06-10) +- fix: 修复 margin及padding的bug +- fix: 修复 Nvue `isCanvasToTempFilePath` 不生效问题 +## 1.9.2.6(2022-06-09) +- fix: 修复 Nvue 不显示 +- feat: 增加支持字体渐变 +```html ++ ++ ++ + ++ + ++ ++ + + + + + + + ++ + ++ + ++ +``` +## 1.9.2.5(2022-06-09) +- chore: 更变获取父级宽度的设定 +- chore: `pathType` 在canvas 2d 默认为 `url` +## 1.9.2.4(2022-06-08) +- fix: 修复 `pathType` 不生效问题 +## 1.9.2.3(2022-06-08) +- fix: 修复 `canvasToTempFilePath` 漏写 `success` 参数 +## 1.9.2.2(2022-06-07) +- chore: 更新文档 +## 1.9.2.1(2022-06-07) +- fix: 修复 vue3 赋值给this再传入导致image无法绘制 +- fix: 修复 `canvasToTempFilePathSync` 时机问题 +- feat: canvas 2d 更改图片生成方式 `toDataURL` +## 1.9.2(2022-05-30) +- fix: 修复 `canvasToTempFilePathSync` 在 vue3 下只生成一次 +## 1.9.1.7(2022-05-28) +- fix: 修复 `qrcode`显示不全问题 +## 1.9.1.6(2022-05-28) +- fix: 修复 `canvasToTempFilePathSync` 会重复多次问题 +- fix: 修复 `view` css `backgroundImage` 图片下载失败导致 子节点不渲染 +## 1.9.1.5(2022-05-27) +- fix: 修正支付宝小程序 canvas 2d版本号 2.7.15 +## 1.9.1.4(2022-05-22) +- fix: 修复字节小程序无法使用xml方式 +- fix: 修复字节小程序无法使用base64(非2D情况下工具上无法显示) +- fix: 修复支付宝小程序 `canvasToTempFilePath` 报错 +## 1.9.1.3(2022-04-29) +- fix: 修复vue3打包后uni对象为空后的报错 +## 1.9.1.2(2022-04-25) +- fix: 删除多余文件 +## 1.9.1.1(2022-04-25) +- fix: 修复图片不显示问题 +## 1.9.1(2022-04-12) +- fix: 因四舍五入导致有些机型错位 +- fix: 修复无views报错 +- chore: nvue下因ios无法读取插件内static文件,改由下载方式 +## 1.9.0(2022-03-20) +- fix: 因无法固定尺寸导致生成图片不全 +- fix: 特定情况下text判断无效 +- chore: 本地化APP Nvue webview +## 1.8.9(2022-02-20) +- fix: 修复 小程序下载最多10次并发的问题 +- fix: 修复 APP端无法获取本地图片 +- fix: 修复 APP Nvue端不执行问题 +- chore: 增加图片缓存机制 +## 1.8.8.8(2022-01-27) +- fix: 修复 主动调用尺寸问题 +## 1.8.8.6(2022-01-26) +- fix: 修复 nvue 下无宽度时获取父级宽度 +- fix: 修复 ios app 无法渲染问题 +## 1.8.8(2022-01-23) +- fix: 修复 主动调用时无节点问题 +- fix: 修复 `box-shadow` 颜色问题 +- fix: 修复 `transform:rotate` 角度位置问题 +- feat: 增加 `overflow:hidden` +## 1.8.7(2022-01-07) +- fix: 修复 image 方向为 `right` 时原始宽高问题 +- feat: 支持 view 设置背景图 `background-image: url(xxx)` +- chore: 去掉可选链 +## 1.8.6(2021-11-28) +- feat: 支持`view`对`inline-block`的子集使用`text-align` +## 1.8.5.5(2021-08-17) +- chore: 更新文档,删除 replace +- fix: 修复 text 值为 number时报错 +## 1.8.5.4(2021-08-16) +- fix: 字节小程序兼容 +## 1.8.5.3(2021-08-15) +- fix: 修复线性渐变与css现实效果不一致的问题 +- chore: 更新文档 +## 1.8.5.2(2021-08-13) +- chore: 增加`background-image`、`background-repeat` 能力,主要用于背景纹理的绘制,并不是代替`image`。例如:大面积的重复平铺的水印 +- 注意:这个功能H5暂时无法使用,因为[官方的API有BUG](https://ask.dcloud.net.cn/question/128793),待官方修复!!! +## 1.8.5.1(2021-08-10) +- fix: 修复因`margin`报错问题 +## 1.8.5(2021-08-09) +- chore: 增加margin支持`auto`,以达到居中效果 +## 1.8.4(2021-08-06) +- chore: 增加判断缓存文件条件 +- fix: 修复css 多余空格报错问题 +## 1.8.3(2021-08-04) +- tips: 1.6.x 以下的版本升级到1.8.x后要为每个元素都加上定位:position: 'absolute' +- fix: 修复只有一个view子元素时不计算高度的问题 +## 1.8.2(2021-08-03) +- fix: 修复 path-type 为 `url` 无效问题 +- fix: 修复 qrcode `text` 为空时报错问题 +- fix: 修复 image `src` 动态设置时不生效问题 +- feat: 增加 css 属性 `min-width` `max-width` +## 1.8.1(2021-08-02) +- fix: 修复无法加载本地图片 +## 1.8.0(2021-08-02) +- chore 文档更新 +- 使用旧版的同学不要升级! +## 1.8.0-beta(2021-07-30) +- ## 全新布局方式 不兼容旧版! +- chore: 布局方式变更 +- tips: 微信canvas 2d 不支持真机调试 +## 1.6.6(2021-07-09) +- chore: 统一命名规范,无须主动引入组件 +## 1.6.5(2021-06-08) +- chore: 去掉console +## 1.6.4(2021-06-07) +- fix: 修复 数字 为纯字符串时不转换的BUG +## 1.6.3(2021-06-06) +- fix: 修复 PC 端放大的BUG +## 1.6.2(2021-05-31) +- fix: 修复 报`adaptor is not a function`错误 +- fix: 修复 text 多行高度 +- fix: 优化 默认文字的基准线 +- feat: `@progress`事件,监听绘制进度 +## 1.6.1(2021-02-28) +- 删除多余节点 +## 1.6.0(2021-02-26) +- 调整为uni_modules目录规范 +- 修复:transform的rotate不能为负数问题 +- 新增:`pathType` 指定生成图片返回的路径类型,可选值有 `base64`、`url` diff --git a/uni_modules/lime-painter/components/common/relation.js b/uni_modules/lime-painter/components/common/relation.js new file mode 100644 index 0000000..6ed37e8 --- /dev/null +++ b/uni_modules/lime-painter/components/common/relation.js @@ -0,0 +1,150 @@ +const styles = (v ='') => v.split(';').filter(v => v && !/^[\n\s]+$/.test(v)).map(v => { + const key = v.slice(0, v.indexOf(':')) + const value = v.slice(v.indexOf(':')+1) + return { + [key + .replace(/-([a-z])/g, function() { return arguments[1].toUpperCase()}) + .replace(/\s+/g, '') + ]: value.replace(/^\s+/, '').replace(/\s+$/, '') || '' + } + }) +export function parent(parent) { + return { + provide() { + return { + [parent]: this + } + }, + data() { + return { + el: { + id: null, + css: {}, + views: [] + }, + } + }, + watch: { + css: { + handler(v) { + if(this.canvasId) { + this.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {} + this.canvasWidth = this.el.css && this.el.css.width || this.canvasWidth + this.canvasHeight = this.el.css && this.el.css.height || this.canvasHeight + } + }, + immediate: true + } + } + } +} +export function children(parent, options = {}) { + const indexKey = options.indexKey || 'index' + return { + inject: { + [parent]: { + default: null + } + }, + watch: { + el: { + handler(v, o) { + if(JSON.stringify(v) != JSON.stringify(o)) + this.bindRelation() + }, + deep: true, + immediate: true + }, + src: { + handler(v, o) { + if(v != o) + this.bindRelation() + }, + immediate: true + }, + text: { + handler(v, o) { + if(v != o) this.bindRelation() + }, + immediate: true + }, + css: { + handler(v, o) { + if(v != o) + this.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {} + }, + immediate: true + }, + replace: { + handler(v, o) { + if(JSON.stringify(v) != JSON.stringify(o)) + this.bindRelation() + }, + deep: true, + immediate: true + } + }, + created() { + if(!this._uid) { + this._uid = this._.uid + } + Object.defineProperty(this, 'parent', { + get: () => this[parent] || [], + }) + Object.defineProperty(this, 'index', { + get: () => { + this.bindRelation(); + const {parent: {el: {views=[]}={}}={}} = this + return views.indexOf(this.el) + }, + }); + this.el.type = this.type + if(this.uid) { + this.el.uid = this.uid + } + this.bindRelation() + }, + // #ifdef VUE3 + beforeUnmount() { + this.removeEl() + }, + // #endif + // #ifdef VUE2 + beforeDestroy() { + this.removeEl() + }, + // #endif + methods: { + removeEl() { + if (this.parent) { + this.parent.el.views = this.parent.el.views.filter( + (item) => item._uid !== this._uid + ); + } + }, + bindRelation() { + if(!this.el._uid) { + this.el._uid = this._uid + } + if(['text','qrcode'].includes(this.type)) { + this.el.text = this.$slots && this.$slots.default && this.$slots.default[0].text || `${this.text || ''}`.replace(/\\n/g, '\n') + } + if(this.type == 'image') { + this.el.src = this.src + } + if (!this.parent) { + return; + } + let views = this.parent.el.views || []; + if(views.indexOf(this.el) !== -1) { + this.parent.el.views = views.map(v => v._uid == this._uid ? this.el : v) + } else { + this.parent.el.views = [...views, this.el]; + } + } + }, + mounted() { + // this.bindRelation() + }, + } +} \ No newline at end of file diff --git a/uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue b/uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue new file mode 100644 index 0000000..e24e3aa --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue @@ -0,0 +1,28 @@ + + + + + + + diff --git a/uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue b/uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue new file mode 100644 index 0000000..a73e5ed --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue @@ -0,0 +1,27 @@ + + + + + + diff --git a/uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue b/uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue new file mode 100644 index 0000000..26abbc4 --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue @@ -0,0 +1,29 @@ + + + + + + + diff --git a/uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue b/uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue new file mode 100644 index 0000000..a3fbc01 --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue @@ -0,0 +1,30 @@ + + + + + + + diff --git a/uni_modules/lime-painter/components/l-painter/l-painter.vue b/uni_modules/lime-painter/components/l-painter/l-painter.vue new file mode 100644 index 0000000..ef47270 --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter/l-painter.vue @@ -0,0 +1,445 @@ + + + + + + + diff --git a/uni_modules/lime-painter/components/l-painter/nvue.js b/uni_modules/lime-painter/components/l-painter/nvue.js new file mode 100644 index 0000000..ff58f1c --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter/nvue.js @@ -0,0 +1,190 @@ +// #ifdef APP-NVUE +import { sleep, getImageInfo, isBase64, useNvue, networkReg } from './utils'; +const dom = weex.requireModule('dom') +import { version } from '../../package.json' + +export default { + data() { + return { + tempFilePath: [], + isInitFile: false, + osName: uni.getSystemInfoSync().osName + } + }, + methods: { + getParentWeith() { + return new Promise(resolve => { + dom.getComponentRect(this.$refs.limepainter, (res) => { + this.parentWidth = Math.ceil(res.size.width) + this.canvasWidth = this.canvasWidth || this.parentWidth ||300 + this.canvasHeight = res.size.height || this.canvasHeight||150 + resolve(res.size) + }) + }) + }, + onPageFinish() { + this.webview = this.$refs.webview + this.webview.evalJS(`init(${this.dpr})`) + }, + onMessage(e) { + const res = e.detail.data[0] || null; + if (res.event) { + if (res.event == 'inited') { + this.inited = true + } + if(res.event == 'fail'){ + this.$emit('fail', res) + } + if (res.event == 'layoutChange') { + const data = typeof res.data == 'string' ? JSON.parse(res.data) : res.data + this.canvasWidth = Math.ceil(data.width); + this.canvasHeight = Math.ceil(data.height); + } + if (res.event == 'progressChange') { + this.progress = res.data * 1 + } + if (res.event == 'file') { + this.tempFilePath.push(res.data) + if (this.tempFilePath.length > 7) { + this.tempFilePath.shift() + } + return + } + if (res.event == 'success') { + if (res.data) { + this.tempFilePath.push(res.data) + if (this.tempFilePath.length > 8) { + this.tempFilePath.shift() + } + if (this.isCanvasToTempFilePath) { + this.setFilePath(this.tempFilePath.join(''), {isEmit:true}) + } + } else { + this.$emit('fail', 'canvas no data') + } + return + } + this.$emit(res.event, JSON.parse(res.data)); + } else if (res.file) { + this.file = res.data; + } else{ + console.info(res[0]) + } + }, + getWebViewInited() { + if (this.inited) return Promise.resolve(this.inited); + return new Promise((resolve) => { + this.$watch( + 'inited', + async val => { + if (val) { + resolve(val) + } + }, { + immediate: true + } + ); + }) + }, + getTempFilePath() { + if (this.tempFilePath.length == 8) return Promise.resolve(this.tempFilePath) + return new Promise((resolve) => { + this.$watch( + 'tempFilePath', + async val => { + if (val.length == 8) { + resolve(val.join('')) + } + } + ); + }) + }, + getWebViewDone() { + if (this.progress == 1) return Promise.resolve(this.progress); + return new Promise((resolve) => { + this.$watch( + 'progress', + async val => { + if (val == 1) { + this.$emit('done') + this.done = true + resolve(val) + } + }, { + immediate: true + } + ); + }) + }, + async render(args) { + try { + await this.getSize(args) + const {width} = args.css || args + if(!width && this.parentWidth) { + Object.assign(args, {width: this.parentWidth}) + } + const newNode = await this.calcImage(args); + await this.getWebViewInited() + this.webview.evalJS(`source(${JSON.stringify(newNode)})`) + await this.getWebViewDone() + await sleep(this.afterDelay) + if (this.isCanvasToTempFilePath) { + const params = { + fileType: this.fileType, + quality: this.quality + } + this.webview.evalJS(`save(${JSON.stringify(params)})`) + } + return Promise.resolve() + } catch (e) { + this.$emit('fail', e) + } + }, + async calcImage(args) { + let node = JSON.parse(JSON.stringify(args)) + const urlReg = /url\((.+)\)/ + const {backgroundImage} = node.css||{} + const isBG = backgroundImage && urlReg.exec(backgroundImage)[1] + const url = node.url || node.src || isBG + if(['text', 'qrcode'].includes(node.type)) { + return node + } + if ((node.type === "image" || isBG) && url && !isBase64(url) && (this.osName == 'ios' || !networkReg.test(url))) { + let {path} = await getImageInfo(url, true) + if (isBG) { + node.css.backgroundImage = `url(${path})` + } else { + node.src = path + } + } else if (node.views && node.views.length) { + for (let i = 0; i < node.views.length; i++) { + node.views[i] = await this.calcImage(node.views[i]) + } + } + return node + }, + async canvasToTempFilePath(args = {}) { + if (!this.inited) { + return this.$emit('fail', 'no init') + } + this.tempFilePath = [] + if (args.fileType == 'jpg') { + args.fileType = 'jpeg' + } + this.webview.evalJS(`save(${JSON.stringify(args)})`) + try { + let tempFilePath = await this.getTempFilePath() + tempFilePath = await this.setFilePath(tempFilePath, args) + args.success({ + errMsg: "canvasToTempFilePath:ok", + tempFilePath + }) + } catch (e) { + args.fail({ + error: e + }) + } + } + } +} +// #endif \ No newline at end of file diff --git a/uni_modules/lime-painter/components/l-painter/painter.js b/uni_modules/lime-painter/components/l-painter/painter.js new file mode 100644 index 0000000..e430fe7 --- /dev/null +++ b/uni_modules/lime-painter/components/l-painter/painter.js @@ -0,0 +1 @@ +var t=function(){return(t=Object.assign||function(t){for(var e,i=1,n=arguments.length;i+ + + + + + + ++ + ++ 0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1] =360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,d=0,l=0,c=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var f=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(f)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(l=p+(v=Math.pow(Math.sin(f),2)*g)),d=-(c=u+v/Math.tan(f))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;f=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(f)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(l=p+(v=Math.pow(Math.sin(f),2)*g)/Math.tan(f)),d=-(c=u+v)}return h=Math.round(h+e/2)+n,d=Math.round(i/2-d)+r,l=Math.round(l+e/2)+n,c=Math.round(i/2-c)+r,{x0:h,y0:d,x1:l,y1:c}}(r,t,e,i,n),a=s.x0,h=s.y0,d=s.x1,l=s.y1,c=o.createLinearGradient(a,h,d,l),f=r.match(/linear-gradient\((.+)\)/)[1],u=R(f.substring(f.indexOf(",")+1)),p=0;p t.length)&&(e=t.length);for(var i=0,n=new Array(e);i =t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(t){return"number"==typeof t}function D(t){return"auto"===t||null===t}function Y(t){return/%$/.test(t)}var $=g,U=p,N=u,X=v,_=x,q=m,G=S;function V(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function J(t,e){var i,n,r=function(t){var e=t.match(/([a-z]+)/)[1];return[e,V(t.split(e)[1])]}(t),s=r[0],a=r[1],h=e.split(" ");if(a)return(i={})[s+a]=e,i;if(h.length&&!a){var d=h[0],l=h[1],c=h[2],f=h[3];return(n={})[s+o[0]]=d,n[s+o[1]]=l||d,n[s+o[2]]=c||d,n[s+o[3]]=f||l||d,n}}function Q(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o 0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n=""+Q(t.slice(o+1,a)),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var d=0;e.length;)d+=e.pop();return d}var Z,K=0,et=function(){function t(){F(this,"elements",[]),F(this,"afterElements",[]),F(this,"beforeElements",[]),F(this,"ids",[]),F(this,"width",0),F(this,"height",0),F(this,"top",0),F(this,"left",0),F(this,"pre",null),F(this,"offsetX",0),F(this,"offsetY",0),K++,this.id=K}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0) this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0) 1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==u&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(et),rt=g,ot=p,st=u,at=y,ht=x,dt=w,lt=m,ct=S,ft=0,ut={left:null,top:null,width:null,height:null},pt=new Map,gt=function(){function t(t,e,i,n){var s=this;F(this,"id",ft++),F(this,"style",{left:null,top:null,width:null,height:null}),F(this,"computedStyle",{}),F(this,"originStyle",{}),F(this,"children",{}),F(this,"layoutBox",A({},ut)),F(this,"contentSize",A({},ut)),F(this,"clientSize",A({},ut)),F(this,"borderSize",A({},ut)),F(this,"offsetSize",A({},ut)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var a=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],s=t.type,a=void 0===s?N:s,h=t.styles,d=void 0===h?{}:h,l=(e||{}).computedStyle,c=Object.assign({},z);if([U,$,X].includes(a)&&!d.display&&(c.display=_),l)for(var f=0;f =0&&c<0,Y=d>=0&&u<0;return i==h[0]&&(this[i].left=t.left+s+v+j+(D?2*-c:0),this[i].top=t.top+d+x+W+(Y?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==h[1]&&(this[i].left=t.left+s+j+(D<0?-c:0),this[i].top=t.top+d+W+(Y?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==h[2]&&(this[i].left=t.left+s+j/2+(D<0?-c:0),this[i].top=t.top+d+W/2+(Y?-u:0),this[i].width=t.width+v+w+j/2+F/2,this[i].height=t.height+x+S+T/2+W/2),i==h[3]&&(this[i].left=t.left+(D<0?-c:0),this[i].top=t.top+(Y?-u:0),this[i].width=t.width+v+w+j+F+s+c,this[i].height=t.height+x+S+T+W+u+d),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,d=void 0===a?0:a,l=o.borderTop,c=(l=void 0===l?{}:l).borderTopWidth,f=void 0===c?d:c,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?d:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?d:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?d:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,B=void 0===M?0:M,k=S.paddingBottom,W=void 0===k?0:k,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+B+x+m),1!==i||n||(t.height-=I+W+f+g)}this.layoutBox&&(h.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=t.padding||{},h=a.paddingBottom,d=void 0===h?0:h,l=a.paddingRight,c=void 0===l?0:l,f=A({},this.contentSize,{left:r,top:s}),u=this.contentSize.top-this.offsetSize.top,p=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var g,v=C(this.root.fixedLine.elements);!(g=v()).done;){var y=g.value;y.setPosition(y,this.root.offsetSize),y.getBoxPosition()}}if(e)for(var x,b=C(e.elements);!(x=b()).done;){var w=x.value;w.setPosition(w,f),w.style.left+=r+p+c,w.style.top+=s+u+d,w.getBoxPosition()}if(i)for(var m,S=C(i);!(m=S()).done;){m.value.layout(f.top+u,f.left+p)}return this.layoutBoxUpdate(f,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==at},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==dt},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==dt)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==ht},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,d=void 0===h?0:h,l=i.top,c=void 0===l?0:l,f=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,B=i.position;i.textIndent;var k=i.lineClamp,W=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,F=i.border,A=(F=void 0===F?{}:F).borderWidth,E=void 0===A?0:A,j=i.borderRight,C=(j=void 0===j?{}:j).borderRightWidth,H=void 0===C?E:C,$=i.borderLeft,U=($=void 0===$?{}:$).borderLeftWidth,N=void 0===U?E:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if(Y(g)&&X&&(g=P(g,X)),Y(g)&&!X&&(g=null),Y(m)&&_&&(m=P(m,_)),Y(m)&&!_&&(m=null),Y(v)&&X&&(v=P(v,X)),Y(y)&&X&&(y=P(y,X)),Y(x)&&_&&(x=P(x,_)),Y(b)&&_&&(b=P(b,_)),i.padding&&X)for(var q in i.padding)Object.hasOwnProperty.call(T,q)&&(T[q]=P(T[q],X));var G=T.paddingRight,V=void 0===G?0:G,J=T.paddingLeft,Q=void 0===J?0:J;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var Z=X&&X-g-V-Q-N-H||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=Z/2:D(R.marginLeft)?R.marginLeft=Z:R.marginRight=Z}else R.marginLeft=R.marginRight=0;var K=R.marginRight,tt=void 0===K?0:K,it=R.marginLeft,at={width:g,height:m,left:0,top:0},ht=Q+V+N+H+(void 0===it?0:it)+tt;if(this.offsetWidth=ht,e==ot&&!this.attributes.widths){var dt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),dt.length,"\n"==dt&&(dt="",this.isBr=!0),(""+dt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=pt.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return pt.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==rt&&null==g){var ct=n.width,ft=n.height;at.width=this.contrastSize(Math.round(ct*m/ft)||0,v,y),this.layoutBoxUpdate(at,i,0)}if(e==ot&&null==g){var ut=this.attributes.widths,gt=Math.max.apply(Math,ut.map((function(t){return t.total})));if(o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)gt=X;at.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(at,i,0)}if(e==ot&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>at.width?(vt++,e.width):t+e.width}),0)})),vt=k&&vt>k?k:vt,this.attributes.lines=vt}if(e==rt&&null==m){var yt=n.width,xt=n.height;n.text,at.height=this.contrastSize(P(at.width*xt/yt)||0,x,b),this.layoutBoxUpdate(at,i,1)}e==ot&&null==m&&(W=P(W,S),at.height=this.contrastSize(P(this.attributes.lines*W),x,b),this.layoutBoxUpdate(at,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([st,ot].includes(e)&&this.isFlex()||e==st&&this.isBlock(this)&&this.isInFlow())&&(at.width=this.contrastSize(X-(o.isFlexCalc?0:ht),v,y),this.layoutBoxUpdate(at,i)),g&&!Y(g)&&(at.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(at,i,0)),m&&!Y(m)&&(at.height=this.contrastSize(at.height,x,b),this.layoutBoxUpdate(at,i,1));var bt=0;if(a.length){var wt=null,mt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new et).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new nt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new et).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new et).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=B==lt?X:this.root.width,Mt=It-(Y(d)?P(d,It):d)-(Y(u)?P(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=c?c:this.isAbsolute||this.isFixed&&_)){var Bt=B==lt?_:this.root.height,kt=Bt-(Y(c)?P(c,Bt):c)-(Y(f)?P(f,Bt):f);zt=i.top?kt:0}if(g&&!Y(g)||at.width||(at.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(at,i,0)),m||!bt&&!zt||(at.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(at,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var Wt in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,Wt)&&(i.borderRadius[Wt]=P(i.borderRadius[Wt],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),vt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],d=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],l=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],c=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],f=[],u=[],p=[],g=[],v=[],y=2;function x(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function b(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)x(t-1,i+n),x(t+1,i-n),x(t-n,i-1),x(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;r e&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n >1&1,i=0;i =5&&(i+=3+v[e]-5);for(e=3;e t||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function B(){var t,i,n,r,o,s=0,a=0;for(i=0;i e*e;)h-=e*e,d++;for(s+=10*d,t=0;t 1)for(P=s[t],k=e-7;;){for(M=e-7;M>P-3&&(b(M,k),!(M 6)for(P=a[t-7],W=17,M=0;M<6;M++)for(k=0;k<3;k++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-k+e-11)]=1,p[2-k+e-11+e*(5-M)]=1):(x(5-M,2-k+e-11),x(2-k+e-11,5-M));for(k=0;k
=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(f[T+2]=0,f[T+3]=0;T--;)P=f[T],f[T+3]|=255&P<<4,f[T+2]=P>>4;f[2]|=255&O<<4,f[1]=O>>4,f[0]=64|O>>12}else{for(f[T+1]=0,f[T+2]=0;T--;)P=f[T],f[T+2]|=255&P<<4,f[T+1]=P>>4;f[1]|=255&O<<4,f[0]=64|O>>4}for(T=O+3-(t<10);T 0;L--)m[L]=m[L]?m[L-1]^c[w(l[m[L]]+T)]:m[L-1];m[0]=c[w(l[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=l[m[T]];for(W=M,k=0,T=0;T>=1)1&k&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,k>>=1)1&k&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i =1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,d=a.height,l=a.left,c=a.top;r.borderRadius,r.backgroundColor;var f=r.color,u=void 0===f?"#000000":f;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,d);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var x=0;x =s||n==d&&o =s)&&(a=e.width/i.width);var l=i.width*a,c=i.height*a,f=r||[],u=f[0],p=f[1],g=W(u)?P(u,e.width):(e.width-l)*(O(u)?P(u,1):{left:0,center:.5,right:1}[u||"center"]),v=W(p)?P(p,e.height):(e.height-c)*(O(p)?P(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(l,e.width),dh:M(c,e.height)}}({objectFit:u,objectPosition:v},r.contentSize,t),o=i.sx,s=i.sy,a=i.sh,h=i.sw,d=i.dx,l=i.dy,c=i.dh,f=i.dw;M==n.MP_BAIDU?e.drawImage(t.src,d+m,l+S,f,c,o,s,h,a):e.drawImage(t.src,o,s,h,a,d+m,l+S,f,c)}else e.drawImage(t.src,m,S,b,w)},k=function(){e.restore(),T.drawView(r,o,!1,!0,!1),h(1)},function(t){B(t),k()}(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},r.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,d=e.top,l=a.width,c=a.height,f=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?St:I,B=i.backgroundColor,k=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=W(m)?m:0,this.drawView(e,i,O!=xt),g=P(g,v),t){o.save(),h+=f,d+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,E=n.ascent,j=A+(void 0===E?0:E);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(St),o.setTextAlign(S),O?this.setBackground(B,l,c,h,d):o.setFillStyle(p),S){case It:break;case Mt:h+=.5*l;break;case Bt:h+=l}var C=n.lines*g,H=Math.ceil((c-C)/2);switch(H<0&&(H=0),M){case mt:break;case St:d+=H;break;case zt:d+=2*H}var D=(g-R)/2,Y=g/2,$=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==mt?{fix:j?void 0===r?0:r:Y-D/2,lineY:j?0:D-D/2}:M==St?{fix:j?Y+n/4:Y,lineY:j?0:D}:M==zt?{fix:j?g-n:Y+D/2,lineY:j?2*D:D+D/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case It:t=t,r+=i;break;case Mt:r=(t-=i/2)+i;break;case Bt:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var X=$(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,h+m,d+q),U(h+m,d+G,n&&n.widths&&n.widths[0].total||n.text),d+=g,o.restore(),void this.setBorder(e,i)}for(var V=d,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=k&&(Q+="…"),Z++,nt=0;var dt=$(Q);q=dt.fix,G=dt.lineY;N(Q,J,d+q),U(J,d+G,nt),d+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==k&&K+nt V+c||Z>k)break}}o.restore()}},r.prototype.source=function(t){return e(this,void 0,void 0,(function(){var e,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(!t.type)for(n in t.type=wt,t.styles=t.styles||t.css||{},t)["views","children","type","css","styles"].includes(n)||(t.styles[n]=t[n],delete t[n]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=i.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},r.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},r.prototype.create=function(n,r){return e(this,void 0,void 0,(function(){function e(i,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return i.forEach((function(i){var s=i.styles,a=void 0===s?{}:s,h=i.children,d=void 0===h?[]:h,l=i.text,c=void 0===l?"":l,f=i.type,u=void 0===f?"":f,p={};p=t(r?t({},n):{},a);var g={},v={},y={};Object.keys(p).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=J(t,p[t]);Object.keys(e).map((function(t){t.includes("Left")?v[t]=e[t]:t.includes("Right")?y[t]=e[t]:g[t]=e[t]}))}}));if(p.textIndent&&(v.textIndent=p.textIndent,delete n.textIndent),""!==c){var x=Array.from(c);x.forEach((function(t,e){var i=Object.assign({},p,g);0===e?Object.assign(i,v):e==x.length-1&&Object.assign(i,y),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(u==yt||u==bt)o.push(i);else if("block"===a.display&&d.length>0){var b=e(d,p,!1);i.children=b,i.flattened=!0,o.push(i)}else if(d.length>0){b=e(d,p,r);o=o.concat(b)}})),o}var o,s,a,h,d,l,c,f,u,p,g,v,y,x,w,m,S,z,I,M,B;return i(this,(function(i){switch(i.label){case 0:if(!n)return[2];if(n.styles||(n.styles=n.css||{}),o=n.type,s=o==yt,a=[xt,bt].includes(o),h="textBox"==o,d=n.styles||{},l=d.backgroundImage,c=d.display,s&&!n.src&&!n.url)return[2];if(c==b)return[2];if(a||h){if(f=n.children,!n.text&&(!f||f&&!f.length))return[2];f&&f.length&&!n.flattened&&(u=e(n.children),n.type="view",n.children=u)}if(!(s||n.type==wt&&l))return[3,4];p=s?n.src:"",g=/url\((.+)\)/.exec(l),l&&g&&g[1]&&(p=g[1]||""),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(p)];case 2:return v=i.sent(),y=v.width,x=v.height,!(w=v.path)&&s?[2]:(w&&(n.attributes=Object.assign(n.attributes||{},{width:y,height:x,path:w,src:w,naturalSrc:p})),[3,4]);case 3:return m=i.sent(),n.type!=wt?[2]:(this.lifecycle("onEffectFail",t(t({},m),{src:p})),[3,4]);case 4:if(this.count+=1,S=new gt(n,r,this.root,this.ctx),!(z=n.views||n.children))return[3,8];I=0,i.label=5;case 5:return I /^data:image\/(\w+);base64/.test(path); +export function sleep(delay) { + return new Promise(resolve => setTimeout(resolve, delay)) +} +let {platform, SDKVersion} = uni.getSystemInfoSync() +export const isPC = /windows|mac/.test(platform) +// 缓存图片 +let cache = {} +export function isNumber(value) { + return /^-?\d+(\.\d+)?$/.test(value); +} +export function toPx(value, baseSize, isDecimal = false) { + // 如果是数字 + if (typeof value === 'number') { + return value + } + // 如果是字符串数字 + if (isNumber(value)) { + return value * 1 + } + // 如果有单位 + if (typeof value === 'string') { + const reg = /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g + const results = reg.exec(value); + if (!value || !results) { + return 0; + } + const unit = results[3]; + value = parseFloat(value); + let res = 0; + if (unit === 'rpx') { + res = uni.upx2px(value); + } else if (unit === 'px') { + res = value * 1; + } else if (unit === '%') { + res = value * toPx(baseSize) / 100; + } else if (unit === 'em') { + res = value * toPx(baseSize || 14); + } + return isDecimal ? res.toFixed(2) * 1 : Math.round(res); + } + return 0 +} + +// 计算版本 +export function compareVersion(v1, v2) { + v1 = v1.split('.') + v2 = v2.split('.') + const len = Math.max(v1.length, v2.length) + while (v1.length < len) { + v1.push('0') + } + while (v2.length < len) { + v2.push('0') + } + for (let i = 0; i < len; i++) { + const num1 = parseInt(v1[i], 10) + const num2 = parseInt(v2[i], 10) + + if (num1 > num2) { + return 1 + } else if (num1 < num2) { + return -1 + } + } + return 0 +} + +function gte(version) { + // #ifdef MP-ALIPAY + SDKVersion = my.SDKVersion + // #endif + return compareVersion(SDKVersion, version) >= 0; +} +export function canIUseCanvas2d() { + // #ifdef MP-WEIXIN + return gte('2.9.2'); + // #endif + // #ifdef MP-ALIPAY + return gte('2.7.15'); + // #endif + // #ifdef MP-TOUTIAO + return gte('1.78.0'); + // #endif + return false +} + +// #ifdef MP +export const prefix = () => { + // #ifdef MP-TOUTIAO + return tt + // #endif + // #ifdef MP-WEIXIN + return wx + // #endif + // #ifdef MP-BAIDU + return swan + // #endif + // #ifdef MP-ALIPAY + return my + // #endif + // #ifdef MP-QQ + return qq + // #endif + // #ifdef MP-360 + return qh + // #endif +} +// #endif + + + +/** + * base64转路径 + * @param {Object} base64 + */ +export function base64ToPath(base64) { + const [, format] = /^data:image\/(\w+);base64,/.exec(base64) || []; + + return new Promise((resolve, reject) => { + // #ifdef MP + const fs = uni.getFileSystemManager() + //自定义文件名 + if (!format) { + reject(new Error('ERROR_BASE64SRC_PARSE')) + } + const time = new Date().getTime(); + let pre = prefix() + const filePath = `${pre.env.USER_DATA_PATH}/${time}.${format}` + fs.writeFile({ + filePath, + data: base64.split(',')[1], + encoding: 'base64', + success() { + resolve(filePath) + }, + fail(err) { + console.error(err) + reject(err) + } + }) + // #endif + + // #ifdef H5 + // mime类型 + let mimeString = base64.split(',')[0].split(':')[1].split(';')[0]; + //base64 解码 + let byteString = atob(base64.split(',')[1]); + //创建缓冲数组 + let arrayBuffer = new ArrayBuffer(byteString.length); + //创建视图 + let intArray = new Uint8Array(arrayBuffer); + for (let i = 0; i < byteString.length; i++) { + intArray[i] = byteString.charCodeAt(i); + } + resolve(URL.createObjectURL(new Blob([intArray], { + type: mimeString + }))) + // #endif + + // #ifdef APP-PLUS + const bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now()) + bitmap.loadBase64Data(base64, () => { + if (!format) { + reject(new Error('ERROR_BASE64SRC_PARSE')) + } + const time = new Date().getTime(); + const filePath = `_doc/uniapp_temp/${time}.${format}` + bitmap.save(filePath, {}, + () => { + bitmap.clear() + resolve(filePath) + }, + (error) => { + bitmap.clear() + reject(error) + }) + }, (error) => { + bitmap.clear() + reject(error) + }) + // #endif + }) +} + +/** + * 路径转base64 + * @param {Object} string + */ +export function pathToBase64(path) { + if (/^data:/.test(path)) return path + return new Promise((resolve, reject) => { + // #ifdef H5 + let image = new Image(); + image.setAttribute("crossOrigin", 'Anonymous'); + image.onload = function() { + let canvas = document.createElement('canvas'); + canvas.width = this.naturalWidth; + canvas.height = this.naturalHeight; + canvas.getContext('2d').drawImage(image, 0, 0); + let result = canvas.toDataURL('image/png') + resolve(result); + canvas.height = canvas.width = 0 + } + image.src = path + '?v=' + Math.random() + image.onerror = (error) => { + reject(error); + }; + // #endif + + // #ifdef MP + if (uni.canIUse('getFileSystemManager')) { + uni.getFileSystemManager().readFile({ + filePath: path, + encoding: 'base64', + success: (res) => { + resolve('data:image/png;base64,' + res.data) + }, + fail: (error) => { + console.error({error, path}) + reject(error) + } + }) + } + // #endif + + // #ifdef APP-PLUS + plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), (entry) => { + entry.file((file) => { + const fileReader = new plus.io.FileReader() + fileReader.onload = (data) => { + resolve(data.target.result) + } + fileReader.onerror = (error) => { + reject(error) + } + fileReader.readAsDataURL(file) + }, reject) + }, reject) + // #endif + }) +} + + + +export function getImageInfo(path, useCORS) { + const isCanvas2D = this && this.canvas && this.canvas.createImage + return new Promise(async (resolve, reject) => { + // let time = +new Date() + let src = path.replace(/^@\//,'/') + if (cache[path] && cache[path].errMsg) { + resolve(cache[path]) + } else { + try { + // #ifdef MP || APP-PLUS + if (isBase64(path) && (isCanvas2D ? isPC : true)) { + src = await base64ToPath(path) + } + // #endif + // #ifdef H5 + if(useCORS) { + src = await pathToBase64(path) + } + // #endif + } catch (error) { + reject({ + ...error, + src + }) + } + // #ifndef APP-NVUE + if(isCanvas2D && !isPC) { + const img = this.canvas.createImage() + img.onload = function() { + const image = { + path: img, + width: img.width, + height: img.height + } + cache[path] = image + resolve(cache[path]) + } + img.onerror = function(err) { + reject({err,path}) + } + img.src = src + return + } + // #endif + uni.getImageInfo({ + src, + success: (image) => { + const localReg = /^\.|^\/(?=[^\/])/; + // #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-TOUTIAO + image.path = localReg.test(src) ? `/${image.path}` : image.path; + // #endif + if(isCanvas2D) { + const img = this.canvas.createImage() + img.onload = function() { + image.path = img + cache[path] = image + resolve(cache[path]) + } + img.onerror = function(err) { + reject({err,path}) + } + img.src = src + return + } + // #ifdef APP-PLUS + // console.log('getImageInfo', +new Date() - time) + // ios 比较严格 可能需要设置跨域 + if(uni.getSystemInfoSync().osName == 'ios' && useCORS) { + pathToBase64(image.path).then(base64 => { + image.path = base64 + cache[path] = image + resolve(cache[path]) + }).catch(err => { + console.error({err, path}) + reject({err,path}) + }) + return + } + // #endif + cache[path] = image + resolve(cache[path]) + }, + fail(err) { + console.error({err, path}) + reject({err,path}) + } + }) + } + }) +} + + +// #ifdef APP-PLUS +const getLocalFilePath = (path) => { + if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path + .indexOf('_downloads') === 0) { + return path + } + if (path.indexOf('file://') === 0) { + return path + } + if (path.indexOf('/storage/emulated/0/') === 0) { + return path + } + if (path.indexOf('/') === 0) { + const localFilePath = plus.io.convertAbsoluteFileSystem(path) + if (localFilePath !== path) { + return localFilePath + } else { + path = path.substr(1) + } + } + return '_www/' + path +} +// #endif + + diff --git a/uni_modules/lime-painter/components/lime-painter/lime-painter.vue b/uni_modules/lime-painter/components/lime-painter/lime-painter.vue new file mode 100644 index 0000000..5d895bd --- /dev/null +++ b/uni_modules/lime-painter/components/lime-painter/lime-painter.vue @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + diff --git a/uni_modules/lime-painter/hybrid/html/index.html b/uni_modules/lime-painter/hybrid/html/index.html new file mode 100644 index 0000000..fdf884e --- /dev/null +++ b/uni_modules/lime-painter/hybrid/html/index.html @@ -0,0 +1,119 @@ + + + + + + + ++ ++ + + ++ + ++ + + ++ + ++ + + + + + ++ + + + ++ + + + + + + + + + + + + + \ No newline at end of file diff --git a/uni_modules/lime-painter/hybrid/html/painter.js b/uni_modules/lime-painter/hybrid/html/painter.js new file mode 100644 index 0000000..7c1e2bc --- /dev/null +++ b/uni_modules/lime-painter/hybrid/html/painter.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Painter={})}(this,(function(t){"use strict";var e=function(){return(e=Object.assign||function(t){for(var e,i=1,n=arguments.length;i 0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1] =360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,d=0,l=0,c=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var f=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(f)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(l=p+(v=Math.pow(Math.sin(f),2)*g)),d=-(c=u+v/Math.tan(f))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;f=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(f)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(l=p+(v=Math.pow(Math.sin(f),2)*g)/Math.tan(f)),d=-(c=u+v)}return h=Math.round(h+e/2)+n,d=Math.round(i/2-d)+r,l=Math.round(l+e/2)+n,c=Math.round(i/2-c)+r,{x0:h,y0:d,x1:l,y1:c}}(r,t,e,i,n),a=s.x0,h=s.y0,d=s.x1,l=s.y1,c=o.createLinearGradient(a,h,d,l),f=r.match(/linear-gradient\((.+)\)/)[1],u=X(f.substring(f.indexOf(",")+1)),p=0;p t.length)&&(e=t.length);for(var i=0,n=new Array(e);i =t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Z(t){return"number"==typeof t}function K(t){return"auto"===t||null===t}function et(t){return/%$/.test(t)}var it=I,nt=z,rt=S,ot=M,st=k,at=O,ht=T;function dt(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function lt(t,e){var i,n,r=function(t){var e=t.match(/([a-z]+)/)[1];return[e,dt(t.split(e)[1])]}(t),o=r[0],s=r[1],a=e.split(" ");if(s)return(i={})[o+s]=e,i;if(a.length&&!s){var h=a[0],d=a[1],l=a[2],f=a[3];return(n={})[o+c[0]]=h,n[o+c[1]]=d||h,n[o+c[2]]=l||h,n[o+c[3]]=f||d||h,n}}function ct(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o 0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n=""+ct(t.slice(o+1,a)),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var d=0;e.length;)d+=e.pop();return d}var ft,ut=0,pt=function(){function t(){q(this,"elements",[]),q(this,"afterElements",[]),q(this,"beforeElements",[]),q(this,"ids",[]),q(this,"width",0),q(this,"height",0),q(this,"top",0),q(this,"left",0),q(this,"pre",null),q(this,"offsetX",0),q(this,"offsetY",0),ut++,this.id=ut}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0) this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0) 1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return e===l?n:e===h?n/2:"stretch"===e?(n&&t.name==S&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(pt),bt=I,wt=z,mt=S,St=B,zt=k,It=P,Mt=O,Bt=T,kt=0,Wt={left:null,top:null,width:null,height:null},Pt=new Map,Ot=function(){function t(t,e,i,n){var r=this;q(this,"id",kt++),q(this,"style",{left:null,top:null,width:null,height:null}),q(this,"computedStyle",{}),q(this,"originStyle",{}),q(this,"children",{}),q(this,"layoutBox",G({},Wt)),q(this,"contentSize",G({},Wt)),q(this,"clientSize",G({},Wt)),q(this,"borderSize",G({},Wt)),q(this,"offsetSize",G({},Wt)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],r=t.type,s=void 0===r?rt:r,h=t.styles,d=void 0===h?{}:h,l=(e||{}).computedStyle,f=Object.assign({},F);if([nt,it,ot].includes(s)&&!d.display&&(f.display=st),l)for(var u=0;u =0&&l<0,Y=h>=0&&f<0;return i==y[0]&&(this[i].left=t.left+s+g+C+(D?2*-l:0),this[i].top=t.top+h+x+W+(Y?2*-f:0),this[i].width=t.width+(this[i].widthAdd?0:j),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=j,this[i].heightAdd=H),i==y[1]&&(this[i].left=t.left+s+C+(D<0?-l:0),this[i].top=t.top+h+W+(Y?-f:0),this[i].width=t.width+g+w,this[i].height=t.height+x+S),i==y[2]&&(this[i].left=t.left+s+C/2+(D<0?-l:0),this[i].top=t.top+h+W/2+(Y?-f:0),this[i].width=t.width+g+w+C/2+F/2,this[i].height=t.height+x+S+T/2+W/2),i==y[3]&&(this[i].left=t.left+(D<0?-l:0),this[i].top=t.top+(Y?-f:0),this[i].width=t.width+g+w+C+F+s+l,this[i].height=t.height+x+S+T+W+f+h),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,h=void 0===a?0:a,d=o.borderTop,l=(d=void 0===d?{}:d).borderTopWidth,c=void 0===l?h:l,f=o.borderBottom,u=(f=void 0===f?{}:f).borderBottomWidth,p=void 0===u?h:u,g=o.borderRight,v=(g=void 0===g?{}:g).borderRightWidth,x=void 0===v?h:v,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?h:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,B=void 0===M?0:M,k=S.paddingBottom,W=void 0===k?0:k,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+B+x+m),1!==i||n||(t.height-=I+W+c+p)}this.layoutBox&&(y.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=t.padding||{},h=a.paddingBottom,d=void 0===h?0:h,l=a.paddingRight,c=void 0===l?0:l,f=G({},this.contentSize,{left:r,top:s}),u=this.contentSize.top-this.offsetSize.top,p=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var g,v=Q(this.root.fixedLine.elements);!(g=v()).done;){var y=g.value;y.setPosition(y,this.root.offsetSize),y.getBoxPosition()}}if(e)for(var x,b=Q(e.elements);!(x=b()).done;){var w=x.value;w.setPosition(w,f),w.style.left+=r+p+c,w.style.top+=s+u+d,w.getBoxPosition()}if(i)for(var m,S=Q(i);!(m=S()).done;){m.value.layout(f.top+u,f.left+p)}return this.layoutBoxUpdate(f,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==St},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==It},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==It)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==zt},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,d=void 0===h?0:h,l=i.top,c=void 0===l?0:l,f=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,B=i.position;i.textIndent;var k=i.lineClamp,W=i.lineHeight,P=i.padding,O=void 0===P?{}:P,T=i.margin,L=void 0===T?{}:T,R=i.border,F=(R=void 0===R?{}:R).borderWidth,A=void 0===F?0:F,E=i.borderRight,C=(E=void 0===E?{}:E).borderRightWidth,j=void 0===C?A:C,H=i.borderLeft,D=(H=void 0===H?{}:H).borderLeftWidth,Y=void 0===D?A:D,U=o.contentSize&&o.contentSize.width,N=o.contentSize&&o.contentSize.height;if(et(g)&&U&&(g=$(g,U)),et(g)&&!U&&(g=null),et(m)&&N&&(m=$(m,N)),et(m)&&!N&&(m=null),et(v)&&U&&(v=$(v,U)),et(y)&&U&&(y=$(y,U)),et(x)&&N&&(x=$(x,N)),et(b)&&N&&(b=$(b,N)),i.padding&&U)for(var _ in i.padding)Object.hasOwnProperty.call(O,_)&&(O[_]=$(O[_],U));var X=O.paddingRight,q=void 0===X?0:X,G=O.paddingLeft,V=void 0===G?0:G;if(i.margin&&[L.marginLeft,L.marginRight].includes("auto"))if(g){var J=U&&U-g-q-V-Y-j||0;L.marginLeft==L.marginRight?L.marginLeft=L.marginRight=J/2:K(L.marginLeft)?L.marginLeft=J:L.marginRight=J}else L.marginLeft=L.marginRight=0;var Q=L.marginRight,Z=void 0===Q?0:Q,tt=L.marginLeft,it={width:g,height:m,left:0,top:0},nt=V+q+Y+j+(void 0===tt?0:tt)+Z;if(this.offsetWidth=nt,e==wt&&!this.attributes.widths){var rt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),rt.length,"\n"==rt&&(rt="",this.isBr=!0),(""+rt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=Pt.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return Pt.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==bt&&null==g){var ot=n.width,st=n.height;it.width=this.contrastSize(Math.round(ot*m/st)||0,v,y),this.layoutBoxUpdate(it,i,0)}if(e==wt&&null==g){var at=this.attributes.widths,ht=Math.max.apply(Math,at.map((function(t){return t.total})));if(o&&U>0&&(ht>U||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)ht=U;it.width=this.contrastSize(ht,v,y),this.layoutBoxUpdate(it,i,0)}if(e==wt&&(o.style.flex||!this.attributes.lines)){var dt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>it.width?(dt++,e.width):t+e.width}),0)})),dt=k&&dt>k?k:dt,this.attributes.lines=dt}if(e==bt&&null==m){var lt=n.width,ct=n.height;n.text,it.height=this.contrastSize($(it.width*ct/lt)||0,x,b),this.layoutBoxUpdate(it,i,1)}e==wt&&null==m&&(W=$(W,S),it.height=this.contrastSize($(this.attributes.lines*W),x,b),this.layoutBoxUpdate(it,i,1,!0)),!g&&o&&o.children&&U&&(!this.isFlex(o)||o.isFlexCalc)&&([mt,wt].includes(e)&&this.isFlex()||e==mt&&this.isBlock(this)&&this.isInFlow())&&(it.width=this.contrastSize(U-(o.isFlexCalc?0:nt),v,y),this.layoutBoxUpdate(it,i)),g&&!et(g)&&(it.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(it,i,0)),m&&!et(m)&&(it.height=this.contrastSize(it.height,x,b),this.layoutBoxUpdate(it,i,1));var ft=0;if(a.length){var ut=null,gt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(ut,e);if(e.isBr)return gt=!0;t.line&&t.line.canIEnter(e)&&!o&&!gt?t.line.add(e):(gt=!1,(new pt).bind(e)),ut=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new xt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new pt).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new pt).fixedBind(e,1)})),this.lines&&(ft=this.lines.reduce((function(t,e){return t+e.height}),0))}var vt=0,yt=0;if(!g&&(this.isAbsolute||this.isFixed)&&U){var St=B==Mt?U:this.root.width,zt=St-(et(d)?$(d,St):d)-(et(u)?$(u,St):u);vt=i.left?zt:this.lineMaxWidth}if(!m&&(null!=c?c:this.isAbsolute||this.isFixed&&N)){var It=B==Mt?N:this.root.height,Bt=It-(et(c)?$(c,It):c)-(et(f)?$(f,It):f);yt=i.top?Bt:0}if(g&&!et(g)||it.width||(it.width=vt||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?U||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(it,i,0)),m||!ft&&!yt||(it.height=yt||this.contrastSize(ft,x,b),this.layoutBoxUpdate(it,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var kt in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,kt)&&(i.borderRadius[kt]=$(i.borderRadius[kt],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),Tt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],d=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],l=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],c=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],f=[],u=[],p=[],g=[],v=[],y=2;function x(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function b(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)x(t-1,i+n),x(t+1,i-n),x(t-n,i-1),x(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;r e&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n >1&1,i=0;i =5&&(i+=3+v[e]-5);for(e=3;e t||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function B(){var t,i,n,r,o,s=0,a=0;for(i=0;i e*e;)h-=e*e,d++;for(s+=10*d,t=0;t 1)for(P=s[t],k=e-7;;){for(M=e-7;M>P-3&&(b(M,k),!(M 6)for(P=a[t-7],W=17,M=0;M<6;M++)for(k=0;k<3;k++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-k+e-11)]=1,p[2-k+e-11+e*(5-M)]=1):(x(5-M,2-k+e-11),x(2-k+e-11,5-M));for(k=0;k
=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(f[T+2]=0,f[T+3]=0;T--;)P=f[T],f[T+3]|=255&P<<4,f[T+2]=P>>4;f[2]|=255&O<<4,f[1]=O>>4,f[0]=64|O>>12}else{for(f[T+1]=0,f[T+2]=0;T--;)P=f[T],f[T+2]|=255&P<<4,f[T+1]=P>>4;f[1]|=255&O<<4,f[0]=64|O>>4}for(T=O+3-(t<10);T 0;L--)m[L]=m[L]?m[L-1]^c[w(l[m[L]]+T)]:m[L-1];m[0]=c[w(l[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=l[m[T]];for(W=M,k=0,T=0;T>=1)1&k&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,k>>=1)1&k&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i =1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,d=a.height,l=a.left,c=a.top;r.borderRadius,r.backgroundColor;var f=r.color,u=void 0===f?"#000000":f;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,d);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var x=0;x =s||n==d&&o =s)&&(a=e.width/i.width);var l=i.width*a,c=i.height*a,f=r||[],u=f[0],p=f[1],g=Y(u)?$(u,e.width):(e.width-l)*(U(u)?$(u,1):{left:0,center:.5,right:1}[u||"center"]),v=Y(p)?$(p,e.height):(e.height-c)*(U(p)?$(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(l,e.width),dh:M(c,e.height)}}({objectFit:u,objectPosition:v},e.contentSize,t),o=n.sx,s=n.sy,a=n.sh,h=n.sw,d=n.dx,l=n.dy,c=n.dh,f=n.dw;j==r.MP_BAIDU?i.drawImage(t.src,d+m,l+S,f,c,o,s,h,a):i.drawImage(t.src,o,s,h,a,d+m,l+S,f,c)}else i.drawImage(t.src,m,S,b,w)},B=function(){i.restore(),k.drawView(e,o,!1,!0,!1),h(1)},function(t){M(t),B()}(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},t.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,d=e.top,l=a.width,c=a.height,f=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?Ct:I,B=i.backgroundColor,k=i.lineClamp,W=i.backgroundClip,P=i.textShadow,O=i.textDecoration;if(m=Y(m)?m:0,this.drawView(e,i,W!=Rt),g=$(g,v),t){o.save(),h+=f,d+=u;var T=n.fontHeight,L=n.descent,R=void 0===L?0:L,F=n.ascent,A=R+(void 0===F?0:F);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(Ct),o.setTextAlign(S),W?this.setBackground(B,l,c,h,d):o.setFillStyle(p),S){case Ht:break;case Dt:h+=.5*l;break;case Yt:h+=l}var E=n.lines*g,C=Math.ceil((c-E)/2);switch(C<0&&(C=0),M){case Et:break;case Ct:d+=C;break;case jt:d+=2*C}var j=(g-T)/2,H=g/2,D=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==Et?{fix:A?void 0===r?0:r:H-j/2,lineY:A?0:j-j/2}:M==Ct?{fix:A?H+n/4:H,lineY:A?0:j}:M==jt?{fix:A?g-n:H+j/2,lineY:A?2*j:j+j/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case Ht:t=t,r+=i;break;case Dt:r=(t-=i/2)+i;break;case Yt:r=t,t-=i}if(O){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(O)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(O)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(O)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:P}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:P}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:P}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var _=D(t),X=_.fix,q=void 0===X?0:X,G=_.lineY;return N(t,h+m,d+q),U(h+m,d+G,n&&n.widths&&n.widths[0].total||n.text),d+=g,o.restore(),void this.setBorder(e,i)}for(var V=d,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=k&&(Q+="…"),Z++,nt=0;var dt=D(Q);q=dt.fix,G=dt.lineY;N(Q,J,d+q),U(J,d+G,nt),d+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==k&&K+nt V+c||Z>k)break}}o.restore()}},t.prototype.source=function(t){return i(this,void 0,void 0,(function(){var e,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(!t.type)for(i in t.type=At,t.styles=t.styles||t.css||{},t)["views","children","type","css","styles"].includes(i)||(t.styles[i]=t[i],delete t[i]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=n.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},t.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},t.prototype.create=function(t,r){return i(this,void 0,void 0,(function(){function i(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return t.forEach((function(t){var s=t.styles,a=void 0===s?{}:s,h=t.children,d=void 0===h?[]:h,l=t.text,c=void 0===l?"":l,f=t.type,u=void 0===f?"":f,p={};p=e(r?e({},n):{},a);var g={},v={},y={};Object.keys(p).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=lt(t,p[t]);Object.keys(e).map((function(t){t.includes("Left")?v[t]=e[t]:t.includes("Right")?y[t]=e[t]:g[t]=e[t]}))}}));if(p.textIndent&&(v.textIndent=p.textIndent,delete n.textIndent),""!==c){var x=Array.from(c);x.forEach((function(t,e){var i=Object.assign({},p,g);0===e?Object.assign(i,v):e==x.length-1&&Object.assign(i,y),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(u==Lt||u==Ft)o.push(t);else if("block"===a.display&&d.length>0){var b=i(d,p,!1);t.children=b,t.flattened=!0,o.push(t)}else if(d.length>0){b=i(d,p,r);o=o.concat(b)}})),o}var o,s,a,h,d,l,c,f,u,p,g,v,y,x,b,w,m,S,z,I,M;return n(this,(function(n){switch(n.label){case 0:if(!t)return[2];if(t.styles||(t.styles=t.css||{}),o=t.type,s=o==Lt,a=[Rt,Ft].includes(o),h="textBox"==o,d=t.styles||{},l=d.backgroundImage,c=d.display,s&&!t.src&&!t.url)return[2];if(c==W)return[2];if(a||h){if(f=t.children,!t.text&&(!f||f&&!f.length))return[2];f&&f.length&&!t.flattened&&(u=i(t.children),t.type="view",t.children=u)}if(!(s||t.type==At&&l))return[3,4];p=s?t.src:"",g=/url\((.+)\)/.exec(l),l&&g&&g[1]&&(p=g[1]||""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.getImageInfo(p)];case 2:return v=n.sent(),y=v.width,x=v.height,!(b=v.path)&&s?[2]:(b&&(t.attributes=Object.assign(t.attributes||{},{width:y,height:x,path:b,src:b,naturalSrc:p})),[3,4]);case 3:return w=n.sent(),t.type!=At?[2]:(this.lifecycle("onEffectFail",e(e({},w),{src:p})),[3,4]);case 4:if(this.count+=1,m=new Ot(t,r,this.root,this.ctx),!(S=t.views||t.children))return[3,8];z=0,n.label=5;case 5:return z 0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;r("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("redirectTo",{url:encodeURI(n)})},getEnv:function(e){o()?e({nvue:!0}):window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r("postMessage",e.data||{})}},d=/uni-app/i.test(navigator.userAgent),s=/Html5Plus/i.test(navigator.userAgent),w=/complete|loaded|interactive/;var u=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var g=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var v=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var m=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);var f=window.ks&&window.ks.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var l=window.tt&&window.tt.miniProgram&&/Lark|Feishu/i.test(navigator.userAgent);var _=window.jd&&window.jd.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);for(var E,b=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},h=[function(e){if(d||s)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&w.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),a},function(e){if(m)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(u){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(v)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(f)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.ks.miniProgram},function(e){if(l)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(_)return window.JDJSBridgeReady&&window.JDJSBridgeReady.invoke?setTimeout(e,0):document.addEventListener("JDJSBridgeReady",e),window.jd.miniProgram},function(e){return document.addEventListener("DOMContentLoaded",e),a}],y=0;y \s]+))?)*)\s*(\/?)>/; +var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/; +var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 + +var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5 +// fixed by xxx 将 ins 标签从块级名单中移除 + +var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5 + +var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open +// (and which close themselves) + +var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled" + +var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything) + +var special = makeMap('script,style'); +function HTMLParser(html, handler) { + var index; + var chars; + var match; + var stack = []; + var last = html; + + stack.last = function () { + return this[this.length - 1]; + }; + + while (html) { + chars = true; // Make sure we're not in a script or style element + + if (!stack.last() || !special[stack.last()]) { + // Comment + if (html.indexOf(''); + + if (index >= 0) { + if (handler.comment) { + handler.comment(html.substring(4, index)); + } + + html = html.substring(index + 3); + chars = false; + } // end tag + + } else if (html.indexOf('') == 0) { + match = html.match(endTag); + + if (match) { + html = html.substring(match[0].length); + match[0].replace(endTag, parseEndTag); + chars = false; + } // start tag + + } else if (html.indexOf('<') == 0) { + match = html.match(startTag); + + if (match) { + html = html.substring(match[0].length); + match[0].replace(startTag, parseStartTag); + chars = false; + } + } + + if (chars) { + index = html.indexOf('<'); + var text = index < 0 ? html : html.substring(0, index); + html = index < 0 ? '' : html.substring(index); + + if (handler.chars) { + handler.chars(text); + } + } + } else { + html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) { + text = text.replace(/|/g, '$1$2'); + + if (handler.chars) { + handler.chars(text); + } + + return ''; + }); + parseEndTag('', stack.last()); + } + + if (html == last) { + throw 'Parse Error: ' + html; + } + + last = html; + } // Clean up any remaining tags + + + parseEndTag(); + + function parseStartTag(tag, tagName, rest, unary) { + tagName = tagName.toLowerCase(); + if (block[tagName]) { + while (stack.last() && inline[stack.last()]) { + parseEndTag('', stack.last()); + } + } + + if (closeSelf[tagName] && stack.last() == tagName) { + parseEndTag('', tagName); + } + + unary = empty[tagName] || !!unary; + + if (!unary) { + stack.push(tagName); + } + + if (handler.start) { + var attrs = []; + rest.replace(attr, function (match, name) { + var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; + attrs.push({ + name: name, + value: value, + escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // " + + }); + }); + + if (handler.start) { + handler.start(tagName, attrs, unary); + } + } + } + + function parseEndTag(tag, tagName) { + // If no tag name is provided, clean shop + if (!tagName) { + var pos = 0; + } // Find the closest opened tag of the same type + else { + for (var pos = stack.length - 1; pos >= 0; pos--) { + if (stack[pos] == tagName) { + break; + } + } + } + + if (pos >= 0) { + // Close all the open elements, up the stack + for (var i = stack.length - 1; i >= pos; i--) { + if (handler.end) { + handler.end(stack[i]); + } + } // Remove the open elements from the stack + + + stack.length = pos; + } + } +} + +function makeMap(str) { + var obj = {}; + var items = str.split(','); + + for (var i = 0; i < items.length; i++) { + obj[items[i]] = true; + } + + return obj; +} + +function removeDOCTYPE(html) { + return html.replace(/<\?xml.*\?>\n/, '').replace(/\n/, '').replace(/\n/, ''); +} + +function parseAttrs(attrs) { + return attrs.reduce(function (pre, attr) { + var value = attr.value; + var name = attr.name; + if (pre[name]) { + pre[name] = pre[name] + " " + value; + } else { + pre[name] = value; + } + + return pre; + }, {}); +} +function convertStyleStringToJSON(styleString) { + var styles = styleString.split(";"); // 通过分号将样式字符串分割为多个样式声明 + var result = {}; + + styles.forEach(function(style) { + var styleParts = style.split(":"); // 通过冒号将样式声明分割为属性和值 + var property = styleParts[0].trim(); + var value = styleParts[1] && styleParts[1].trim(); + + if (property && value) { + result[property] = value; // 将属性和值添加到结果对象中 + } + }); + + return result; +} +function parseHtml(html) { + html = removeDOCTYPE(html); + var stacks = []; + var results = { + node: 'root', + children: [] + }; + HTMLParser(html, { + start: function start(tag, attrs, unary) { + var node = { + name: tag + }; + + if (attrs.length !== 0) { + node.attrs = parseAttrs(attrs); + node.styles = node.attrs.style ? convertStyleStringToJSON(node.attrs.style) : {} + } + + if(!node.type) { + if(inline[node.name] && node.name !== 'img' ) { + node.type = 'text'; + if(node.name == 'br') { + node.text = '\n' + } else if(node.name == 'strong'){ + node.styles.fontWeight = 'bold' + } + } else if(node.name == 'img'){ + node.type = 'image' + node.src = node.attrs.src + } else { + node.type = 'view' + if(['h1','h2','h3','h4','h5','h6'].includes(node.name)) { + node.styles.fontWeight = 'bold' + } + } + } + if (unary) { + var parent = stacks[0] || results; + + if (!parent.children) { + parent.children = []; + } + + parent.children.push(node); + } else { + stacks.unshift(node); + } + }, + end: function end(tag) { + var node = stacks.shift(); + if (node.name !== tag) console.error('invalid state: mismatch end tag'); + if (stacks.length === 0) { + results.children.push(node); + } else { + var parent = stacks[0]; + + if (!parent.children) { + parent.children = []; + } + parent.children.push(node); + } + const isTextBox = node.children && node.children.length > 1 && node.children.every(child => { + return ['text','image'].includes(child.type) + }) + if(isTextBox) { + node.type = 'textBox' + } + }, + chars: function chars(text) { + var node = { + type: 'text', + text: text + }; + + if (stacks.length === 0) { + results.children.push(node); + } else { + var parent = stacks[0]; + + if (!parent.children) { + parent.children = []; + } + + parent.children.push(node); + } + }, + comment: function comment(text) { + var node = { + node: 'comment', + text: text + }; + var parent = stacks[0]; + + if (!parent.children) { + parent.children = []; + } + + parent.children.push(node); + } + }); + return results.children; +} + +export default parseHtml; \ No newline at end of file diff --git a/uni_modules/lime-painter/readme.md b/uni_modules/lime-painter/readme.md new file mode 100644 index 0000000..47a14ea --- /dev/null +++ b/uni_modules/lime-painter/readme.md @@ -0,0 +1,963 @@ +# Painter 画板 测试版 + +> uniapp 海报画板,更优雅的海报生成方案 +> [查看更多 站点 1](https://limeui.qcoon.cn/#/painter) +> [查看更多 站点 2](http://liangei.gitee.io/limeui/#/painter) +> Q 群:1169785031 + +## 平台兼容 + +| H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 头条小程序 | QQ 小程序 | App | +| --- | ---------- | ------------ | ---------- | ---------- | --------- | --- | +| √ | √ | √ | 未测 | √ | √ | √ | + +## 安装 +在市场导入**[海报画板](https://ext.dcloud.net.cn/plugin?id=2389)uni_modules**版本的即可,无需`import` + +## 代码演示 + +### 插件demo +- lime-painter 为 demo +- 位于 uni_modules/lime-painter/components/lime-painter +- 导入插件后直接使用可查看demo +```vue + +``` + + +### 基本用法 + +- 插件提供 JSON 及 Template 的方式绘制海报 +- 参考 css 块状流布局模拟 css schema。 +- 另外flex布局还不是成完善,请谨慎使用,普通的流布局我觉得已经够用了。 + +#### 方式一 Template + +- 提供`l-painter-view`、`l-painter-text`、`l-painter-image`、`l-painter-qrcode`四种类型组件 +- 通过 `css` 属性绘制样式,与 style 使用方式保持一致。 +```html + + //如果使用Template出现顺序错乱,可使用`template` 等所有变量完成再显示 + + +``` + +#### 方式二 JSON + +- 在 json 里四种类型组件的`type`为`view`、`text`、`image`、`qrcode` +- 通过 `board` 设置海报所需的 JSON 数据进行绘制或`ref`获取组件实例调用组件内的`render(json)` +- 所有类型的 schema 都具有`css`字段,css 的 key 值使用**驼峰**如:`lineHeight` + +```html ++ + + + +``` + +```js +data() { + return { + poster: { + css: { + // 根节点若无尺寸,自动获取父级节点 + width: '750rpx' + }, + views: [ + { + css: { + background: "#07c160", + height: "120rpx", + width: "120rpx", + display: "inline-block" + }, + type: "view" + }, + { + css: { + background: "#1989fa", + height: "120rpx", + width: "120rpx", + borderTopRightRadius: "60rpx", + borderBottomLeftRadius: "60rpx", + display: "inline-block", + margin: "0 30rpx" + }, + views: [], + type: "view" + }, + { + css: { + background: "#ff9d00", + height: "120rpx", + width: "120rpx", + borderRadius: "50%", + display: "inline-block" + }, + views: [], + type: "view" + }, + ] + } + } +} +``` + +### View 容器 + +- 类似于 `div` 可以嵌套承载更多的 view、text、image,qrcode 共同构建一颗完整的节点树 +- 在 JSON 里具有 `views` 的数组字段,用于嵌套承载节点。 + +#### 方式一 Template + +```html + + +``` + +#### 方式二 JSON + +```js +{ + css: {}, + views: [ + { + type: 'view', + css: { + background: '#f0f0f0', + paddingTop: '100rpx' + }, + views: [ + { + type: 'view', + css: { + background: '#d9d9d9', + width: '33.33%', + height: '100rpx', + display: 'inline-block' + } + }, + { + type: 'view', + css: { + background: '#bfbfbf', + width: '66.66%', + height: '100rpx', + display: 'inline-block' + } + } + ], + + } + ] +} +``` + +### Text 文本 + +- 通过 `text` 属性填写文本内容。 +- 支持`\n`换行符 +- 支持省略号,使用 css 的`line-clamp`设置行数,当文字内容超过会显示省略号。 +- 支持`text-decoration` + +#### 方式一 Template + +```html ++ ++ + + +``` + +#### 方式二 JSON + +```js +// 基础用法 +{ + type: 'text', + text: '登鹳雀楼\n白日依山尽,黄河入海流\n欲穷千里目,更上一层楼', +}, +{ + type: 'text', + text: '登鹳雀楼\n白日依山尽,黄河入海流\n欲穷千里目,更上一层楼', + css: { + // 设置居中对齐 + textAlign: 'center', + // 设置中划线 + textDecoration: 'line-through' + } +}, +{ + type: 'text', + text: '登鹳雀楼\n白日依山尽,黄河入海流\n欲穷千里目,更上一层楼', + css: { + // 设置右对齐 + textAlign: 'right', + } +}, +{ + type: 'text', + text: '登鹳雀楼\n白日依山尽,黄河入海流\n欲穷千里目,更上一层楼', + css: { + // 设置行数,超出显示省略号 + lineClamp: 3, + // 渐变文字 + background: 'linear-gradient(,#ff971b 0%, #1989fa 100%)', + backgroundClip: 'text' + } +} +``` + +### Image 图片 + +- 通过 `src` 属性填写图片路径。 +- 图片路径支持:网络图片,本地 static 里的图片路径,缓存路径,**字节的static目录是写相对路径** +- 通过 `css` 的 `object-fit`属性可以设置图片的填充方式,可选值见下方 CSS 表格。 +- 通过 `css` 的 `object-position`配合 `object-fit` 可以设置图片的对齐方式,类似于`background-position`,详情见下方 CSS 表格。 +- 使用网络图片时:小程序需要去公众平台配置 [downloadFile](https://mp.weixin.qq.com/) 域名 +- 使用网络图片时:**H5 和 Nvue 需要决跨域问题** + +#### 方式一 Template + +```html ++ ++ + + + + + +``` + +#### 方式二 JSON + +```js +// 基础用法 +{ + type: 'image', + src: 'https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg', + css: { + width: '200rpx', + height: '200rpx' + } +}, +// 填充方式 +// css objectFit 设置 填充方式 见下方表格 +{ + type: 'image', + src: 'https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg', + css: { + width: '200rpx', + height: '200rpx', + objectFit: 'contain' + } +}, +// css objectPosition 设置 图片的对齐方式 +{ + type: 'image', + src: 'https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg', + css: { + width: '200rpx', + height: '200rpx', + objectFit: 'contain', + objectPosition: '50% 50%' + } +} +``` + +### Qrcode 二维码 + +- 通过`text`属性填写需要生成二维码的文本。 +- 通过 `css` 里的 `color` 可设置生成码点的颜色。 +- 通过 `css` 里的 `background`可设置背景色。 +- 通过 `css `里的 `width`、`height`设置尺寸。 + +#### 方式一 Template + +```html ++ + + + + + + +``` + +#### 方式二 JSON + +```js +{ + type: 'qrcode', + text: 'limeui.qcoon.cn', + css: { + width: '200rpx', + height: '200rpx', + } +} +``` + +### 富文本 +- 这是一个有限支持的测试能力,只能通过JSON方式,不要抱太大希望! +- 首先需要把富文本转成JSON,这需要引入`parser`这个包,如果你不使用是不会进入主包 + +```html ++ +``` +```js +import parseHtml from '@/uni_modules/lime-painter/parser' +const json = parseHtml(` 测试测试
`) +this.$refs.painter.render(json) +``` + +### 生成图片 + +- 方式1、通过设置`isCanvasToTempFilePath`自动生成图片并在 `@success` 事件里接收海报临时路径 +- 方式2、通过调用内部方法生成图片: + +```html +...code +``` + +```js +this.$refs.painter.canvasToTempFilePathSync({ + fileType: "jpg", + // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url + pathType: 'url', + quality: 1, + success: (res) => { + console.log(res.tempFilePath); + // 非H5 保存到相册 + // H5 提示用户长按图另存 + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: function () { + console.log('save success'); + } + }); + }, +}); +``` + +### 主动调用方式 + +- 通过获取组件实例内部的`render`函数 传递`JSON`即可 + +```html ++``` + +```js +// 渲染 +this.$refs.painter.render(jsonSchema); +// 生成图片 +this.$refs.painter.canvasToTempFilePathSync({ + fileType: "jpg", + // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url + pathType: 'url', + quality: 1, + success: (res) => { + console.log(res.tempFilePath); + // 非H5 保存到相册 + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: function () { + console.log('save success'); + } + }); + }, +}); +``` + + +### H5跨域 +- 一般是需要后端或管理OSS资源的大佬处理 +- 一般OSS的处理方式: + +1、设置来源 +```cmd +* +``` + +2、允许Methods +```html +GET +``` + +3、允许Headers +```html +access-control-allow-origin:* +``` + +4、最后如果还是不行,可试下给插件设置`useCORS` +```html + +``` + + + +### 海报示例 + +- 提供一份示例,只把插件当成生成图片的工具,非必要不要在弹窗里使用。 +- 通过设置`isCanvasToTempFilePath`主动生成图片,再由 `@success` 事件接收海报临时路径 +- 设置`hidden`隐藏画板。 +请注意,示例用到了图片,海报的渲染是包括下载图片的时间,也许在某天图片会失效或访问超级慢,请更换为你的图片再查看,另外如果你是小程序请在使用示例时把**不校验合法域名**勾上!!!!!不然不显示还以为是插件的锅,求求了大佬们! +#### 方式一 Template + +```html + + + +``` + +```js +data() { + return { + path: '' + } +} +``` + +#### 方式二 JSON + +```html ++ + ++ + + ++ + ++ + + + + ++ + + + + ++ + + +``` + +```js +data() { + return { + path: '', + poster: { + css: { + width: "750rpx", + paddingBottom: "40rpx", + background: "linear-gradient(,#000 0%, #ff5000 100%)" + }, + views: [ + { + src: "https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg", + type: "image", + css: { + background: "#fff", + objectFit: "cover", + marginLeft: "40rpx", + marginTop: "40rpx", + width: "84rpx", + border: "2rpx solid #fff", + boxSizing: "border-box", + height: "84rpx", + borderRadius: "50%" + } + }, + { + type: "view", + css: { + marginTop: "40rpx", + paddingLeft: "20rpx", + display: "inline-block" + }, + views: [ + { + text: "隔壁老王", + type: "text", + css: { + display: "block", + paddingBottom: "10rpx", + color: "#fff", + fontSize: "32rpx", + fontWeight: "bold" + } + }, + { + text: "为您挑选了一个好物", + type: "text", + css: { + color: "rgba(255,255,255,.7)", + fontSize: "24rpx" + }, + } + ], + }, + { + css: { + marginLeft: "40rpx", + marginTop: "30rpx", + padding: "32rpx", + boxSizing: "border-box", + background: "#fff", + borderRadius: "16rpx", + width: "670rpx", + boxShadow: "0 20rpx 58rpx rgba(0,0,0,.15)" + }, + views: [ + { + src: "https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg", + type: "image", + css: { + objectFit: "cover", + objectPosition: "50% 50%", + width: "606rpx", + height: "606rpx" + }, + }, { + css: { + marginTop: "32rpx", + color: "#FF0000", + fontWeight: "bold", + fontSize: "28rpx", + lineHeight: "1em" + }, + views: [{ + text: "¥", + type: "text", + css: { + verticalAlign: "bottom" + }, + }, { + text: "39", + type: "text", + css: { + verticalAlign: "bottom", + fontSize: "58rpx" + }, + }, { + text: ".39", + type: "text", + css: { + verticalAlign: "bottom" + }, + }, { + text: "¥59.99", + type: "text", + css: { + verticalAlign: "bottom", + paddingLeft: "10rpx", + fontWeight: "normal", + textDecoration: "line-through", + color: "#999999" + } + }], + + type: "view" + }, { + css: { + marginTop: "32rpx", + fontSize: "26rpx", + color: "#8c5400" + }, + views: [{ + text: "自营", + type: "text", + css: { + color: "#212121", + background: "#ffb400" + }, + }, { + text: "30天最低价", + type: "text", + css: { + marginLeft: "16rpx", + background: "#fff4d9", + textDecoration: "line-through" + }, + }, { + text: "满减优惠", + type: "text", + css: { + marginLeft: "16rpx", + background: "#fff4d9" + }, + }, { + text: "超高好评", + type: "text", + css: { + marginLeft: "16rpx", + background: "#fff4d9" + }, + + }], + + type: "view" + }, { + css: { + marginTop: "30rpx" + }, + views: [ + { + text: "360儿童电话手表9X 智能语音问答定位支付手表 4G全网通20米游泳级防水视频通话拍照手表男女孩星空蓝", + type: "text", + css: { + paddingRight: "32rpx", + boxSizing: "border-box", + lineClamp: 2, + color: "#333333", + lineHeight: "1.8em", + fontSize: "36rpx", + width: "478rpx" + }, + }, { + text: "limeui.qcoon.cn", + type: "qrcode", + css: { + width: "128rpx", + height: "128rpx", + }, + + }], + type: "view" + }], + type: "view" + } + ] + } + } +} +``` + + +### 自定义字体 +- 需要平台的支持,已知微信小程序支持,其它的没试过,如果可行请告之 + +``` +// 需要在app.vue中下载字体 +uni.loadFontFace({ + global:true, + scopes: ['native'], + family: '自定义字体名称', + source: 'url("https://sungd.github.io/Pacifico.ttf")', + + success() { + console.log('success') + } +}) + + +// 然后就可以在插件的css中写font-family: '自定义字体名称' +``` + + +### Nvue +- 必须为HBX 3.4.11及以上 + + +### 原生小程序 + +- 插件里的`painter.js`支持在原生小程序中使用 +- new Painter 之后在`source`里传入 JSON +- 再调用`render`绘制海报 +- 如需生成图片,请查看微信小程序 cavnas 的[canvasToTempFilePath](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html) + +```html + +``` + +```js +import { Painter } from "./painter"; +page({ + data: { + poster: { + css: { + width: "750rpx", + }, + views: [ + { + type: "view", + css: { + background: "#d2d4c8", + paddingTop: "100rpx", + }, + views: [ + { + type: "view", + css: { + background: "#5f7470", + width: "33.33%", + height: "100rpx", + display: "inline-block", + }, + }, + { + type: "view", + css: { + background: "#889696", + width: "33.33%", + height: "100rpx", + display: "inline-block", + }, + }, + { + type: "view", + css: { + background: "#b8bdb5", + width: "33.33%", + height: "100rpx", + display: "inline-block", + }, + }, + ], + }, + ], + }, + }, + async onLoad() { + const res = await this.getCentext(); + const painter = new Painter(res); + // 返回计算布局后的整个内容尺寸 + const { width, height } = await painter.source(this.data.poster); + // 得到计算后的尺寸后 可给canvas尺寸赋值,达到动态响应效果 + // 渲染 + await painter.render(); + }, + // 获取canvas 2d + // 非2d 需要传一个 createImage 方法用于获取图片信息 即把 getImageInfo 的 success 通过 promise resolve 返回 + getCentext() { + return new Promise((resolve) => { + wx.createSelectorQuery() + .select(`#painter`) + .node() + .exec((res) => { + let { node: canvas } = res[0]; + resolve({ + canvas, + context: canvas.getContext("2d"), + width: canvas.width, + height: canvas.height, + // createImage: getImageInfo() + pixelRatio: 2, + }); + }); + }); + }, +}); +``` + +### 旧版(1.6.x)更新 + +- 由于 1.8.x 版放弃了以定位的方式,所以 1.6.x 版更新之后要每个样式都加上`position: absolute` +- 旧版的 `image` mode 模式被放弃,使用`object-fit` +- 旧版的 `isRenderImage` 改成 `is-canvas-to-temp-file-path` +- 旧版的 `maxLines` 改成 `line-clamp` + +## API + +### Props + +| 参数 | 说明 | 类型 | 默认值 | +| -------------------------- | ------------------------------------------------------------ | ---------------- | ------------ | +| board | JSON 方式的海报元素对象集 | object | - | +| css | 海报内容最外层的样式,可以理解为`body` | object | 参数请向下看 | +| custom-style | canvas 元素的样式 | string | | +| hidden | 隐藏画板 | boolean | `false` | +| is-canvas-to-temp-file-path | 是否生成图片,在`@success`事件接收图片地址 | boolean | `false` | +| after-delay | 生成图片错乱,可延时生成图片 | number | `100` | +| type | canvas 类型,对微信头条支付宝小程序可有效,可选值:`2d`,`''` | string | `2d` | +| file-type | 生成图片的后缀类型, 可选值:`png`、`jpg` | string | `png` | +| path-type | 生成图片路径类型,可选值`url`、`base64` | string | `-` | +| pixel-ratio | 生成图片的像素密度,默认为对应手机的像素密度,`nvue`无效 | number | `-` | +| hidpi | H5和APP是否使用高清处理 | boolean | `true` | +| width | **废弃** 画板的宽度,一般只用于通过内部方法时加上 | number | `` | +| height | **废弃** 画板的高度 ,同上 | number | `` | + +### css +| 属性名 | 支持的值或类型 | 默认值 | +| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | +| (min\max)width | 支持`%`、`rpx`、`px` | - | +| height | 同上 | - | +| color | `string` | - | +| position | 定位,可选值:`absolute`、`fixed` | - | +| ↳ left、top、right、bottom | 配合`position`才生效,支持`%`、`rpx`、`px` | - | +| margin | 可简写或各方向分别写,如:`margin-top`,支持`auto`、`rpx`、`px` | - | +| padding | 可简写或各方向分别写,支持`rpx`、`px` | - | +| border | 可简写或各个值分开写:`border-width`、`border-style` 、`border-color`,简写请按顺序写 | - | +| line-clamp | `number`,超过行数显示省略号 | - | +| vertical-align | 文字垂直对齐,可选值:`bottom`、`top`、`middle` | `middle` | +| line-height | 文字行高,支持`rpx`、`px`、`em` | `1.4em` | +| font-weight | 文字粗细,可选值:`normal`、`bold` | `normal` | +| font-size | 文字大小,`string`,支持`rpx`、`px` | `14px` | +| text-decoration | 文本修饰,可选值:`underline` 、`line-through`、`overline` | - | +| text-stroke | 文字描边,可简写或各个值分开写,如:`text-stroke-color`, `text-stroke-width` | - | +| text-align | 文本水平对齐,可选值:`right` 、`center` | `left` | +| display | 框类型,可选值:`block`、`inline-block`、`flex`、`none`,当为`none`时是不渲染该段, `flex`功能简陋。 | - | +| flex | 配合 display: flex; 属性定义了在分配多余空间,目前只用为数值如: flex: 1 | - | +| align-self | 配合 display: flex; 单个项目垂直轴对齐方式: `flex-start` `flex-end` `center` | `flex-start` | +| justify-content | 配合 display: flex; 水平轴对齐方式: `flex-start` `flex-end` `center` | `flex-start` | +| align-items | 配合 display: flex; 垂直轴对齐方式: `flex-start` `flex-end` `center` | `flex-start` | +| border-radius | 圆角边框,支持`%`、`rpx`、`px` | - | +| box-sizing | 可选值:`border-box` | - | +| box-shadow | 投影 | - | +| background(color) | 支持渐变,但必须写百分比!如:`linear-gradient(,#ff971b 0%, #ff5000 100%)`、`radial-gradient(#0ff 15%, #f0f 60%)`,目前 radial-gradient 渐变的圆心为元素中点,半径为最长边,不支持设置 | - | +| background-clip | 文字渐变,配合`background`背景渐变,设置`background-clip: text` 达到文字渐变效果 | - | +| background-image | view 元素背景:`url(src)`,若只是设置背景图,请不要设置`background-repeat` | - | +| background-repeat | 设置是否及如何重复背景纹理,可选值:`repeat`、`repeat-x`、`repeat-y`、`no-repeat` | `repeat` | +| [object-fit](https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-fit/) | 图片元素适应容器方式,类似于`mode`,可选值:`cover`、 `contain`、 `fill`、 `none` | - | +| [object-position](https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-position) | 图片的对齐方式,配合`object-fit`使用 | - | + +### 图片填充模式 object-fit + +| 名称 | 含义 | +| ------- | ------------------------------------------------------ | +| contain | 保持宽高缩放图片,使图片的长边能完全显示出来 | +| cover | 保持宽高缩放图片,使图片的短边能完全显示出来,裁剪长边 | +| fill | 拉伸图片,使图片填满元素 | +| none | 保持图片原有尺寸 | + +### 事件 Events + +| 事件名 | 说明 | 返回值 | +| -------- | ---------------------------------------------------------------- | ------ | +| success | 生成图片成功,若使用`is-canvas-to-temp-filePath` 可以接收图片地址 | path | +| fail | 生成图片失败 | error | +| done | 绘制成功 | | +| progress | 绘制进度 | number | + +### 暴露函数 Expose +| 事件名 | 说明 | 返回值 | +| -------- | ---------------------------------------------------------------- | ------ | +| render(object) | 渲染器,传入JSON 绘制海报 | promise | +| [canvasToTempFilePath](https://uniapp.dcloud.io/api/canvas/canvasToTempFilePath.html#canvastotempfilepath)(object) | 把当前画布指定区域的内容导出生成指定大小的图片,并返回文件临时路径。 | | +| canvasToTempFilePathSync(object) | 同步接口,同上 | | + + +## 常见问题 + +- 1、H5 端使用网络图片需要解决跨域问题。 +- 2、小程序使用网络图片需要去公众平台增加下载白名单!二级域名也需要配! +- 3、H5 端生成图片是 base64,有时显示只有一半可以使用原生标签` ` +- 4、发生保存图片倾斜变形或提示 native buffer exceed size limit 时,使用 pixel-ratio="2"参数,降分辨率。 +- 5、h5 保存图片不需要调接口,提示用户长按图片保存。 +- 6、画板不能隐藏,包括`v-if`,`v-show`、`display:none`、`opacity:0`,另外也不要把画板放在弹窗里。如果需要隐藏画板请设置 `custom-style="position: fixed; left: 200%"` +- 7、微信小程序真机调试请使用 **真机调试2.0**,不支持1.0。 +- 8、微信小程序打开调试时可以生但并闭无法生成时,这种情况一般是没有在公众号配置download域名 +- 9、HBX 3.4.5之前的版本不支持vue3 +- 10、在微信开发工具上 canvas 层级最高无法zindex,并不影响真机 +- 11、请不要导入非uni_modules插件 +- 12、关于QQ小程序 报 Propertyor method"toJSON"is not defined 请把基础库调到 1.50.3 +- 13、支付宝小程序 IDE 不支持 生成图片 请以真机调试结果为准 +- 14、返回值为字符串 `data:,` 大概是尺寸超过限制,设置 pixel-ratio="2" +- 华为手机 APP 上无法生成图片,请使用 HBX2.9.11++(已过时,忽略这条) +- IOS APP 请勿使用 HBX2.9.3.20201014 的版本!这个版本无法生成图片。(已过时,忽略这条) +- 苹果微信 7.0.20 存在闪退和图片无法 onload 为微信 bug(已过时,忽略这条) +- 微信小程序 IOS 旧接口 如父级设置圆角,子级也设会导致子级的失效,为旧接口BUG。 +- 微信小程序 安卓 旧接口 如使用图片必须加背景色,为旧接口BUG。 + +## 打赏 + +如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。 + + + \ No newline at end of file diff --git a/uni_modules/uni-popup/changelog.md b/uni_modules/uni-popup/changelog.md new file mode 100644 index 0000000..98d9d08 --- /dev/null +++ b/uni_modules/uni-popup/changelog.md @@ -0,0 +1,70 @@ +## 1.8.4(2023-11-15) +- 新增 uni-popup 支持uni-app-x 注意暂时仅支持 `maskClick` `@open` `@close` +## 1.8.3(2023-04-17) +- 修复 uni-popup 重复打开时的 bug +## 1.8.2(2023-02-02) +- uni-popup-dialog 组件新增 inputType 属性 +## 1.8.1(2022-12-01) +- 修复 nvue 下 v-show 报错 +## 1.8.0(2022-11-29) +- 优化 主题样式 +## 1.7.9(2022-04-02) +- 修复 弹出层内部无法滚动的bug +## 1.7.8(2022-03-28) +- 修复 小程序中高度错误的bug +## 1.7.7(2022-03-17) +- 修复 快速调用open出现问题的Bug +## 1.7.6(2022-02-14) +- 修复 safeArea 属性不能设置为false的bug +## 1.7.5(2022-01-19) +- 修复 isMaskClick 失效的bug +## 1.7.4(2022-01-19) +- 新增 cancelText \ confirmText 属性 ,可自定义文本 +- 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色 +- 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题 +## 1.7.3(2022-01-13) +- 修复 设置 safeArea 属性不生效的bug +## 1.7.2(2021-11-26) +- 优化 组件示例 +## 1.7.1(2021-11-26) +- 修复 vuedoc 文字错误 +## 1.7.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup) +## 1.6.2(2021-08-24) +- 新增 支持国际化 +## 1.6.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.6.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.5.0(2021-06-23) +- 新增 mask-click 遮罩层点击事件 +## 1.4.5(2021-06-22) +- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.4(2021-06-18) +- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.3(2021-06-08) +- 修复 错误的 watch 字段 +- 修复 safeArea 属性不生效的问题 +- 修复 点击内容,再点击遮罩无法关闭的Bug +## 1.4.2(2021-05-12) +- 新增 组件示例地址 +## 1.4.1(2021-04-29) +- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 +## 1.4.0 (2021-04-29) +- 新增 type 属性的 left\right 值,支持左右弹出 +- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 +- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 +- 新增 safeArea 属性,是否适配底部安全区 +- 修复 App\h5\微信小程序底部安全区占位不对的Bug +- 修复 App 端弹出等待的Bug +- 优化 提升低配设备性能,优化动画卡顿问题 +- 优化 更简单的组件自定义方式 +## 1.2.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.2.8(2021-02-05) +- 调整为uni_modules目录规范 +## 1.2.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 PC 端 +- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端 diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue new file mode 100644 index 0000000..b5eee79 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue @@ -0,0 +1,275 @@ + +
+ + + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue new file mode 100644 index 0000000..91370a8 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue @@ -0,0 +1,143 @@ + + + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue new file mode 100644 index 0000000..5be7624 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue @@ -0,0 +1,187 @@ + ++ +{{titleText}} ++ ++ +{{content}} ++ ++ + ++ + ++ +{{closeText}} ++ +{{okText}} ++ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json new file mode 100644 index 0000000..7f1bd06 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "cancel", + "uni-popup.ok": "ok", + "uni-popup.placeholder": "pleace enter", + "uni-popup.title": "Hint", + "uni-popup.shareTitle": "Share to" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/index.js b/uni_modules/uni-popup/components/uni-popup/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json new file mode 100644 index 0000000..5e3003c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "确定", + "uni-popup.placeholder": "请输入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json new file mode 100644 index 0000000..13e39eb --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "確定", + "uni-popup.placeholder": "請輸入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js new file mode 100644 index 0000000..62dda46 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + // this.$once('hook:beforeDestroy', () => { + // document.removeEventListener('keyup', listener) + // }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js new file mode 100644 index 0000000..c4e5781 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -0,0 +1,26 @@ + +export default { + data() { + return { + + } + }, + created(){ + this.popup = this.getParent() + }, + methods:{ + /** + * 获取父元素实例 + */ + getParent(name = 'uniPopup') { + let parent = this.$parent; + let parentName = parent.$options.name; + while (parentName !== name) { + parent = parent.$parent; + if (!parent) return false + parentName = parent.$options.name; + } + return parent; + }, + } +} diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue b/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue new file mode 100644 index 0000000..5eb8d5b --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue @@ -0,0 +1,90 @@ + ++ {{shareTitleText}} + ++ ++ + ++ {{item.text}} ++ + ++ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue new file mode 100644 index 0000000..4fae089 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -0,0 +1,473 @@ + ++ ++ + + + + + diff --git a/uni_modules/uni-popup/package.json b/uni_modules/uni-popup/package.json new file mode 100644 index 0000000..c3f3d1c --- /dev/null +++ b/uni_modules/uni-popup/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-popup", + "displayName": "uni-popup 弹出层", + "version": "1.8.4", + "description": " Popup 组件,提供常用的弹层", + "keywords": [ + "uni-ui", + "弹出层", + "弹窗", + "popup", + "弹框" + ], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-popup/readme.md b/uni_modules/uni-popup/readme.md new file mode 100644 index 0000000..fdad4b3 --- /dev/null +++ b/uni_modules/uni-popup/readme.md @@ -0,0 +1,17 @@ + + +## Popup 弹出层 +> **组件名:uni-popup** +> 代码块: `uPopup` +> 关联组件:`uni-transition` + + +弹出层组件,在应用中弹出一个消息提示窗口、提示框等 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-popup) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-scss/changelog.md b/uni_modules/uni-scss/changelog.md new file mode 100644 index 0000000..b863bb0 --- /dev/null +++ b/uni_modules/uni-scss/changelog.md @@ -0,0 +1,8 @@ +## 1.0.3(2022-01-21) +- 优化 组件示例 +## 1.0.2(2021-11-22) +- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题 +## 1.0.1(2021-11-22) +- 修复 vue3中scss语法兼容问题 +## 1.0.0(2021-11-18) +- init diff --git a/uni_modules/uni-scss/index.scss b/uni_modules/uni-scss/index.scss new file mode 100644 index 0000000..1744a5f --- /dev/null +++ b/uni_modules/uni-scss/index.scss @@ -0,0 +1 @@ +@import './styles/index.scss'; diff --git a/uni_modules/uni-scss/package.json b/uni_modules/uni-scss/package.json new file mode 100644 index 0000000..7cc0ccb --- /dev/null +++ b/uni_modules/uni-scss/package.json @@ -0,0 +1,82 @@ +{ + "id": "uni-scss", + "displayName": "uni-scss 辅助样式", + "version": "1.0.3", + "description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。", + "keywords": [ + "uni-scss", + "uni-ui", + "辅助样式" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "JS SDK", + "通用 SDK" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-scss/readme.md b/uni_modules/uni-scss/readme.md new file mode 100644 index 0000000..b7d1c25 --- /dev/null +++ b/uni_modules/uni-scss/readme.md @@ -0,0 +1,4 @@ +`uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/index.scss b/uni_modules/uni-scss/styles/index.scss new file mode 100644 index 0000000..ffac4fe --- /dev/null +++ b/uni_modules/uni-scss/styles/index.scss @@ -0,0 +1,7 @@ +@import './setting/_variables.scss'; +@import './setting/_border.scss'; +@import './setting/_color.scss'; +@import './setting/_space.scss'; +@import './setting/_radius.scss'; +@import './setting/_text.scss'; +@import './setting/_styles.scss'; diff --git a/uni_modules/uni-scss/styles/setting/_border.scss b/uni_modules/uni-scss/styles/setting/_border.scss new file mode 100644 index 0000000..12a11c3 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_border.scss @@ -0,0 +1,3 @@ +.uni-border { + border: 1px $uni-border-1 solid; +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_color.scss b/uni_modules/uni-scss/styles/setting/_color.scss new file mode 100644 index 0000000..1ededd9 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_color.scss @@ -0,0 +1,66 @@ + +// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 +// @mixin get-styles($k,$c) { +// @if $k == size or $k == weight{ +// font-#{$k}:#{$c} +// }@else{ +// #{$k}:#{$c} +// } +// } +$uni-ui-color:( + // 主色 + primary: $uni-primary, + primary-disable: $uni-primary-disable, + primary-light: $uni-primary-light, + // 辅助色 + success: $uni-success, + success-disable: $uni-success-disable, + success-light: $uni-success-light, + warning: $uni-warning, + warning-disable: $uni-warning-disable, + warning-light: $uni-warning-light, + error: $uni-error, + error-disable: $uni-error-disable, + error-light: $uni-error-light, + info: $uni-info, + info-disable: $uni-info-disable, + info-light: $uni-info-light, + // 中性色 + main-color: $uni-main-color, + base-color: $uni-base-color, + secondary-color: $uni-secondary-color, + extra-color: $uni-extra-color, + // 背景色 + bg-color: $uni-bg-color, + // 边框颜色 + border-1: $uni-border-1, + border-2: $uni-border-2, + border-3: $uni-border-3, + border-4: $uni-border-4, + // 黑色 + black:$uni-black, + // 白色 + white:$uni-white, + // 透明 + transparent:$uni-transparent +) !default; +@each $key, $child in $uni-ui-color { + .uni-#{"" + $key} { + color: $child; + } + .uni-#{"" + $key}-bg { + background-color: $child; + } +} +.uni-shadow-sm { + box-shadow: $uni-shadow-sm; +} +.uni-shadow-base { + box-shadow: $uni-shadow-base; +} +.uni-shadow-lg { + box-shadow: $uni-shadow-lg; +} +.uni-mask { + background-color:$uni-mask; +} diff --git a/uni_modules/uni-scss/styles/setting/_radius.scss b/uni_modules/uni-scss/styles/setting/_radius.scss new file mode 100644 index 0000000..9a0428b --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_radius.scss @@ -0,0 +1,55 @@ +@mixin radius($r,$d:null ,$important: false){ + $radius-value:map-get($uni-radius, $r) if($important, !important, null); + // Key exists within the $uni-radius variable + @if (map-has-key($uni-radius, $r) and $d){ + @if $d == t { + border-top-left-radius:$radius-value; + border-top-right-radius:$radius-value; + }@else if $d == r { + border-top-right-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == b { + border-bottom-left-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == l { + border-top-left-radius:$radius-value; + border-bottom-left-radius:$radius-value; + }@else if $d == tl { + border-top-left-radius:$radius-value; + }@else if $d == tr { + border-top-right-radius:$radius-value; + }@else if $d == br { + border-bottom-right-radius:$radius-value; + }@else if $d == bl { + border-bottom-left-radius:$radius-value; + } + }@else{ + border-radius:$radius-value; + } +} + +@each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $key} { + @include radius($key) + } + }@else{ + .uni-radius { + @include radius($key) + } + } +} + +@each $direction in t, r, b, l,tl, tr, br, bl { + @each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $direction}-#{"" + $key} { + @include radius($key,$direction,false) + } + }@else{ + .uni-radius-#{$direction} { + @include radius($key,$direction,false) + } + } + } +} diff --git a/uni_modules/uni-scss/styles/setting/_space.scss b/uni_modules/uni-scss/styles/setting/_space.scss new file mode 100644 index 0000000..3c89528 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_space.scss @@ -0,0 +1,56 @@ + +@mixin fn($space,$direction,$size,$n) { + @if $n { + #{$space}-#{$direction}: #{$size*$uni-space-root}px + } @else { + #{$space}-#{$direction}: #{-$size*$uni-space-root}px + } +} +@mixin get-styles($direction,$i,$space,$n){ + @if $direction == t { + @include fn($space, top,$i,$n); + } + @if $direction == r { + @include fn($space, right,$i,$n); + } + @if $direction == b { + @include fn($space, bottom,$i,$n); + } + @if $direction == l { + @include fn($space, left,$i,$n); + } + @if $direction == x { + @include fn($space, left,$i,$n); + @include fn($space, right,$i,$n); + } + @if $direction == y { + @include fn($space, top,$i,$n); + @include fn($space, bottom,$i,$n); + } + @if $direction == a { + @if $n { + #{$space}:#{$i*$uni-space-root}px; + } @else { + #{$space}:#{-$i*$uni-space-root}px; + } + } +} + +@each $orientation in m,p { + $space: margin; + @if $orientation == m { + $space: margin; + } @else { + $space: padding; + } + @for $i from 0 through 16 { + @each $direction in t, r, b, l, x, y, a { + .uni-#{$orientation}#{$direction}-#{$i} { + @include get-styles($direction,$i,$space,true); + } + .uni-#{$orientation}#{$direction}-n#{$i} { + @include get-styles($direction,$i,$space,false); + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_styles.scss b/uni_modules/uni-scss/styles/setting/_styles.scss new file mode 100644 index 0000000..689afec --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_styles.scss @@ -0,0 +1,167 @@ +/* #ifndef APP-NVUE */ + +$-color-white:#fff; +$-color-black:#000; +@mixin base-style($color) { + color: #fff; + background-color: $color; + border-color: mix($-color-black, $color, 8%); + &:not([hover-class]):active { + background: mix($-color-black, $color, 10%); + border-color: mix($-color-black, $color, 20%); + color: $-color-white; + outline: none; + } +} +@mixin is-color($color) { + @include base-style($color); + &[loading] { + @include base-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &[loading], + &:not([hover-class]):active { + color: $-color-white; + border-color: mix(darken($color,10%), $-color-white); + background-color: mix($color, $-color-white); + } + } + +} +@mixin base-plain-style($color) { + color:$color; + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 70%); + &:not([hover-class]):active { + background: mix($-color-white, $color, 80%); + color: $color; + outline: none; + border-color: mix($-color-white, $color, 50%); + } +} +@mixin is-plain($color){ + &[plain] { + @include base-plain-style($color); + &[loading] { + @include base-plain-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &:active { + color: mix($-color-white, $color, 40%); + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 80%); + } + } + } +} + + +.uni-btn { + margin: 5px; + color: #393939; + border:1px solid #ccc; + font-size: 16px; + font-weight: 200; + background-color: #F9F9F9; + // TODO 暂时处理边框隐藏一边的问题 + overflow: visible; + &::after{ + border: none; + } + + &:not([type]),&[type=default] { + color: #999; + &[loading] { + background: none; + &::before { + margin-right:5px; + } + } + + + + &[disabled]{ + color: mix($-color-white, #999, 60%); + &, + &[loading], + &:active { + color: mix($-color-white, #999, 60%); + background-color: mix($-color-white,$-color-black , 98%); + border-color: mix($-color-white, #999, 85%); + } + } + + &[plain] { + color: #999; + background: none; + border-color: $uni-border-1; + &:not([hover-class]):active { + background: none; + color: mix($-color-white, $-color-black, 80%); + border-color: mix($-color-white, $-color-black, 90%); + outline: none; + } + &[disabled]{ + &, + &[loading], + &:active { + background: none; + color: mix($-color-white, #999, 60%); + border-color: mix($-color-white, #999, 85%); + } + } + } + } + + &:not([hover-class]):active { + color: mix($-color-white, $-color-black, 50%); + } + + &[size=mini] { + font-size: 16px; + font-weight: 200; + border-radius: 8px; + } + + + + &.uni-btn-small { + font-size: 14px; + } + &.uni-btn-mini { + font-size: 12px; + } + + &.uni-btn-radius { + border-radius: 999px; + } + &[type=primary] { + @include is-color($uni-primary); + @include is-plain($uni-primary) + } + &[type=success] { + @include is-color($uni-success); + @include is-plain($uni-success) + } + &[type=error] { + @include is-color($uni-error); + @include is-plain($uni-error) + } + &[type=warning] { + @include is-color($uni-warning); + @include is-plain($uni-warning) + } + &[type=info] { + @include is-color($uni-info); + @include is-plain($uni-info) + } +} +/* #endif */ diff --git a/uni_modules/uni-scss/styles/setting/_text.scss b/uni_modules/uni-scss/styles/setting/_text.scss new file mode 100644 index 0000000..a34d08f --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_text.scss @@ -0,0 +1,24 @@ +@mixin get-styles($k,$c) { + @if $k == size or $k == weight{ + font-#{$k}:#{$c} + }@else{ + #{$k}:#{$c} + } +} + +@each $key, $child in $uni-headings { + /* #ifndef APP-NVUE */ + .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ + /* #ifdef APP-NVUE */ + .container .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ +} diff --git a/uni_modules/uni-scss/styles/setting/_variables.scss b/uni_modules/uni-scss/styles/setting/_variables.scss new file mode 100644 index 0000000..557d3d7 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_variables.scss @@ -0,0 +1,146 @@ +// @use "sass:math"; +@import '../tools/functions.scss'; +// 间距基础倍数 +$uni-space-root: 2 !default; +// 边框半径默认值 +$uni-radius-root:5px !default; +$uni-radius: () !default; +// 边框半径断点 +$uni-radius: map-deep-merge( + ( + 0: 0, + // TODO 当前版本暂时不支持 sm 属性 + // 'sm': math.div($uni-radius-root, 2), + null: $uni-radius-root, + 'lg': $uni-radius-root * 2, + 'xl': $uni-radius-root * 6, + 'pill': 9999px, + 'circle': 50% + ), + $uni-radius +); +// 字体家族 +$body-font-family: 'Roboto', sans-serif !default; +// 文本 +$heading-font-family: $body-font-family !default; +$uni-headings: () !default; +$letterSpacing: -0.01562em; +$uni-headings: map-deep-merge( + ( + 'h1': ( + size: 32px, + weight: 300, + line-height: 50px, + // letter-spacing:-0.01562em + ), + 'h2': ( + size: 28px, + weight: 300, + line-height: 40px, + // letter-spacing: -0.00833em + ), + 'h3': ( + size: 24px, + weight: 400, + line-height: 32px, + // letter-spacing: normal + ), + 'h4': ( + size: 20px, + weight: 400, + line-height: 30px, + // letter-spacing: 0.00735em + ), + 'h5': ( + size: 16px, + weight: 400, + line-height: 24px, + // letter-spacing: normal + ), + 'h6': ( + size: 14px, + weight: 500, + line-height: 18px, + // letter-spacing: 0.0125em + ), + 'subtitle': ( + size: 12px, + weight: 400, + line-height: 20px, + // letter-spacing: 0.00937em + ), + 'body': ( + font-size: 14px, + font-weight: 400, + line-height: 22px, + // letter-spacing: 0.03125em + ), + 'caption': ( + 'size': 12px, + 'weight': 400, + 'line-height': 20px, + // 'letter-spacing': 0.03333em, + // 'text-transform': false + ) + ), + $uni-headings +); + + + +// 主色 +$uni-primary: #2979ff !default; +$uni-primary-disable:lighten($uni-primary,20%) !default; +$uni-primary-light: lighten($uni-primary,25%) !default; + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37 !default; +$uni-success-disable:lighten($uni-success,20%) !default; +$uni-success-light: lighten($uni-success,25%) !default; + +$uni-warning: #f3a73f !default; +$uni-warning-disable:lighten($uni-warning,20%) !default; +$uni-warning-light: lighten($uni-warning,25%) !default; + +$uni-error: #e43d33 !default; +$uni-error-disable:lighten($uni-error,20%) !default; +$uni-error-light: lighten($uni-error,25%) !default; + +$uni-info: #8f939c !default; +$uni-info-disable:lighten($uni-info,20%) !default; +$uni-info-light: lighten($uni-info,25%) !default; + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a !default; // 主要文字 +$uni-base-color: #6a6a6a !default; // 常规文字 +$uni-secondary-color: #909399 !default; // 次要文字 +$uni-extra-color: #c7c7c7 !default; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0 !default; +$uni-border-2: #EDEDED !default; +$uni-border-3: #DCDCDC !default; +$uni-border-4: #B9B9B9 !default; + +// 常规色 +$uni-black: #000000 !default; +$uni-white: #ffffff !default; +$uni-transparent: rgba($color: #000000, $alpha: 0) !default; + +// 背景色 +$uni-bg-color: #f7f7f7 !default; + +/* 水平间距 */ +$uni-spacing-sm: 8px !default; +$uni-spacing-base: 15px !default; +$uni-spacing-lg: 30px !default; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4) !default; diff --git a/uni_modules/uni-scss/styles/tools/functions.scss b/uni_modules/uni-scss/styles/tools/functions.scss new file mode 100644 index 0000000..ac6f63e --- /dev/null +++ b/uni_modules/uni-scss/styles/tools/functions.scss @@ -0,0 +1,19 @@ +// 合并 map +@function map-deep-merge($parent-map, $child-map){ + $result: $parent-map; + @each $key, $child in $child-map { + $parent-has-key: map-has-key($result, $key); + $parent-value: map-get($result, $key); + $parent-type: type-of($parent-value); + $child-type: type-of($child); + $parent-is-map: $parent-type == map; + $child-is-map: $child-type == map; + + @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ + $result: map-merge($result, ( $key: $child )); + }@else { + $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); + } + } + @return $result; +}; diff --git a/uni_modules/uni-scss/theme.scss b/uni_modules/uni-scss/theme.scss new file mode 100644 index 0000000..80ee62f --- /dev/null +++ b/uni_modules/uni-scss/theme.scss @@ -0,0 +1,31 @@ +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; +// 主色 +$uni-primary: #2979ff; +// 辅助色 +$uni-success: #4cd964; +// 警告色 +$uni-warning: #f0ad4e; +// 错误色 +$uni-error: #dd524d; +// 描述色 +$uni-info: #909399; +// 中性色 +$uni-main-color: #303133; +$uni-base-color: #606266; +$uni-secondary-color: #909399; +$uni-extra-color: #C0C4CC; +// 背景色 +$uni-bg-color: #f5f5f5; +// 边框颜色 +$uni-border-1: #DCDFE6; +$uni-border-2: #E4E7ED; +$uni-border-3: #EBEEF5; +$uni-border-4: #F2F6FC; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); diff --git a/uni_modules/uni-scss/variables.scss b/uni_modules/uni-scss/variables.scss new file mode 100644 index 0000000..1c062d4 --- /dev/null +++ b/uni_modules/uni-scss/variables.scss @@ -0,0 +1,62 @@ +@import './styles/setting/_variables.scss'; +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; + +// 主色 +$uni-primary: #2979ff; +$uni-primary-disable:mix(#fff,$uni-primary,50%); +$uni-primary-light: mix(#fff,$uni-primary,80%); + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37; +$uni-success-disable:mix(#fff,$uni-success,50%); +$uni-success-light: mix(#fff,$uni-success,80%); + +$uni-warning: #f3a73f; +$uni-warning-disable:mix(#fff,$uni-warning,50%); +$uni-warning-light: mix(#fff,$uni-warning,80%); + +$uni-error: #e43d33; +$uni-error-disable:mix(#fff,$uni-error,50%); +$uni-error-light: mix(#fff,$uni-error,80%); + +$uni-info: #8f939c; +$uni-info-disable:mix(#fff,$uni-info,50%); +$uni-info-light: mix(#fff,$uni-info,80%); + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a; // 主要文字 +$uni-base-color: #6a6a6a; // 常规文字 +$uni-secondary-color: #909399; // 次要文字 +$uni-extra-color: #c7c7c7; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0; +$uni-border-2: #EDEDED; +$uni-border-3: #DCDCDC; +$uni-border-4: #B9B9B9; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); + +// 背景色 +$uni-bg-color: #f7f7f7; + +/* 水平间距 */ +$uni-spacing-sm: 8px; +$uni-spacing-base: 15px; +$uni-spacing-lg: 30px; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4); diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md new file mode 100644 index 0000000..70c1cd4 --- /dev/null +++ b/uni_modules/uni-transition/changelog.md @@ -0,0 +1,22 @@ +## 1.3.2(2023-05-04) +- 修复 NVUE 平台报错的问题 +## 1.3.1(2021-11-23) +- 修复 init 方法初始化问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition) +## 1.2.1(2021-09-27) +- 修复 init 方法不生效的 Bug +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.1(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的 Bug +## 1.1.0(2021-04-22) +- 新增 通过方法自定义动画 +- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- 优化 动画触发逻辑,使动画更流畅 +- 优化 支持单独的动画类型 +- 优化 文档示例 +## 1.0.2(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js new file mode 100644 index 0000000..8f89b18 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -0,0 +1,131 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误 + this.animation = uni.createAnimation({ + ...options + }) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000..bfbba93 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -0,0 +1,286 @@ + + ++ + ++ + ++ ++ + + + + + + + + + + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json new file mode 100644 index 0000000..ea995a2 --- /dev/null +++ b/uni_modules/uni-transition/package.json @@ -0,0 +1,84 @@ +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.2", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md new file mode 100644 index 0000000..2f8a77e --- /dev/null +++ b/uni_modules/uni-transition/readme.md @@ -0,0 +1,11 @@ + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uview-ui/LICENSE b/uni_modules/uview-ui/LICENSE new file mode 100644 index 0000000..4db40ef --- /dev/null +++ b/uni_modules/uview-ui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/uni_modules/uview-ui/README.md b/uni_modules/uview-ui/README.md new file mode 100644 index 0000000..c78ff47 --- /dev/null +++ b/uni_modules/uview-ui/README.md @@ -0,0 +1,66 @@ + +
++
uView 2.0
+多平台快速开发的UI框架
+ +[](https://github.com/umicro/uView2.0) +[](https://github.com/umicro/uView2.0) +[](https://github.com/umicro/uView2.0/issues) +[](https://uviewui.com) +[](https://gitee.com/umicro/uView2.0/releases) +[](https://en.wikipedia.org/wiki/MIT_License) + +## 说明 + +uView UI,是[uni-app](https://uniapp.dcloud.io/)全面兼容nvue的uni-app生态框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 + +## [官方文档:https://uviewui.com](https://uviewui.com) + + +## 预览 + +您可以通过**微信**扫码,查看最佳的演示效果。 +
+
++ + +## 链接 + +- [官方文档](https://www.uviewui.com/) +- [更新日志](https://www.uviewui.com/components/changelog.html) +- [升级指南](https://www.uviewui.com/components/changeGuide.html) +- [关于我们](https://www.uviewui.com/cooperation/about.html) + +## 交流反馈 + +欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html) + +## 关于PR + +> 我们非常乐意接受各位的优质PR,但在此之前我希望您了解uView2.0是一个需要兼容多个平台的(小程序、h5、ios app、android app)包括nvue页面、vue页面。 +> 所以希望在您修复bug并提交之前尽可能的去这些平台测试一下兼容性。最好能携带测试截图以方便审核。非常感谢! + +## 安装 + +#### **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593) + +请通过[官网安装文档](https://www.uviewui.com/components/install.html)了解更详细的内容 + +## 快速上手 + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +
+ +``` + +## 版权信息 +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 + diff --git a/uni_modules/uview-ui/changelog.md b/uni_modules/uview-ui/changelog.md new file mode 100644 index 0000000..561dea7 --- /dev/null +++ b/uni_modules/uview-ui/changelog.md @@ -0,0 +1,362 @@ +## 2.0.36(2023-03-27) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 重构`deepClone` & `deepMerge`方法 +2. 其他优化 +## 2.0.34(2022-09-24) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. `u-input`、`u-textarea`增加`ignoreCompositionEvent`属性 +2. 修复`route`方法调用可能报错的问题 +3. 修复`u-no-network`组件`z-index`无效的问题 +4. 修复`textarea`组件在h5上confirmType=""报错的问题 +5. `u-rate`适配`nvue` +6. 优化验证手机号码的正则表达式(根据工信部发布的《电信网编号计划(2017年版)》进行修改。) +7. `form-item`添加`labelPosition`属性 +8. `u-calendar`修复`maxDate`设置为当前日期,并且当前时间大于08:00时无法显示日期列表的问题 (#724) +9. `u-radio`增加一个默认插槽用于自定义修改label内容 (#680) +10. 修复`timeFormat`函数在safari重的兼容性问题 (#664) +## 2.0.33(2022-06-17) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`loadmore`组件`lineColor`类型错误问题 +2. 修复`u-parse`组件`imgtap`、`linktap`不生效问题 +## 2.0.32(2022-06-16) +# uView2.0重磅发布,利剑出鞘,一统江湖 +1. `u-loadmore`新增自定义颜色、虚/实线 +2. 修复`u-swiper-action`组件部分平台不能上下滑动的问题 +3. 修复`u-list`回弹问题 +4. 修复`notice-bar`组件动画在低端安卓机可能会抖动的问题 +5. `u-loading-page`添加控制图标大小的属性`iconSize` +6. 修复`u-tooltip`组件`color`参数不生效的问题 +7. 修复`u--input`组件使用`blur`事件输出为`undefined`的bug +8. `u-code-input`组件新增键盘弹起时,是否自动上推页面参数`adjustPosition` +9. 修复`image`组件`load`事件无回调对象问题 +10. 修复`button`组件`loadingSize`设置无效问题 +10. 其他修复 +## 2.0.31(2022-04-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`upload`在`vue`页面上传成功后没有成功标志的问题 +2. 解决演示项目中微信小程序模拟上传图片一直出于上传中问题 +3. 修复`u-code-input`组件在`nvue`页面编译到`app`平台上光标异常问题(`app`去除此功能) +4. 修复`actionSheet`组件标题关闭按钮点击事件名称错误的问题 +5. 其他修复 +## 2.0.30(2022-04-04) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. `u-rate`增加`readonly`属性 +2. `tabs`滑块支持设置背景图片 +3. 修复`u-subsection` `mode`为`subsection`时,滑块样式不正确的问题 +4. `u-code-input`添加光标效果动画 +5. 修复`popup`的`open`事件不触发 +6. 修复`u-flex-column`无效的问题 +7. 修复`u-datetime-picker`索引在特定场合异常问题 +8. 修复`u-datetime-picker`最小时间字符串模板错误问题 +9. `u-swiper`添加`m3u8`验证 +10. `u-swiper`修改判断image和video逻辑 +11. 修复`swiper`无法使用本地图片问题,增加`type`参数 +12. 修复`u-row-notice`格式错误问题 +13. 修复`u-switch`组件当`unit`为`rpx`时,`nodeStyle`消失的问题 +14. 修复`datetime-picker`组件`showToolbar`与`visibleItemCount`属性无效的问题 +15. 修复`upload`组件条件编译位置判断错误,导致`previewImage`属性设置为`false`时,整个组件都会被隐藏的问题 +16. 修复`u-checkbox-group`设置`shape`属性无效的问题 +17. 修复`u-upload`的`capture`传入字符串的时候不生效的问题 +18. 修复`u-action-sheet`组件,关闭事件逻辑错误的问题 +19. 修复`u-list`触顶事件的触发错误的问题 +20. 修复`u-text`只有手机号可拨打的问题 +21. 修复`u-textarea`不能换行的问题 +22. 其他修复 +## 2.0.29(2022-03-13) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`u--text`组件设置`decoration`属性未生效的问题 +2. 修复`u-datetime-picker`使用`formatter`后返回值不正确 +3. 修复`u-datetime-picker` `intercept` 可能为undefined +4. 修复已设置单位 uni..config.unit = 'rpx'时,线型指示器 `transform` 的位置翻倍,导致指示器超出宽度 +5. 修复mixin中bem方法生成的类名在支付宝和字节小程序中失效 +6. 修复默认值传值为空的时候,打开`u-datetime-picker`报错,不能选中第一列时间的bug +7. 修复`u-datetime-picker`使用`formatter`后返回值不正确 +8. 修复`u-image`组件`loading`无效果的问题 +9. 修复`config.unit`属性设为`rpx`时,导航栏占用高度不足导致塌陷的问题 +10. 修复`u-datetime-picker`组件`itemHeight`无效问题 +11. 其他修复 +## 2.0.28(2022-02-22) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. search组件新增searchIconSize属性 +2. 兼容Safari/Webkit中传入时间格式如2022-02-17 12:00:56 +3. 修复text value.js 判断日期出format错误问题 +4. priceFormat格式化金额出现精度错误 +5. priceFormat在部分情况下出现精度损失问题 +6. 优化表单rules提示 +7. 修复avatar组件src为空时,展示状态不对 +8. 其他修复 +## 2.0.27(2022-01-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1.样式修复 +## 2.0.26(2022-01-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1.样式修复 +## 2.0.25(2022-01-27) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复text组件mode=price时,可能会导致精度错误的问题 +2. 添加$u.setConfig()方法,可设置uView内置的config, props, zIndex, color属性,详见:[修改uView内置配置方案](https://uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) +3. 优化form组件在errorType=toast时,如果输入错误页面会有抖动的问题 +4. 修复$u.addUnit()对配置默认单位可能无效的问题 +## 2.0.24(2022-01-25) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复swiper在current指定非0时缩放有误 +2. 修复u-icon添加stop属性的时候报错 +3. 优化遗留的通过正则判断rpx单位的问题 +4. 优化Layout布局 vue使用gutter时,会超出固定区域 +5. 优化search组件高度单位问题(rpx -> px) +6. 修复u-image slot 加载和错误的图片失去了高度 +7. 修复u-index-list中footer插槽与header插槽存在性判断错误 +8. 修复部分机型下u-popup关闭时会闪烁 +9. 修复u-image在nvue-app下失去宽高 +10. 修复u-popup运行报错 +11. 修复u-tooltip报错 +12. 修复box-sizing在app下的警告 +13. 修复u-navbar在小程序中报运行时错误 +14. 其他修复 +## 2.0.23(2022-01-24) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复image组件在hx3.3.9的nvue下可能会显示异常的问题 +2. 修复col组件gutter参数带rpx单位处理不正确的问题 +3. 修复text组件单行时无法显示省略号的问题 +4. navbar添加titleStyle参数 +5. 升级到hx3.3.9可消除nvue下控制台样式警告的问题 +## 2.0.22(2022-01-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. $u.page()方法优化,避免在特殊场景可能报错的问题 +2. picker组件添加immediateChange参数 +3. 新增$u.pages()方法 +## 2.0.21(2022-01-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化:form组件在用户设置rules的时候提示用户model必传 +2. 优化遗留的通过正则判断rpx单位的问题 +3. 修复微信小程序环境中tabbar组件开启safeAreaInsetBottom属性后,placeholder高度填充不正确 +4. 修复swiper在current指定非0时缩放有误 +5. 修复u-icon添加stop属性的时候报错 +6. 修复upload组件在accept=all的时候没有作用 +7. 修复在text组件mode为phone时call属性无效的问题 +8. 处理u-form clearValidate方法 +9. 其他修复 +## 2.0.20(2022-01-14) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复calendar默认会选择一个日期,如果直接点确定的话,无法取到值的问题 +2. 修复Slider缺少disabled props 还有注释 +3. 修复u-notice-bar点击事件无法拿到index索引值的问题 +4. 修复u-collapse-item在vue文件下,app端自定义插槽不生效的问题 +5. 优化头像为空时显示默认头像 +6. 修复图片地址赋值后判断加载状态为完成问题 +7. 修复日历滚动到默认日期月份区域 +8. search组件暴露点击左边icon事件 +9. 修复u-form clearValidate方法不生效 +10. upload h5端增加返回文件参数(文件的name参数) +11. 处理upload选择文件后url为blob类型无法预览的问题 +12. u-code-input 修复输入框没有往左移出一半屏幕 +13. 修复Upload上传 disabled为true时,控制台报hoverClass类型错误 +14. 临时处理ios app下grid点击坍塌问题 +15. 其他修复 +## 2.0.19(2021-12-29) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化微信小程序包体积可在微信中预览,请升级HbuilderX3.3.4,同时在“运行->运行到小程序模拟器”中勾选“运行时是否压缩代码” +2. 优化微信小程序setData性能,处理某些方法如$u.route()无法在模板中使用的问题 +3. navbar添加autoBack参数 +4. 允许avatar组件的事件冒泡 +5. 修复cell组件报错问题 +6. 其他修复 +## 2.0.18(2021-12-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复app端编译报错问题 +2. 重新处理微信小程序端setData过大的性能问题 +3. 修复边框问题 +4. 修复最大最小月份不大于0则没有数据出现的问题 +5. 修复SwipeAction微信小程序端无法上下滑动问题 +6. 修复input的placeholder在小程序端默认显示为true问题 +7. 修复viewider组件click事件无效问题 +8. 修复u-code-input maxlength 属性值为 String 类型时显示异常 +9. 修复当 grid只有 1到2时 在小程序端algin设置无效的问题 +10. 处理form-item的label为top时,取消错误提示的左边距 +11. 其他修复 +## 2.0.17(2021-12-26) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 解决HBuilderX3.3.3.20211225版本导致的样式问题 +2. calendar日历添加monthNum参数 +3. navbar添加center slot +## 2.0.16(2021-12-25) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 解决微信小程序setData性能问题 +2. 修复count-down组件change事件不触发问题 +## 2.0.15(2021-12-21) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复Cell单元格titleWidth无效 +2. 修复cheakbox组件ischecked不更新 +3. 修复keyboard是否显示"."按键默认值问题 +4. 修复number-keyboard是否显示键盘的"."符号问题 +5. 修复Input输入框 readonly无效 +6. 修复u-avatar 导致打包app、H5时候报错问题 +7. 修复Upload上传deletable无效 +8. 修复upload当设置maxSize时无效的问题 +9. 修复tabs lineWidth传入带单位的字符串的时候偏移量计算错误问题 +10. 修复rate组件在有padding的view内,显示的星星位置和可触摸区域不匹配,无法正常选中星星 +## 2.0.13(2021-12-14) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复配置默认单位为rpx可能会导致自定义导航栏高度异常的问题 +## 2.0.12(2021-12-14) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复tabs组件在vue环境下划线消失的问题 +2. 修复upload组件在安卓小程序无法选择视频的问题 +3. 添加uni.$u.config.unit配置,用于配置参数默认单位,详见:[默认单位配置](https://www.uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) +4. 修复textarea组件在没绑定v-model时,字符统计不生效问题 +5. 修复nvue下控制是否出现滚动条失效问题 +## 2.0.11(2021-12-13) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. text组件align参数无效的问题 +2. subsection组件添加keyName参数 +3. upload组件无法判断[Object file]类型的问题 +4. 处理notify层级过低问题 +5. codeInput组件添加disabledDot参数 +6. 处理actionSheet组件round参数无效的问题 +7. calendar组件添加round参数用于控制圆角值 +8. 处理swipeAction组件在vue环境下默认被打开的问题 +9. button组件的throttleTime节流参数无效的问题 +10. 解决u-notify手动关闭方法close()无效的问题 +11. input组件readonly不生效问题 +12. tag组件type参数为info不生效问题 +## 2.0.10(2021-12-08) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复button sendMessagePath属性不生效 +2. 修复DatetimePicker选择器title无效 +3. 修复u-toast设置loading=true不生效 +4. 修复u-text金额模式传0报错 +5. 修复u-toast组件的icon属性配置不生效 +6. button的icon在特殊场景下的颜色优化 +7. IndexList优化,增加# +## 2.0.9(2021-12-01) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化swiper的height支持100%值(仅vue有效),修复嵌入视频时click事件无法触发的问题 +2. 优化tabs组件对list值为空的判断,或者动态变化list时重新计算相关尺寸的问题 +3. 优化datetime-picker组件逻辑,让其后续打开的默认值为上一次的选中值,需要通过v-model绑定值才有效 +4. 修复upload内嵌在其他组件中,选择图片可能不会换行的问题 +## 2.0.8(2021-12-01) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复toast的position参数无效问题 +2. 处理input在ios nvue上无法获得焦点的问题 +3. avatar-group组件添加extraValue参数,让剩余展示数量可手动控制 +4. tabs组件添加keyName参数用于配置从对象中读取的键名 +5. 处理text组件名字脱敏默认配置无效的问题 +6. 处理picker组件item文本太长换行问题 +## 2.0.7(2021-11-30) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复radio和checkbox动态改变v-model无效的问题。 +2. 优化form规则validator在微信小程序用法 +3. 修复backtop组件mode参数在微信小程序无效的问题 +4. 处理Album的previewFullImage属性无效的问题 +5. 处理u-datetime-picker组件mode='time'在选择改变时间时,控制台报错的问题 +## 2.0.6(2021-11-27) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 处理tag组件在vue下边框无效的问题。 +2. 处理popup组件圆角参数可能无效的问题。 +3. 处理tabs组件lineColor参数可能无效的问题。 +4. propgress组件在值很小时,显示异常的问题。 +## 2.0.5(2021-11-25) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. calendar在vue下显示异常问题。 +2. form组件labelPosition和errorType参数无效的问题 +3. input组件inputAlign无效的问题 +4. 其他一些修复 +## 2.0.4(2021-11-23) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +0. input组件缺失@confirm事件,以及subfix和prefix无效问题 +1. component.scss文件样式在vue下干扰全局布局问题 +2. 修复subsection在vue环境下表现异常的问题 +3. tag组件的bgColor等参数无效的问题 +4. upload组件不换行的问题 +5. 其他的一些修复处理 +## 2.0.3(2021-11-16) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 处理modal的confirm回调事件拼写错误问题 +6. 处理input组件@input事件参数错误问题 +7. 其他一些修复 +## 2.0.2(2021-11-16) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 修复input组件formatter参数缺失问题 +6. 优化loading-icon组件的scss写法问题,防止不兼容新版本scss +## 2.0.0(2020-11-15) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 修复input组件formatter参数缺失问题 + + diff --git a/uni_modules/uview-ui/components/u--form/u--form.vue b/uni_modules/uview-ui/components/u--form/u--form.vue new file mode 100644 index 0000000..fdfc212 --- /dev/null +++ b/uni_modules/uview-ui/components/u--form/u--form.vue @@ -0,0 +1,78 @@ + + + + + + diff --git a/uni_modules/uview-ui/components/u--image/u--image.vue b/uni_modules/uview-ui/components/u--image/u--image.vue new file mode 100644 index 0000000..21b7ab1 --- /dev/null +++ b/uni_modules/uview-ui/components/u--image/u--image.vue @@ -0,0 +1,47 @@ + ++ + + + + + \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u--input/u--input.vue b/uni_modules/uview-ui/components/u--input/u--input.vue new file mode 100644 index 0000000..1e58b01 --- /dev/null +++ b/uni_modules/uview-ui/components/u--input/u--input.vue @@ -0,0 +1,73 @@ + ++ + + + + $emit('blur', e)" + @keyboardheightchange="$emit('keyboardheightchange')" + @change="e => $emit('change', e)" + @input="e => $emit('input', e)" + @confirm="e => $emit('confirm', e)" + @clear="$emit('clear')" + @click="$emit('click')" + > + + + + + \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u--text/u--text.vue b/uni_modules/uview-ui/components/u--text/u--text.vue new file mode 100644 index 0000000..44ee52a --- /dev/null +++ b/uni_modules/uview-ui/components/u--text/u--text.vue @@ -0,0 +1,44 @@ + ++ + + + + + + + + + diff --git a/uni_modules/uview-ui/components/u--textarea/u--textarea.vue b/uni_modules/uview-ui/components/u--textarea/u--textarea.vue new file mode 100644 index 0000000..f4df0b9 --- /dev/null +++ b/uni_modules/uview-ui/components/u--textarea/u--textarea.vue @@ -0,0 +1,48 @@ + + $emit('focus')" + @blur="e => $emit('blur')" + @linechange="e => $emit('linechange', e)" + @confirm="e => $emit('confirm')" + @input="e => $emit('input', e)" + @keyboardheightchange="e => $emit('keyboardheightchange')" + > + + + diff --git a/uni_modules/uview-ui/components/u-action-sheet/props.js b/uni_modules/uview-ui/components/u-action-sheet/props.js new file mode 100644 index 0000000..e96e04f --- /dev/null +++ b/uni_modules/uview-ui/components/u-action-sheet/props.js @@ -0,0 +1,54 @@ +export default { + props: { + // 操作菜单是否展示 (默认false) + show: { + type: Boolean, + default: uni.$u.props.actionSheet.show + }, + // 标题 + title: { + type: String, + default: uni.$u.props.actionSheet.title + }, + // 选项上方的描述信息 + description: { + type: String, + default: uni.$u.props.actionSheet.description + }, + // 数据 + actions: { + type: Array, + default: uni.$u.props.actionSheet.actions + }, + // 取消按钮的文字,不为空时显示按钮 + cancelText: { + type: String, + default: uni.$u.props.actionSheet.cancelText + }, + // 点击某个菜单项时是否关闭弹窗 + closeOnClickAction: { + type: Boolean, + default: uni.$u.props.actionSheet.closeOnClickAction + }, + // 处理底部安全区(默认true) + safeAreaInsetBottom: { + type: Boolean, + default: uni.$u.props.actionSheet.safeAreaInsetBottom + }, + // 小程序的打开方式 + openType: { + type: String, + default: uni.$u.props.actionSheet.openType + }, + // 点击遮罩是否允许关闭 (默认true) + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.actionSheet.closeOnClickOverlay + }, + // 圆角值 + round: { + type: [Boolean, String, Number], + default: uni.$u.props.actionSheet.round + } + } +} diff --git a/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue b/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue new file mode 100644 index 0000000..26d5d8d --- /dev/null +++ b/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue @@ -0,0 +1,278 @@ + + ++ + + + + + diff --git a/uni_modules/uview-ui/components/u-album/props.js b/uni_modules/uview-ui/components/u-album/props.js new file mode 100644 index 0000000..75cdb37 --- /dev/null +++ b/uni_modules/uview-ui/components/u-album/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 图片地址,Array+ ++ +{{title}} ++ ++ {{description}} ++ ++ + + + + + ++ + + + +{{cancelText}} +|Array