From 8da1c3403e6716f1031b63333f2b91d82bdd8d76 Mon Sep 17 00:00:00 2001 From: leonZ Date: Sat, 3 Aug 2024 19:57:17 +0800 Subject: [PATCH] init --- .gitignore | 3 + .hbuilderx/launch.json | 20 + App.vue | 66 + README.md | 0 api/address.js | 33 + api/article.js | 23 + api/balance.js | 23 + api/cart.js | 23 + api/confirm.js | 11 + api/coupon.js | 28 + api/give.js | 17 + api/goods.js | 29 + api/goods/service.js | 11 + api/help.js | 11 + api/login/index.js | 41 + api/merchant.js | 16 + api/merchant/member.js | 19 + api/merchant/order.js | 18 + api/message.js | 24 + api/myCoupon.js | 33 + api/order.js | 41 + api/page.js | 11 + api/points/log.js | 17 + api/refund.js | 30 + api/region.js | 17 + api/setting.js | 29 + api/settlement.js | 22 + api/upload.js | 23 + api/user.js | 51 + api/user/coupon.js | 11 + app.scss | 26 + common/constant/index.js | 3 + common/constant/paginate.js | 7 + common/enum/coupon/ApplyRange.js | 10 + common/enum/coupon/CouponType.js | 11 + common/enum/coupon/ExpireType.js | 10 + common/enum/coupon/index.js | 5 + common/enum/enum.js | 85 ++ common/enum/order/DeliveryStatus.js | 10 + common/enum/order/DeliveryType.js | 9 + common/enum/order/OrderSource.js | 11 + common/enum/order/OrderStatus.js | 16 + common/enum/order/PayStatus.js | 10 + common/enum/order/PayType.js | 13 + common/enum/order/ReceiptStatus.js | 10 + common/enum/order/index.js | 17 + common/enum/order/refund/AuditStatus.js | 11 + common/enum/order/refund/RefundStatus.js | 12 + common/enum/order/refund/RefundType.js | 10 + common/enum/order/refund/index.js | 9 + common/enum/setting/Key.js | 19 + common/enum/store/page/category/Style.js | 11 + common/enum/store/page/category/index.js | 3 + common/model/Region.js | 57 + common/model/Setting.js | 58 + components/actionsheet/index.js | 42 + components/actionsheet/index.json | 6 + components/actionsheet/index.wxml | 39 + components/actionsheet/index.wxss | 86 ++ .../bian-keywords/iconfont/iconfont.css | 25 + .../bian-keywords/iconfont/iconfont.eot | Bin 0 -> 2064 bytes components/bian-keywords/iconfont/iconfont.js | 1 + .../bian-keywords/iconfont/iconfont.json | 23 + .../bian-keywords/iconfont/iconfont.svg | 32 + .../bian-keywords/iconfont/iconfont.ttf | Bin 0 -> 1896 bytes .../bian-keywords/iconfont/iconfont.woff | Bin 0 -> 1248 bytes .../bian-keywords/iconfont/iconfont.woff2 | Bin 0 -> 860 bytes components/bian-keywords/index.vue | 270 ++++ components/btn/index.js | 61 + components/btn/index.json | 3 + components/btn/index.wxml | 24 + components/btn/index.wxss | 1 + components/btn/native-button-behaviors.js | 74 + components/common/color.js | 3 + components/common/component.js | 48 + components/common/index.wxss | 1 + components/common/style/clearfix.wxss | 1 + components/common/style/ellipsis.wxss | 1 + components/common/style/hairline.wxss | 1 + components/common/style/mixins/clearfix.wxss | 0 components/common/style/mixins/ellipsis.wxss | 0 components/common/style/mixins/hairline.wxss | 0 components/common/style/var.wxss | 0 components/common/utils.js | 14 + components/dialog/data.js | 26 + components/dialog/dialog.js | 104 ++ components/dialog/index.js | 148 ++ components/dialog/index.json | 7 + components/dialog/index.wxml | 18 + components/dialog/index.wxss | 79 + components/empty/index.vue | 66 + components/goods-sku-popup/index.vue | 869 +++++++++++ .../goods-sku-popup/number-box/index.vue | 394 +++++ components/grade-popup/index.vue | 524 +++++++ components/jyf-parser/jyf-parser.vue | 645 ++++++++ components/jyf-parser/libs/CssHandler.js | 100 ++ components/jyf-parser/libs/MpHtmlParser.js | 580 +++++++ components/jyf-parser/libs/config.js | 80 + components/jyf-parser/libs/handler.wxs | 22 + components/jyf-parser/libs/trees.vue | 506 ++++++ components/loading/index.js | 17 + components/loading/index.json | 3 + components/loading/index.wxml | 16 + components/loading/index.wxss | 1 + components/merchant-shortcut/index.vue | 279 ++++ .../mescroll-uni/components/mescroll-down.css | 55 + .../mescroll-uni/components/mescroll-down.vue | 47 + .../components/mescroll-empty.vue | 90 ++ .../mescroll-uni/components/mescroll-top.vue | 83 + .../mescroll-uni/components/mescroll-up.css | 47 + .../mescroll-uni/components/mescroll-up.vue | 39 + components/mescroll-uni/mescroll-body.css | 19 + components/mescroll-uni/mescroll-body.vue | 348 +++++ components/mescroll-uni/mescroll-mixins.js | 65 + .../mescroll-uni/mescroll-uni-option.js | 37 + components/mescroll-uni/mescroll-uni.css | 36 + components/mescroll-uni/mescroll-uni.js | 799 ++++++++++ components/mescroll-uni/mescroll-uni.vue | 424 ++++++ .../mescroll-uni/mixins/mescroll-comp.js | 48 + .../mescroll-uni/mixins/mescroll-more-item.js | 59 + .../mescroll-uni/mixins/mescroll-more.js | 74 + components/mescroll-uni/wxs/mixins.js | 109 ++ components/mescroll-uni/wxs/renderjs.js | 92 ++ components/mescroll-uni/wxs/wxs.wxs | 268 ++++ components/mixins/basic.js | 22 + components/mixins/button.js | 18 + components/mixins/iphonex.js | 32 + components/mixins/link.js | 17 + components/mixins/observer/behavior.js | 47 + components/mixins/observer/index.js | 27 + components/mixins/observer/props.js | 22 + components/mixins/open-type.js | 25 + components/mixins/touch.js | 21 + components/mixins/transition.js | 89 ++ .../neoceansoft-keyboard.vue | 444 ++++++ components/page/article/index.vue | 122 ++ components/page/banner/index.vue | 163 ++ components/page/blank/index.vue | 31 + components/page/coupon/index.vue | 294 ++++ components/page/goods/index.vue | 349 +++++ components/page/guide/index.vue | 36 + components/page/image/index.vue | 47 + components/page/index.vue | 108 ++ components/page/location/index.vue | 105 ++ components/page/mixin.js | 23 + components/page/navBar/index.vue | 115 ++ components/page/notice/index.vue | 40 + components/page/richText/index.vue | 41 + components/page/search/index.vue | 75 + components/page/service/index.vue | 86 ++ components/page/video/index.vue | 38 + components/page/window/index.vue | 171 +++ components/pay-popup/index.vue | 583 +++++++ components/pop-manager/index.js | 31 + components/pop-manager/index.json | 3 + components/pop-manager/index.wxml | 12 + components/pop-manager/index.wxss | 1 + components/popup/index.js | 37 + components/popup/index.json | 6 + components/popup/index.wxml | 8 + components/prestore-popup/index.vue | 397 +++++ .../prestore-popup/number-box/index.vue | 394 +++++ components/search/index.vue | 81 + components/select-region/select-region.vue | 165 ++ components/shortcut/index.vue | 276 ++++ components/switch/index.js | 43 + components/switch/index.json | 6 + components/switch/index.wxml | 11 + components/switch/index.wxss | 1 + components/toptips/index.js | 54 + components/toptips/index.json | 3 + components/toptips/index.wxml | 1 + components/toptips/index.wxss | 1 + components/toptips/toptips.js | 28 + components/uni-transition/uni-transition.vue | 279 ++++ components/wxs/array.wxs | 5 + components/wxs/bem.wxs | 38 + components/wxs/memoize.wxs | 54 + components/wxs/object.wxs | 13 + components/wxs/utils.wxs | 12 + components/xuan-switch/xuan-switch.vue | 184 +++ config.js | 9 + core/bootstrap.js | 13 + core/ican-H5Api.js | 71 + main.js | 39 + manifest.json | 117 ++ package.json | 9 + pages.json | 353 +++++ pages/address/create.vue | 176 +++ pages/address/index.vue | 285 ++++ pages/address/update.vue | 219 +++ pages/article/detail.vue | 82 + pages/article/index.vue | 252 +++ pages/cart/index.vue | 498 ++++++ pages/category/components/SkuPopup.vue | 194 +++ pages/category/index.vue | 587 +++++++ pages/comment/index.vue | 276 ++++ pages/confirm/doConfirm.vue | 332 ++++ pages/confirm/result.vue | 123 ++ pages/coupon/detail.vue | 407 +++++ pages/coupon/list.vue | 514 +++++++ pages/coupon/receive.vue | 158 ++ pages/custom/index.vue | 120 ++ pages/empty.vue | 29 + pages/give/index.vue | 259 ++++ pages/goods/components/Service.vue | 158 ++ pages/goods/components/SkuPopup.vue | 203 +++ pages/goods/components/SlideImage.vue | 88 ++ pages/goods/detail.scss | 232 +++ pages/goods/detail.vue | 277 ++++ pages/goods/list.vue | 491 ++++++ pages/help/index.vue | 111 ++ pages/index/index.vue | 235 +++ pages/location/index.vue | 212 +++ pages/login/auth.vue | 180 +++ pages/login/components/main.vue | 566 +++++++ pages/login/components/mp-weixin.vue | 241 +++ pages/login/index.vue | 99 ++ pages/merchant/index.vue | 571 +++++++ pages/merchant/member/detail.vue | 79 + pages/merchant/member/index.vue | 249 +++ pages/merchant/order/index.vue | 403 +++++ pages/my-coupon/index.vue | 280 ++++ pages/order/comment/index.vue | 562 +++++++ pages/order/detail.vue | 884 +++++++++++ pages/order/express/index.vue | 202 +++ pages/order/index.vue | 406 +++++ pages/order/result.vue | 190 +++ pages/pay/cashier.vue | 226 +++ pages/pay/components/Popup.vue | 57 + pages/pay/index.vue | 345 +++++ pages/pay/result.vue | 120 ++ pages/points/detail.vue | 229 +++ pages/points/gift.vue | 208 +++ pages/prestore/buy.scss | 254 +++ pages/prestore/buy.vue | 216 +++ pages/prestore/components/Popup.vue | 71 + pages/prestore/components/Service.vue | 158 ++ pages/prestore/detail.vue | 232 +++ pages/refund/apply.vue | 431 ++++++ pages/refund/detail.vue | 460 ++++++ pages/refund/index.vue | 281 ++++ pages/search/index.vue | 222 +++ pages/settlement/goods.vue | 545 +++++++ pages/settlement/index.vue | 226 +++ pages/settlement/style.scss | 487 ++++++ pages/timer/detail.vue | 359 +++++ pages/user/code.vue | 139 ++ pages/user/components/Popup.vue | 59 + pages/user/index.vue | 806 ++++++++++ pages/user/password.vue | 211 +++ pages/user/setting.vue | 332 ++++ pages/wallet/balance/log.vue | 128 ++ pages/wallet/index.vue | 160 ++ pages/wallet/recharge/index.vue | 294 ++++ pages/wallet/recharge/order.vue | 132 ++ static/background/user-header.png | Bin 0 -> 30370 bytes static/channel/wechat.png | Bin 0 -> 2053 bytes static/confirm/do.png | Bin 0 -> 2936 bytes static/confirm/undo.png | Bin 0 -> 7045 bytes static/default-avatar.png | Bin 0 -> 2672 bytes static/empty-02.png | Bin 0 -> 8448 bytes static/empty.png | Bin 0 -> 7228 bytes static/icon/add.png | Bin 0 -> 1142 bytes static/icon/coupon.png | Bin 0 -> 1732 bytes static/icon/minus.png | Bin 0 -> 1026 bytes static/icon/saoma.png | Bin 0 -> 1714 bytes static/icon/saoyisao.png | Bin 0 -> 2183 bytes static/nav/1.png | Bin 0 -> 755 bytes static/nav/2.png | Bin 0 -> 1587 bytes static/nav/3.png | Bin 0 -> 1685 bytes static/nav/4.png | Bin 0 -> 1305 bytes static/order/refund-bg.png | Bin 0 -> 1832 bytes static/order/status/close.png | Bin 0 -> 3570 bytes static/order/status/received.png | Bin 0 -> 1843 bytes static/order/status/wait_deliver.png | Bin 0 -> 2902 bytes static/order/status/wait_pay.png | Bin 0 -> 2182 bytes static/order/status/wait_receipt.png | Bin 0 -> 2640 bytes static/pay/fail.png | Bin 0 -> 957 bytes static/pay/success.png | Bin 0 -> 870 bytes static/tabbar/cart-active.png | Bin 0 -> 6307 bytes static/tabbar/cart.png | Bin 0 -> 7144 bytes static/tabbar/cate-active.png | Bin 0 -> 4536 bytes static/tabbar/cate.png | Bin 0 -> 5430 bytes static/tabbar/home-active.png | Bin 0 -> 4940 bytes static/tabbar/home.png | Bin 0 -> 5133 bytes static/tabbar/shop-active.png | Bin 0 -> 2973 bytes static/tabbar/shop.png | Bin 0 -> 2868 bytes static/tabbar/user-active.png | Bin 0 -> 5536 bytes static/tabbar/user.png | Bin 0 -> 5530 bytes static/user/tag.png | Bin 0 -> 787 bytes store/getters.js | 7 + store/index.js | 26 + store/modules/app.js | 24 + store/modules/index.js | 7 + store/modules/user.js | 96 ++ store/mutation-types.js | 3 + uni.scss | 81 + uni_modules/uni-popup/changelog.md | 33 + .../components/uni-popup-dialog/keypress.js | 45 + .../uni-popup-dialog/uni-popup-dialog.vue | 244 +++ .../uni-popup-message/uni-popup-message.vue | 143 ++ .../uni-popup-share/uni-popup-share.vue | 171 +++ .../components/uni-popup/keypress.js | 45 + .../uni-popup/components/uni-popup/popup.js | 26 + .../components/uni-popup/uni-popup.vue | 401 +++++ uni_modules/uni-popup/package.json | 83 + uni_modules/uni-popup/readme.md | 296 ++++ uni_modules/uni-row/changelog.md | 5 + .../uni-row/components/uni-col/uni-col.vue | 316 ++++ .../uni-row/components/uni-row/uni-row.vue | 190 +++ uni_modules/uni-row/package.json | 83 + uni_modules/uni-row/readme.md | 183 +++ utils/app.js | 334 ++++ utils/iconfont.scss | 459 ++++++ utils/request/core/request.js | 143 ++ utils/request/core/utils.js | 102 ++ utils/request/index.js | 203 +++ utils/request/request.js | 7 + utils/request/request.md | 453 ++++++ utils/request/upload/qiniuUploader.js | 169 ++ utils/request/upload/upload.js | 208 +++ utils/request/upload/utils.js | 288 ++++ utils/storage.js | 86 ++ utils/util.js | 181 +++ utils/utils.scss | 370 +++++ utils/verify.js | 69 + uview-ui/LICENSE | 21 + uview-ui/README.md | 106 ++ .../u-action-sheet/u-action-sheet.vue | 190 +++ .../components/u-alert-tips/u-alert-tips.vue | 256 ++++ .../u-avatar-cropper/u-avatar-cropper.vue | 290 ++++ .../components/u-avatar-cropper/weCropper.js | 1265 +++++++++++++++ uview-ui/components/u-avatar/u-avatar.vue | 244 +++ uview-ui/components/u-back-top/u-back-top.vue | 153 ++ uview-ui/components/u-badge/u-badge.vue | 216 +++ uview-ui/components/u-button/u-button.vue | 596 ++++++++ uview-ui/components/u-calendar/u-calendar.vue | 639 ++++++++ .../u-car-keyboard/u-car-keyboard.vue | 257 ++++ uview-ui/components/u-card/u-card.vue | 299 ++++ .../components/u-cell-group/u-cell-group.vue | 70 + .../components/u-cell-item/u-cell-item.vue | 316 ++++ .../u-checkbox-group/u-checkbox-group.vue | 123 ++ uview-ui/components/u-checkbox/u-checkbox.vue | 284 ++++ .../u-circle-progress/u-circle-progress.vue | 220 +++ uview-ui/components/u-col/u-col.vue | 156 ++ .../u-collapse-item/u-collapse-item.vue | 204 +++ uview-ui/components/u-collapse/u-collapse.vue | 99 ++ .../u-column-notice/u-column-notice.vue | 237 +++ .../components/u-count-down/u-count-down.vue | 318 ++++ uview-ui/components/u-count-to/u-count-to.vue | 241 +++ uview-ui/components/u-divider/u-divider.vue | 153 ++ .../u-dropdown-item/u-dropdown-item.vue | 132 ++ uview-ui/components/u-dropdown/u-dropdown.vue | 298 ++++ uview-ui/components/u-empty/u-empty.vue | 193 +++ uview-ui/components/u-field/u-field.vue | 384 +++++ .../components/u-form-item/u-form-item.vue | 431 ++++++ uview-ui/components/u-form/u-form.vue | 134 ++ .../u-full-screen/u-full-screen.vue | 52 + uview-ui/components/u-gap/u-gap.vue | 54 + .../components/u-grid-item/u-grid-item.vue | 126 ++ uview-ui/components/u-grid/u-grid.vue | 108 ++ uview-ui/components/u-icon/u-icon.vue | 336 ++++ uview-ui/components/u-image/u-image.vue | 266 ++++ .../u-index-anchor/u-index-anchor.vue | 89 ++ .../components/u-index-list/u-index-list.vue | 315 ++++ uview-ui/components/u-input/u-input.vue | 387 +++++ uview-ui/components/u-keyboard/u-keyboard.vue | 217 +++ .../components/u-lazy-load/u-lazy-load.vue | 244 +++ .../u-line-progress/u-line-progress.vue | 147 ++ uview-ui/components/u-line/u-line.vue | 84 + uview-ui/components/u-link/u-link.vue | 89 ++ .../u-loading-page/u-loading-page.vue | 25 + uview-ui/components/u-loading/u-loading.vue | 103 ++ uview-ui/components/u-loadmore/u-loadmore.vue | 203 +++ uview-ui/components/u-mask/u-mask.vue | 123 ++ .../u-message-input/u-message-input.vue | 311 ++++ uview-ui/components/u-modal/u-modal.vue | 283 ++++ uview-ui/components/u-navbar/u-navbar.vue | 315 ++++ .../components/u-no-network/u-no-network.vue | 233 +++ .../components/u-notice-bar/u-notice-bar.vue | 272 ++++ .../components/u-number-box/u-number-box.vue | 363 +++++ .../u-number-keyboard/u-number-keyboard.vue | 158 ++ .../components/u-parse/libs/CssHandler.js | 100 ++ .../components/u-parse/libs/MpHtmlParser.js | 580 +++++++ uview-ui/components/u-parse/libs/config.js | 80 + uview-ui/components/u-parse/libs/handler.wxs | 22 + uview-ui/components/u-parse/libs/trees.vue | 505 ++++++ uview-ui/components/u-parse/u-parse.vue | 645 ++++++++ uview-ui/components/u-picker/u-picker.vue | 676 ++++++++ uview-ui/components/u-popup/u-popup.vue | 456 ++++++ .../u-radio-group/u-radio-group.vue | 128 ++ uview-ui/components/u-radio/u-radio.vue | 271 ++++ uview-ui/components/u-rate/u-rate.vue | 275 ++++ .../components/u-read-more/u-read-more.vue | 179 +++ .../components/u-row-notice/u-row-notice.vue | 269 ++++ uview-ui/components/u-row/u-row.vue | 84 + uview-ui/components/u-search/u-search.vue | 342 +++++ uview-ui/components/u-section/u-section.vue | 154 ++ uview-ui/components/u-select/u-select.vue | 417 +++++ uview-ui/components/u-skeleton/u-skeleton.vue | 199 +++ uview-ui/components/u-slider/u-slider.vue | 257 ++++ uview-ui/components/u-steps/u-steps.vue | 200 +++ uview-ui/components/u-sticky/u-sticky.vue | 157 ++ .../components/u-subsection/u-subsection.vue | 355 +++++ .../u-swipe-action/u-swipe-action.vue | 255 ++++ uview-ui/components/u-swiper/u-swiper.vue | 340 +++++ uview-ui/components/u-switch/u-switch.vue | 163 ++ uview-ui/components/u-tabbar/u-tabbar.vue | 330 ++++ uview-ui/components/u-table/u-table.vue | 84 + .../u-tabs-swiper/u-tabs-swiper.vue | 488 ++++++ uview-ui/components/u-tabs/u-tabs.vue | 368 +++++ uview-ui/components/u-tag/u-tag.vue | 294 ++++ uview-ui/components/u-td/u-td.vue | 66 + uview-ui/components/u-th/u-th.vue | 62 + .../u-time-line-item/u-time-line-item.vue | 83 + .../components/u-time-line/u-time-line.vue | 43 + uview-ui/components/u-toast/u-toast.vue | 220 +++ uview-ui/components/u-top-tips/u-top-tips.vue | 121 ++ uview-ui/components/u-tr/u-tr.vue | 25 + uview-ui/components/u-upload/u-upload.vue | 654 ++++++++ .../u-verification-code.vue | 164 ++ .../components/u-waterfall/u-waterfall.vue | 176 +++ uview-ui/iconfont.css | 910 +++++++++++ uview-ui/index.js | 141 ++ uview-ui/index.scss | 27 + uview-ui/libs/config/config.js | 15 + uview-ui/libs/config/zIndex.js | 20 + uview-ui/libs/css/color.scss | 155 ++ uview-ui/libs/css/common.scss | 176 +++ uview-ui/libs/css/style.components.scss | 7 + uview-ui/libs/css/style.h5.scss | 8 + uview-ui/libs/css/style.mp.scss | 72 + uview-ui/libs/css/style.nvue.scss | 3 + uview-ui/libs/css/style.vue.scss | 175 +++ uview-ui/libs/function/$parent.js | 18 + uview-ui/libs/function/addUnit.js | 8 + uview-ui/libs/function/bem.js | 5 + uview-ui/libs/function/color.js | 37 + uview-ui/libs/function/colorGradient.js | 134 ++ uview-ui/libs/function/debounce.js | 29 + uview-ui/libs/function/deepClone.js | 23 + uview-ui/libs/function/deepMerge.js | 30 + uview-ui/libs/function/getParent.js | 47 + uview-ui/libs/function/guid.js | 41 + uview-ui/libs/function/md5.js | 385 +++++ uview-ui/libs/function/queryParams.js | 58 + uview-ui/libs/function/random.js | 10 + uview-ui/libs/function/randomArray.js | 7 + uview-ui/libs/function/route.js | 122 ++ uview-ui/libs/function/sys.js | 9 + uview-ui/libs/function/test.js | 232 +++ uview-ui/libs/function/throttle.js | 32 + uview-ui/libs/function/timeFormat.js | 51 + uview-ui/libs/function/timeFrom.js | 47 + uview-ui/libs/function/toast.js | 9 + uview-ui/libs/function/trim.js | 15 + uview-ui/libs/function/type2icon.js | 35 + uview-ui/libs/mixin/mixin.js | 64 + uview-ui/libs/mixin/mpShare.js | 18 + uview-ui/libs/request/index.js | 169 ++ uview-ui/libs/store/index.js | 19 + uview-ui/libs/util/area.js | 1 + uview-ui/libs/util/async-validator.js | 1356 +++++++++++++++++ uview-ui/libs/util/city.js | 1 + uview-ui/libs/util/emitter.js | 51 + uview-ui/libs/util/province.js | 1 + uview-ui/package.json | 39 + uview-ui/theme.scss | 38 + 469 files changed, 68032 insertions(+) create mode 100644 .gitignore create mode 100644 .hbuilderx/launch.json create mode 100644 App.vue create mode 100644 README.md create mode 100644 api/address.js create mode 100644 api/article.js create mode 100644 api/balance.js create mode 100644 api/cart.js create mode 100644 api/confirm.js create mode 100644 api/coupon.js create mode 100644 api/give.js create mode 100644 api/goods.js create mode 100644 api/goods/service.js create mode 100644 api/help.js create mode 100644 api/login/index.js create mode 100644 api/merchant.js create mode 100644 api/merchant/member.js create mode 100644 api/merchant/order.js create mode 100644 api/message.js create mode 100644 api/myCoupon.js create mode 100644 api/order.js create mode 100644 api/page.js create mode 100644 api/points/log.js create mode 100644 api/refund.js create mode 100644 api/region.js create mode 100644 api/setting.js create mode 100644 api/settlement.js create mode 100644 api/upload.js create mode 100644 api/user.js create mode 100644 api/user/coupon.js create mode 100644 app.scss create mode 100644 common/constant/index.js create mode 100644 common/constant/paginate.js create mode 100644 common/enum/coupon/ApplyRange.js create mode 100644 common/enum/coupon/CouponType.js create mode 100644 common/enum/coupon/ExpireType.js create mode 100644 common/enum/coupon/index.js create mode 100644 common/enum/enum.js create mode 100644 common/enum/order/DeliveryStatus.js create mode 100644 common/enum/order/DeliveryType.js create mode 100644 common/enum/order/OrderSource.js create mode 100644 common/enum/order/OrderStatus.js create mode 100644 common/enum/order/PayStatus.js create mode 100644 common/enum/order/PayType.js create mode 100644 common/enum/order/ReceiptStatus.js create mode 100644 common/enum/order/index.js create mode 100644 common/enum/order/refund/AuditStatus.js create mode 100644 common/enum/order/refund/RefundStatus.js create mode 100644 common/enum/order/refund/RefundType.js create mode 100644 common/enum/order/refund/index.js create mode 100644 common/enum/setting/Key.js create mode 100644 common/enum/store/page/category/Style.js create mode 100644 common/enum/store/page/category/index.js create mode 100644 common/model/Region.js create mode 100644 common/model/Setting.js create mode 100644 components/actionsheet/index.js create mode 100644 components/actionsheet/index.json create mode 100644 components/actionsheet/index.wxml create mode 100644 components/actionsheet/index.wxss create mode 100644 components/bian-keywords/iconfont/iconfont.css create mode 100644 components/bian-keywords/iconfont/iconfont.eot create mode 100644 components/bian-keywords/iconfont/iconfont.js create mode 100644 components/bian-keywords/iconfont/iconfont.json create mode 100644 components/bian-keywords/iconfont/iconfont.svg create mode 100644 components/bian-keywords/iconfont/iconfont.ttf create mode 100644 components/bian-keywords/iconfont/iconfont.woff create mode 100644 components/bian-keywords/iconfont/iconfont.woff2 create mode 100644 components/bian-keywords/index.vue create mode 100644 components/btn/index.js create mode 100644 components/btn/index.json create mode 100644 components/btn/index.wxml create mode 100644 components/btn/index.wxss create mode 100644 components/btn/native-button-behaviors.js create mode 100644 components/common/color.js create mode 100644 components/common/component.js create mode 100644 components/common/index.wxss create mode 100644 components/common/style/clearfix.wxss create mode 100644 components/common/style/ellipsis.wxss create mode 100644 components/common/style/hairline.wxss create mode 100644 components/common/style/mixins/clearfix.wxss create mode 100644 components/common/style/mixins/ellipsis.wxss create mode 100644 components/common/style/mixins/hairline.wxss create mode 100644 components/common/style/var.wxss create mode 100644 components/common/utils.js create mode 100644 components/dialog/data.js create mode 100644 components/dialog/dialog.js create mode 100644 components/dialog/index.js create mode 100644 components/dialog/index.json create mode 100644 components/dialog/index.wxml create mode 100644 components/dialog/index.wxss create mode 100644 components/empty/index.vue create mode 100644 components/goods-sku-popup/index.vue create mode 100644 components/goods-sku-popup/number-box/index.vue create mode 100644 components/grade-popup/index.vue create mode 100644 components/jyf-parser/jyf-parser.vue create mode 100644 components/jyf-parser/libs/CssHandler.js create mode 100644 components/jyf-parser/libs/MpHtmlParser.js create mode 100644 components/jyf-parser/libs/config.js create mode 100644 components/jyf-parser/libs/handler.wxs create mode 100644 components/jyf-parser/libs/trees.vue create mode 100644 components/loading/index.js create mode 100644 components/loading/index.json create mode 100644 components/loading/index.wxml create mode 100644 components/loading/index.wxss create mode 100644 components/merchant-shortcut/index.vue create mode 100644 components/mescroll-uni/components/mescroll-down.css create mode 100644 components/mescroll-uni/components/mescroll-down.vue create mode 100644 components/mescroll-uni/components/mescroll-empty.vue create mode 100644 components/mescroll-uni/components/mescroll-top.vue create mode 100644 components/mescroll-uni/components/mescroll-up.css create mode 100644 components/mescroll-uni/components/mescroll-up.vue create mode 100644 components/mescroll-uni/mescroll-body.css create mode 100644 components/mescroll-uni/mescroll-body.vue create mode 100644 components/mescroll-uni/mescroll-mixins.js create mode 100644 components/mescroll-uni/mescroll-uni-option.js create mode 100644 components/mescroll-uni/mescroll-uni.css create mode 100644 components/mescroll-uni/mescroll-uni.js create mode 100644 components/mescroll-uni/mescroll-uni.vue create mode 100644 components/mescroll-uni/mixins/mescroll-comp.js create mode 100644 components/mescroll-uni/mixins/mescroll-more-item.js create mode 100644 components/mescroll-uni/mixins/mescroll-more.js create mode 100644 components/mescroll-uni/wxs/mixins.js create mode 100644 components/mescroll-uni/wxs/renderjs.js create mode 100644 components/mescroll-uni/wxs/wxs.wxs create mode 100644 components/mixins/basic.js create mode 100644 components/mixins/button.js create mode 100644 components/mixins/iphonex.js create mode 100644 components/mixins/link.js create mode 100644 components/mixins/observer/behavior.js create mode 100644 components/mixins/observer/index.js create mode 100644 components/mixins/observer/props.js create mode 100644 components/mixins/open-type.js create mode 100644 components/mixins/touch.js create mode 100644 components/mixins/transition.js create mode 100644 components/neoceansoft-keyboard/neoceansoft-keyboard.vue create mode 100644 components/page/article/index.vue create mode 100644 components/page/banner/index.vue create mode 100644 components/page/blank/index.vue create mode 100644 components/page/coupon/index.vue create mode 100644 components/page/goods/index.vue create mode 100644 components/page/guide/index.vue create mode 100644 components/page/image/index.vue create mode 100644 components/page/index.vue create mode 100644 components/page/location/index.vue create mode 100644 components/page/mixin.js create mode 100644 components/page/navBar/index.vue create mode 100644 components/page/notice/index.vue create mode 100644 components/page/richText/index.vue create mode 100644 components/page/search/index.vue create mode 100644 components/page/service/index.vue create mode 100644 components/page/video/index.vue create mode 100644 components/page/window/index.vue create mode 100644 components/pay-popup/index.vue create mode 100644 components/pop-manager/index.js create mode 100644 components/pop-manager/index.json create mode 100644 components/pop-manager/index.wxml create mode 100644 components/pop-manager/index.wxss create mode 100644 components/popup/index.js create mode 100644 components/popup/index.json create mode 100644 components/popup/index.wxml create mode 100644 components/prestore-popup/index.vue create mode 100644 components/prestore-popup/number-box/index.vue create mode 100644 components/search/index.vue create mode 100644 components/select-region/select-region.vue create mode 100644 components/shortcut/index.vue create mode 100644 components/switch/index.js create mode 100644 components/switch/index.json create mode 100644 components/switch/index.wxml create mode 100644 components/switch/index.wxss create mode 100644 components/toptips/index.js create mode 100644 components/toptips/index.json create mode 100644 components/toptips/index.wxml create mode 100644 components/toptips/index.wxss create mode 100644 components/toptips/toptips.js create mode 100644 components/uni-transition/uni-transition.vue create mode 100644 components/wxs/array.wxs create mode 100644 components/wxs/bem.wxs create mode 100644 components/wxs/memoize.wxs create mode 100644 components/wxs/object.wxs create mode 100644 components/wxs/utils.wxs create mode 100644 components/xuan-switch/xuan-switch.vue create mode 100644 config.js create mode 100644 core/bootstrap.js create mode 100644 core/ican-H5Api.js create mode 100644 main.js create mode 100644 manifest.json create mode 100644 package.json create mode 100644 pages.json create mode 100644 pages/address/create.vue create mode 100644 pages/address/index.vue create mode 100644 pages/address/update.vue create mode 100644 pages/article/detail.vue create mode 100644 pages/article/index.vue create mode 100644 pages/cart/index.vue create mode 100644 pages/category/components/SkuPopup.vue create mode 100644 pages/category/index.vue create mode 100644 pages/comment/index.vue create mode 100644 pages/confirm/doConfirm.vue create mode 100644 pages/confirm/result.vue create mode 100644 pages/coupon/detail.vue create mode 100644 pages/coupon/list.vue create mode 100644 pages/coupon/receive.vue create mode 100644 pages/custom/index.vue create mode 100644 pages/empty.vue create mode 100644 pages/give/index.vue create mode 100644 pages/goods/components/Service.vue create mode 100644 pages/goods/components/SkuPopup.vue create mode 100644 pages/goods/components/SlideImage.vue create mode 100644 pages/goods/detail.scss create mode 100644 pages/goods/detail.vue create mode 100644 pages/goods/list.vue create mode 100644 pages/help/index.vue create mode 100644 pages/index/index.vue create mode 100644 pages/location/index.vue create mode 100644 pages/login/auth.vue create mode 100644 pages/login/components/main.vue create mode 100644 pages/login/components/mp-weixin.vue create mode 100644 pages/login/index.vue create mode 100644 pages/merchant/index.vue create mode 100644 pages/merchant/member/detail.vue create mode 100644 pages/merchant/member/index.vue create mode 100644 pages/merchant/order/index.vue create mode 100644 pages/my-coupon/index.vue create mode 100644 pages/order/comment/index.vue create mode 100644 pages/order/detail.vue create mode 100644 pages/order/express/index.vue create mode 100644 pages/order/index.vue create mode 100644 pages/order/result.vue create mode 100644 pages/pay/cashier.vue create mode 100644 pages/pay/components/Popup.vue create mode 100644 pages/pay/index.vue create mode 100644 pages/pay/result.vue create mode 100644 pages/points/detail.vue create mode 100644 pages/points/gift.vue create mode 100644 pages/prestore/buy.scss create mode 100644 pages/prestore/buy.vue create mode 100644 pages/prestore/components/Popup.vue create mode 100644 pages/prestore/components/Service.vue create mode 100644 pages/prestore/detail.vue create mode 100644 pages/refund/apply.vue create mode 100644 pages/refund/detail.vue create mode 100644 pages/refund/index.vue create mode 100644 pages/search/index.vue create mode 100644 pages/settlement/goods.vue create mode 100644 pages/settlement/index.vue create mode 100644 pages/settlement/style.scss create mode 100644 pages/timer/detail.vue create mode 100644 pages/user/code.vue create mode 100644 pages/user/components/Popup.vue create mode 100644 pages/user/index.vue create mode 100644 pages/user/password.vue create mode 100644 pages/user/setting.vue create mode 100644 pages/wallet/balance/log.vue create mode 100644 pages/wallet/index.vue create mode 100644 pages/wallet/recharge/index.vue create mode 100644 pages/wallet/recharge/order.vue create mode 100644 static/background/user-header.png create mode 100644 static/channel/wechat.png create mode 100644 static/confirm/do.png create mode 100644 static/confirm/undo.png create mode 100644 static/default-avatar.png create mode 100644 static/empty-02.png create mode 100644 static/empty.png create mode 100644 static/icon/add.png create mode 100644 static/icon/coupon.png create mode 100644 static/icon/minus.png create mode 100644 static/icon/saoma.png create mode 100644 static/icon/saoyisao.png create mode 100644 static/nav/1.png create mode 100644 static/nav/2.png create mode 100644 static/nav/3.png create mode 100644 static/nav/4.png create mode 100644 static/order/refund-bg.png create mode 100644 static/order/status/close.png create mode 100644 static/order/status/received.png create mode 100644 static/order/status/wait_deliver.png create mode 100644 static/order/status/wait_pay.png create mode 100644 static/order/status/wait_receipt.png create mode 100644 static/pay/fail.png create mode 100644 static/pay/success.png create mode 100644 static/tabbar/cart-active.png create mode 100644 static/tabbar/cart.png create mode 100644 static/tabbar/cate-active.png create mode 100644 static/tabbar/cate.png create mode 100644 static/tabbar/home-active.png create mode 100644 static/tabbar/home.png create mode 100644 static/tabbar/shop-active.png create mode 100644 static/tabbar/shop.png create mode 100644 static/tabbar/user-active.png create mode 100644 static/tabbar/user.png create mode 100644 static/user/tag.png create mode 100644 store/getters.js create mode 100644 store/index.js create mode 100644 store/modules/app.js create mode 100644 store/modules/index.js create mode 100644 store/modules/user.js create mode 100644 store/mutation-types.js create mode 100644 uni.scss 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/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.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-row/changelog.md create mode 100644 uni_modules/uni-row/components/uni-col/uni-col.vue create mode 100644 uni_modules/uni-row/components/uni-row/uni-row.vue create mode 100644 uni_modules/uni-row/package.json create mode 100644 uni_modules/uni-row/readme.md create mode 100644 utils/app.js create mode 100644 utils/iconfont.scss create mode 100644 utils/request/core/request.js create mode 100644 utils/request/core/utils.js create mode 100644 utils/request/index.js create mode 100644 utils/request/request.js create mode 100644 utils/request/request.md create mode 100644 utils/request/upload/qiniuUploader.js create mode 100644 utils/request/upload/upload.js create mode 100644 utils/request/upload/utils.js create mode 100644 utils/storage.js create mode 100644 utils/util.js create mode 100644 utils/utils.scss create mode 100644 utils/verify.js create mode 100644 uview-ui/LICENSE create mode 100644 uview-ui/README.md create mode 100644 uview-ui/components/u-action-sheet/u-action-sheet.vue create mode 100644 uview-ui/components/u-alert-tips/u-alert-tips.vue create mode 100644 uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue create mode 100644 uview-ui/components/u-avatar-cropper/weCropper.js create mode 100644 uview-ui/components/u-avatar/u-avatar.vue create mode 100644 uview-ui/components/u-back-top/u-back-top.vue create mode 100644 uview-ui/components/u-badge/u-badge.vue create mode 100644 uview-ui/components/u-button/u-button.vue create mode 100644 uview-ui/components/u-calendar/u-calendar.vue create mode 100644 uview-ui/components/u-car-keyboard/u-car-keyboard.vue create mode 100644 uview-ui/components/u-card/u-card.vue create mode 100644 uview-ui/components/u-cell-group/u-cell-group.vue create mode 100644 uview-ui/components/u-cell-item/u-cell-item.vue create mode 100644 uview-ui/components/u-checkbox-group/u-checkbox-group.vue create mode 100644 uview-ui/components/u-checkbox/u-checkbox.vue create mode 100644 uview-ui/components/u-circle-progress/u-circle-progress.vue create mode 100644 uview-ui/components/u-col/u-col.vue create mode 100644 uview-ui/components/u-collapse-item/u-collapse-item.vue create mode 100644 uview-ui/components/u-collapse/u-collapse.vue create mode 100644 uview-ui/components/u-column-notice/u-column-notice.vue create mode 100644 uview-ui/components/u-count-down/u-count-down.vue create mode 100644 uview-ui/components/u-count-to/u-count-to.vue create mode 100644 uview-ui/components/u-divider/u-divider.vue create mode 100644 uview-ui/components/u-dropdown-item/u-dropdown-item.vue create mode 100644 uview-ui/components/u-dropdown/u-dropdown.vue create mode 100644 uview-ui/components/u-empty/u-empty.vue create mode 100644 uview-ui/components/u-field/u-field.vue create mode 100644 uview-ui/components/u-form-item/u-form-item.vue create mode 100644 uview-ui/components/u-form/u-form.vue create mode 100644 uview-ui/components/u-full-screen/u-full-screen.vue create mode 100644 uview-ui/components/u-gap/u-gap.vue create mode 100644 uview-ui/components/u-grid-item/u-grid-item.vue create mode 100644 uview-ui/components/u-grid/u-grid.vue create mode 100644 uview-ui/components/u-icon/u-icon.vue create mode 100644 uview-ui/components/u-image/u-image.vue create mode 100644 uview-ui/components/u-index-anchor/u-index-anchor.vue create mode 100644 uview-ui/components/u-index-list/u-index-list.vue create mode 100644 uview-ui/components/u-input/u-input.vue create mode 100644 uview-ui/components/u-keyboard/u-keyboard.vue create mode 100644 uview-ui/components/u-lazy-load/u-lazy-load.vue create mode 100644 uview-ui/components/u-line-progress/u-line-progress.vue create mode 100644 uview-ui/components/u-line/u-line.vue create mode 100644 uview-ui/components/u-link/u-link.vue create mode 100644 uview-ui/components/u-loading-page/u-loading-page.vue create mode 100644 uview-ui/components/u-loading/u-loading.vue create mode 100644 uview-ui/components/u-loadmore/u-loadmore.vue create mode 100644 uview-ui/components/u-mask/u-mask.vue create mode 100644 uview-ui/components/u-message-input/u-message-input.vue create mode 100644 uview-ui/components/u-modal/u-modal.vue create mode 100644 uview-ui/components/u-navbar/u-navbar.vue create mode 100644 uview-ui/components/u-no-network/u-no-network.vue create mode 100644 uview-ui/components/u-notice-bar/u-notice-bar.vue create mode 100644 uview-ui/components/u-number-box/u-number-box.vue create mode 100644 uview-ui/components/u-number-keyboard/u-number-keyboard.vue create mode 100644 uview-ui/components/u-parse/libs/CssHandler.js create mode 100644 uview-ui/components/u-parse/libs/MpHtmlParser.js create mode 100644 uview-ui/components/u-parse/libs/config.js create mode 100644 uview-ui/components/u-parse/libs/handler.wxs create mode 100644 uview-ui/components/u-parse/libs/trees.vue create mode 100644 uview-ui/components/u-parse/u-parse.vue create mode 100644 uview-ui/components/u-picker/u-picker.vue create mode 100644 uview-ui/components/u-popup/u-popup.vue create mode 100644 uview-ui/components/u-radio-group/u-radio-group.vue create mode 100644 uview-ui/components/u-radio/u-radio.vue create mode 100644 uview-ui/components/u-rate/u-rate.vue create mode 100644 uview-ui/components/u-read-more/u-read-more.vue create mode 100644 uview-ui/components/u-row-notice/u-row-notice.vue create mode 100644 uview-ui/components/u-row/u-row.vue create mode 100644 uview-ui/components/u-search/u-search.vue create mode 100644 uview-ui/components/u-section/u-section.vue create mode 100644 uview-ui/components/u-select/u-select.vue create mode 100644 uview-ui/components/u-skeleton/u-skeleton.vue create mode 100644 uview-ui/components/u-slider/u-slider.vue create mode 100644 uview-ui/components/u-steps/u-steps.vue create mode 100644 uview-ui/components/u-sticky/u-sticky.vue create mode 100644 uview-ui/components/u-subsection/u-subsection.vue create mode 100644 uview-ui/components/u-swipe-action/u-swipe-action.vue create mode 100644 uview-ui/components/u-swiper/u-swiper.vue create mode 100644 uview-ui/components/u-switch/u-switch.vue create mode 100644 uview-ui/components/u-tabbar/u-tabbar.vue create mode 100644 uview-ui/components/u-table/u-table.vue create mode 100644 uview-ui/components/u-tabs-swiper/u-tabs-swiper.vue create mode 100644 uview-ui/components/u-tabs/u-tabs.vue create mode 100644 uview-ui/components/u-tag/u-tag.vue create mode 100644 uview-ui/components/u-td/u-td.vue create mode 100644 uview-ui/components/u-th/u-th.vue create mode 100644 uview-ui/components/u-time-line-item/u-time-line-item.vue create mode 100644 uview-ui/components/u-time-line/u-time-line.vue create mode 100644 uview-ui/components/u-toast/u-toast.vue create mode 100644 uview-ui/components/u-top-tips/u-top-tips.vue create mode 100644 uview-ui/components/u-tr/u-tr.vue create mode 100644 uview-ui/components/u-upload/u-upload.vue create mode 100644 uview-ui/components/u-verification-code/u-verification-code.vue create mode 100644 uview-ui/components/u-waterfall/u-waterfall.vue create mode 100644 uview-ui/iconfont.css create mode 100644 uview-ui/index.js create mode 100644 uview-ui/index.scss create mode 100644 uview-ui/libs/config/config.js create mode 100644 uview-ui/libs/config/zIndex.js create mode 100644 uview-ui/libs/css/color.scss create mode 100644 uview-ui/libs/css/common.scss create mode 100644 uview-ui/libs/css/style.components.scss create mode 100644 uview-ui/libs/css/style.h5.scss create mode 100644 uview-ui/libs/css/style.mp.scss create mode 100644 uview-ui/libs/css/style.nvue.scss create mode 100644 uview-ui/libs/css/style.vue.scss create mode 100644 uview-ui/libs/function/$parent.js create mode 100644 uview-ui/libs/function/addUnit.js create mode 100644 uview-ui/libs/function/bem.js create mode 100644 uview-ui/libs/function/color.js create mode 100644 uview-ui/libs/function/colorGradient.js create mode 100644 uview-ui/libs/function/debounce.js create mode 100644 uview-ui/libs/function/deepClone.js create mode 100644 uview-ui/libs/function/deepMerge.js create mode 100644 uview-ui/libs/function/getParent.js create mode 100644 uview-ui/libs/function/guid.js create mode 100644 uview-ui/libs/function/md5.js create mode 100644 uview-ui/libs/function/queryParams.js create mode 100644 uview-ui/libs/function/random.js create mode 100644 uview-ui/libs/function/randomArray.js create mode 100644 uview-ui/libs/function/route.js create mode 100644 uview-ui/libs/function/sys.js create mode 100644 uview-ui/libs/function/test.js create mode 100644 uview-ui/libs/function/throttle.js create mode 100644 uview-ui/libs/function/timeFormat.js create mode 100644 uview-ui/libs/function/timeFrom.js create mode 100644 uview-ui/libs/function/toast.js create mode 100644 uview-ui/libs/function/trim.js create mode 100644 uview-ui/libs/function/type2icon.js create mode 100644 uview-ui/libs/mixin/mixin.js create mode 100644 uview-ui/libs/mixin/mpShare.js create mode 100644 uview-ui/libs/request/index.js create mode 100644 uview-ui/libs/store/index.js create mode 100644 uview-ui/libs/util/area.js create mode 100644 uview-ui/libs/util/async-validator.js create mode 100644 uview-ui/libs/util/city.js create mode 100644 uview-ui/libs/util/emitter.js create mode 100644 uview-ui/libs/util/province.js create mode 100644 uview-ui/package.json create mode 100644 uview-ui/theme.scss diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2311086 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/unpackage +/utils/request-1.js +.DS_Store \ No newline at end of file diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..77c91eb --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,20 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "default" : + { + "launchtype" : "remote" + }, + "h5" : + { + "launchtype" : "remote" + }, + "mp-weixin" : + { + "launchtype" : "remote" + }, + "type" : "uniCloud" + } + ] +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..b5ce796 --- /dev/null +++ b/App.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/api/address.js b/api/address.js new file mode 100644 index 0000000..be03366 --- /dev/null +++ b/api/address.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/address/list', + detail: 'clientApi/address/detail', + save: 'clientApi/address/save' +} + +// 个人收货地址列表 +export const list = (param) => { + return request.get(api.list, param) +} + +// 收货地址详情 +export const detail = (addressId) => { + return request.post(api.detail, { addressId }) +} + +// 保存收货地址 +export const save = (name, mobile, provinceId, cityId, regionId, detail, status, addressId) => { + return request.post(api.save, { name, mobile, provinceId, cityId, regionId, detail, status, addressId }) +} + +// 设置默认收货地址 +export const setDefault = (addressId, isDefault) => { + return request.post(api.save, { addressId, isDefault }) +} + +// 删除收货地址 +export const remove = (addressId, status) => { + return request.post(api.save, { addressId, status }) +} diff --git a/api/article.js b/api/article.js new file mode 100644 index 0000000..ed2e8e8 --- /dev/null +++ b/api/article.js @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/article/list', + detail: 'clientApi/article/detail', + cate: 'clientApi/article/cateList', +} + +// 文章列表 +export const list = (param) => { + return request.post(api.list, param) +} + +// 文章详情 +export const detail = (articleId) => { + return request.post(api.detail, { articleId }) +} + +// 文章分类列表 +export const cateList = (param) => { + return request.post(api.cate, param) +} \ No newline at end of file diff --git a/api/balance.js b/api/balance.js new file mode 100644 index 0000000..d121e54 --- /dev/null +++ b/api/balance.js @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/balance/list', + setting: 'clientApi/balance/setting', + doRecharge: 'clientApi/balance/doRecharge', +} + +// 余额设置 +export const setting = (param) => { + return request.get(api.setting, param) +} + +// 余额明细 +export const list = (param) => { + return request.post(api.list, param) +} + +// 提交充值 +export const doRecharge = (rechargeAmount, customAmount) => { + return request.post(api.doRecharge, { rechargeAmount, customAmount }) +} \ No newline at end of file diff --git a/api/cart.js b/api/cart.js new file mode 100644 index 0000000..d441878 --- /dev/null +++ b/api/cart.js @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/cart/list', + save: 'clientApi/cart/save', + clear: 'clientApi/cart/clear', +} + +// 购物车列表 +export const list = (cartIds, goodsId, skuId, buyNum, couponId, point) => { + return request.post(api.list, { cartIds, goodsId, skuId, buyNum, couponId, point }) +} + +// 更新购物车 +export const save = (goodsId, action, skuId, buyNum) => { + return request.post(api.save, { goodsId, action, skuId, buyNum }) +} + +// 删除购物车商品 +export const clear = (cartId) => { + return request.post(api.clear, { cartId }) +} diff --git a/api/confirm.js b/api/confirm.js new file mode 100644 index 0000000..59323cc --- /dev/null +++ b/api/confirm.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +// api地址 +const api = { + doConfirm: 'clientApi/confirm/doConfirm', +} + +// 确定核销 +export function doConfirm(code, amount, remark) { + return request.post(api.doConfirm, { code, amount, remark }) +} \ No newline at end of file diff --git a/api/coupon.js b/api/coupon.js new file mode 100644 index 0000000..814441e --- /dev/null +++ b/api/coupon.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/coupon/list', + receive: 'clientApi/coupon/receive', + detail: 'clientApi/coupon/detail' +} + +// 卡券列表 +export const list = (param, option) => { + const options = { + isPrompt: true, //(默认 true 说明:本接口抛出的错误是否提示) + load: true, //(默认 true 说明:本接口是否提示加载动画) + ...option + } + return request.post(api.list, param, options) +} + +// 领券接口 +export const receive = (param) => { + return request.post(api.receive, param) +} + +// 会员卡券详情 +export function detail(couponId) { + return request.post(api.detail, { couponId }) +} diff --git a/api/give.js b/api/give.js new file mode 100644 index 0000000..7ce860c --- /dev/null +++ b/api/give.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +// api地址 +const api = { + doGive: 'clientApi/give/doGive', + giveLog: 'clientApi/give/giveLog' +} + +// 转赠 +export const doGive = (data) => { + return request.post(api.doGive, data) +} + +// 转赠记录 +export const giveLog = (param, option) => { + return request.post(api.giveLog, param) +} diff --git a/api/goods.js b/api/goods.js new file mode 100644 index 0000000..86e1035 --- /dev/null +++ b/api/goods.js @@ -0,0 +1,29 @@ +import request from '@/utils/request' + +// api地址 +const api = { + cateList: 'clientApi/goodsApi/cateList', + list: 'clientApi/goodsApi/list', + search: 'clientApi/goodsApi/search', + detail: 'clientApi/goodsApi/detail' +} + +// 商品分类列表 +export const cateList = param => { + return request.get(api.cateList, param) +} + +// 商品列表 +export const list = param => { + return request.get(api.list, param) +} + +// 商品搜索 +export const search = param => { + return request.post(api.search, param) +} + +// 商品详情 +export const detail = goodsId => { + return request.post(api.detail, { goodsId }) +} diff --git a/api/goods/service.js b/api/goods/service.js new file mode 100644 index 0000000..af4e69e --- /dev/null +++ b/api/goods/service.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/goods/service/list' +} + +// 商品评价列表 +export function list(goodsId) { + return; +} diff --git a/api/help.js b/api/help.js new file mode 100644 index 0000000..9758ce0 --- /dev/null +++ b/api/help.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/article/list' +} + +// 帮助中心列表 +export const list = (param) => { + return request.post(api.list, param) +} diff --git a/api/login/index.js b/api/login/index.js new file mode 100644 index 0000000..8b853e9 --- /dev/null +++ b/api/login/index.js @@ -0,0 +1,41 @@ +import request from '@/utils/request' + +// api地址 +const api = { + register: 'clientApi/sign/register', + login: 'clientApi/sign/signIn', + mpWxLogin: 'clientApi/sign/mpWxLogin', + mpWxAuth: 'clientApi/sign/mpWxAuth', + captcha: 'clientApi/captcha/getCode', + sendSmsCaptcha: 'clientApi/sms/sendVerifyCode' +} + +// 用户注册 +export function register(data) { + return request.post(api.register, data) +} + +// 用户登录 +export function login(data) { + return request.post(api.login, data) +} + +// 微信小程序快捷登录 +export function mpWxLogin(data, option) { + return request.post(api.mpWxLogin, data, option) +} + +// 微信公众号授权 +export function mpWxAuth(data, option) { + return request.post(api.mpWxAuth, data, option) +} + +// 图形验证码 +export function captcha() { + return request.get(api.captcha) +} + +// 发送短信验证码 +export function sendSmsCaptcha(data) { + return request.post(api.sendSmsCaptcha, data) +} diff --git a/api/merchant.js b/api/merchant.js new file mode 100644 index 0000000..12cd2d3 --- /dev/null +++ b/api/merchant.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' + +// api地址 +const api = { + merchantInfo: 'merchantApi/merchant/info', +} + +// 当前商户信息 +export const info = (param, option) => { + const options = { + isPrompt: true, //(默认 true 说明:本接口抛出的错误是否提示) + load: true, //(默认 true 说明:本接口是否提示加载动画) + ...option + } + return request.get(api.merchantInfo, param, options) +} \ No newline at end of file diff --git a/api/merchant/member.js b/api/merchant/member.js new file mode 100644 index 0000000..622b0d1 --- /dev/null +++ b/api/merchant/member.js @@ -0,0 +1,19 @@ +import request from '@/utils/request' + +// api地址 +const api = { + info: 'merchantApi/user/info', + list: 'merchantApi/member/list' +} + +// 会员详情 +export function detail(userId, param) { + return request.post(api.info, { userId, ...param }) +} + + +// 会员列表 +export function list(param, option) { + return request.post(api.list, param, option) +} + diff --git a/api/merchant/order.js b/api/merchant/order.js new file mode 100644 index 0000000..9081b7a --- /dev/null +++ b/api/merchant/order.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'merchantApi/order/list', + detail: 'merchantApi/order/detail' +} + + +// 订单列表 +export function list(param, option) { + return request.post(api.list, param, option) +} + +// 订单详情 +export function detail(orderId, param) { + return request.get(api.detail, { orderId, ...param }) +} diff --git a/api/message.js b/api/message.js new file mode 100644 index 0000000..6c79712 --- /dev/null +++ b/api/message.js @@ -0,0 +1,24 @@ +import request from '@/utils/request' + +// api地址 +const api = { + getOne: 'clientApi/message/getOne', + readed: 'clientApi/message/readed', + getSubTemplate: 'clientApi/message/getSubTemplate' +} + +// 读取最新的一条消息 +export const getOne = (param, option) => { + return request.get(api.getOne, param) +} + +// 将消息置为已读 +export const readed = (param) => { + return request.get(api.readed, param) +} + +// 获取订阅消息模板 +export const getSubTemplate = (param, option) => { + return request.get(api.getSubTemplate, param) +} + diff --git a/api/myCoupon.js b/api/myCoupon.js new file mode 100644 index 0000000..09958f8 --- /dev/null +++ b/api/myCoupon.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/myCoupon/list', + mydetail: 'clientApi/userCouponApi/detail', + detail: 'clientApi/coupon/detail' +} + +// 会员卡券列表 +export const list = (param, option) => { + const options = { + isPrompt: true, //(默认 true 说明:本接口抛出的错误是否提示) + load: true, //(默认 true 说明:本接口是否提示加载动画) + ...option + } + return request.get(api.list, param, options) +} + +// 卡券详情 +export function detail(couponId, userCouponId, userCouponCode) { + if (parseInt(userCouponId) > 0 || userCouponCode.length > 0) { + if (userCouponId == undefined) { + userCouponId = 0 + } + if (userCouponCode == undefined) { + userCouponCode = "" + } + return request.get(api.mydetail, { userCouponId, userCouponCode }) + } else { + return request.post(api.detail, { couponId }) + } +} diff --git a/api/order.js b/api/order.js new file mode 100644 index 0000000..3bda98d --- /dev/null +++ b/api/order.js @@ -0,0 +1,41 @@ +import request from '@/utils/request' + +// api地址 +const api = { + todoCounts: 'clientApi/order/todoCounts', + list: 'clientApi/order/list', + detail: 'clientApi/order/detail', + cancel: 'clientApi/order/cancel', + pay: 'clientApi/pay/doPay', + receipt: 'clientApi/order/receipt', +} + +// 当前用户待处理的订单数量 +export function todoCounts(param) { + return request.get(api.todoCounts, param) +} + +// 我的订单列表 +export function list(param, option) { + return request.post(api.list, param, option) +} + +// 订单详情 +export function detail(orderId, param) { + return request.get(api.detail, { orderId, ...param }) +} + +// 取消订单 +export function cancel(orderId, data) { + return request.get(api.cancel, { orderId, ...data }) +} + +// 立即支付 +export function pay(orderId, payType, param) { + return request.get(api.pay, { orderId, payType, ...param }) +} + +// 确认收货 +export function receipt(orderId, data) { + return request.get(api.receipt, { orderId, ...data }) +} diff --git a/api/page.js b/api/page.js new file mode 100644 index 0000000..5af1b82 --- /dev/null +++ b/api/page.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +// api地址 +const apiUri = { + home: 'clientApi/page/home' +} + +// 页面数据 +export function home() { + return request.get(apiUri.home) +} diff --git a/api/points/log.js b/api/points/log.js new file mode 100644 index 0000000..f0514d6 --- /dev/null +++ b/api/points/log.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/points/list', + gift: 'clientApi/points/doGive' +} + +// 积分明细列表 +export const list = (param) => { + return request.get(api.list, param) +} + +// 积分转赠 +export const gift = (param) => { + return request.post(api.gift, param) +} diff --git a/api/refund.js b/api/refund.js new file mode 100644 index 0000000..586f11a --- /dev/null +++ b/api/refund.js @@ -0,0 +1,30 @@ +import request from '@/utils/request' + +// api地址 +const api = { + list: 'clientApi/refund/list', + goods: 'clientApi/refund/goods', + apply: 'clientApi/refund/submit', + detail: 'clientApi/refund/detail', + delivery: 'clientApi/refund/delivery' +} + +// 售后单列表 +export const list = (param, option) => { + return request.get(api.list, param, option) +} + +// 申请售后 +export const apply = (orderId, data) => { + return request.post(api.apply, { orderId, type: data.type, remark: data.content, images: data.images }) +} + +// 售后单详情 +export const detail = (refundId, param) => { + return request.get(api.detail, { refundId, ...param }) +} + +// 用户发货 +export const delivery = (refundId, data) => { + return request.post(api.delivery, { refundId, form: data }) +} diff --git a/api/region.js b/api/region.js new file mode 100644 index 0000000..3cd07fe --- /dev/null +++ b/api/region.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +// api地址 +const api = { + all: 'clientApi/region/all', + tree: 'clientApi/region/tree' +} + +// 获取所有地区 +export const all = (param) => { + return request.get(api.all, param) +} + +// 获取所有地区(树状) +export const tree = (param) => { + return request.get(api.tree, param) +} diff --git a/api/setting.js b/api/setting.js new file mode 100644 index 0000000..4a43ac2 --- /dev/null +++ b/api/setting.js @@ -0,0 +1,29 @@ +import request from '@/utils/request' + +// api地址 +const api = { + recharge: 'clientApi/system/recharge', + system: 'clientApi/system/config', + storeList: 'clientApi/store/list', + storeDetail: 'clientApi/store/detail', +} + +// 充值配置 +export function recharge() { + return request.get(api.recharge) +} + +// 系统配置 +export function systemConfig() { + return request.get(api.system) +} + +// 店铺列表 +export const storeList = (keyword) => { + return request.post(api.storeList, { keyword }) +} + +// 店铺详情 +export function storeDetail() { + return request.get(api.storeDetail) +} \ No newline at end of file diff --git a/api/settlement.js b/api/settlement.js new file mode 100644 index 0000000..60fdb7e --- /dev/null +++ b/api/settlement.js @@ -0,0 +1,22 @@ +import request from '@/utils/request' + +// api地址 +const api = { + submit: 'clientApi/settlement/submit', + prePay: 'clientApi/pay/prePay', +} + +// 结算台订单提交 +export const submit = (targetId, selectNum, type, remark, payAmount, usePoint, couponId, cartIds, goodsId, skuId, buyNum, orderMode, payType) => { + return request.post(api.submit, { targetId, selectNum, type, remark, payAmount, usePoint, couponId, cartIds, goodsId, skuId, buyNum, orderMode, payType}) +} + +// 支付前查询 +export const prePay = (param) => { + return request.get(api.prePay, param) +} + +// 发起收款 +export const doCashier = (param) => { + return request.post(api.submit, param) +} diff --git a/api/upload.js b/api/upload.js new file mode 100644 index 0000000..754f8fc --- /dev/null +++ b/api/upload.js @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +// api地址 +const api = { + uploadUrl: 'clientApi/file/upload' +} + +// 图片上传 +export const image = (files) => { + // 文件上传大小, 2M + const maxSize = 1024 * 1024 * 2; + // 执行上传 + return new Promise((resolve, reject) => { + request.urlFileUpload({ files, maxSize }) + .then(result => { + const fileIds = result.map(item => { + return item.data; + }) + resolve(fileIds, result) + }) + .catch(err => reject(err)) + }) +} diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..5a175f6 --- /dev/null +++ b/api/user.js @@ -0,0 +1,51 @@ +import request from '@/utils/request' + +// api地址 +const api = { + userInfo: 'clientApi/user/info', + qrCode: 'clientApi/user/qrCode', + assets: 'clientApi/user/asset/', + setting: 'clientApi/user/setting', + defaultStore: 'clientApi/user/defaultStore', + save: 'clientApi/user/saveInfo' +} + +// 当前登录的用户信息 +export const info = (param, option) => { + const options = { + isPrompt: true, //(默认 true 说明:本接口抛出的错误是否提示) + load: true, //(默认 true 说明:本接口是否提示加载动画) + ...option + } + return request.get(api.userInfo, param, options) +} + +// 当前登录的会员码信息 +export const qrCode = (param, option) => { + const options = { + isPrompt: true, + load: true, + ...option + } + return request.get(api.qrCode, param, options) +} + +// 账户资产 +export const assets = (param, option) => { + return request.get(api.assets+param) +} + +// 获取会员设置 +export const setting = (param, option) => { + return request.get(api.setting, param) +} + +// 设置会员的默认店铺 +export const defaultStore = (storeId) => { + return request.get(api.defaultStore, { storeId }) +} + +// 保存会员信息 +export const save = (param, option) => { + return request.post(api.save, param) +} \ No newline at end of file diff --git a/api/user/coupon.js b/api/user/coupon.js new file mode 100644 index 0000000..cb8a284 --- /dev/null +++ b/api/user/coupon.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +// api地址 +const api = { + receive: 'clientApi/user/coupon/receive' +} + +// 优惠券列表 +export const receive = (data) => { + return request.post(api.receive, data) +} diff --git a/app.scss b/app.scss new file mode 100644 index 0000000..c71d863 --- /dev/null +++ b/app.scss @@ -0,0 +1,26 @@ +/* utils.scss */ +@import "/utils/utils.scss"; + +page { + background: #fafafa; +} + +@-webkit-keyframes rotate { + 0% { + transform: rotate(0deg) scale(1); + } + + 100% { + transform: rotate(360deg) scale(1); + } +} + +@keyframes rotate { + 0% { + transform: rotate(0deg) scale(1); + } + + 100% { + transform: rotate(360deg) scale(1); + } +} diff --git a/common/constant/index.js b/common/constant/index.js new file mode 100644 index 0000000..4c1c240 --- /dev/null +++ b/common/constant/index.js @@ -0,0 +1,3 @@ +import paginate from './paginate' + +export { paginate } diff --git a/common/constant/paginate.js b/common/constant/paginate.js new file mode 100644 index 0000000..ae4b4fa --- /dev/null +++ b/common/constant/paginate.js @@ -0,0 +1,7 @@ +export default { + content: [], // 列表数据 + currentPage: 1, // 当前页码 + totalPages: 1, // 最大页码 + pageSize: 15, // 每页记录数 + totalElements: 0, // 总记录数 +} diff --git a/common/enum/coupon/ApplyRange.js b/common/enum/coupon/ApplyRange.js new file mode 100644 index 0000000..7422e62 --- /dev/null +++ b/common/enum/coupon/ApplyRange.js @@ -0,0 +1,10 @@ +import Enum from '../enum' + +/** + * 枚举类:优惠券适用范围 + * ApplyRangeEnum + */ +export default new Enum([ + { key: 'ALL', name: '全部商品', value: 10 }, + { key: 'SOME_GOODS', name: '指定商品', value: 20 } +]) diff --git a/common/enum/coupon/CouponType.js b/common/enum/coupon/CouponType.js new file mode 100644 index 0000000..9e148d1 --- /dev/null +++ b/common/enum/coupon/CouponType.js @@ -0,0 +1,11 @@ +import Enum from '../enum' + +/** + * 枚举类:卡券类型 + * CouponTypeEnum + */ +export default new Enum([ + { key: 'C', name: '优惠券', value: 1000 }, + { key: 'P', name: '储值卡', value: 2000 }, + { key: 'T', name: '计次卡', value: 3000 } +]) diff --git a/common/enum/coupon/ExpireType.js b/common/enum/coupon/ExpireType.js new file mode 100644 index 0000000..269b36c --- /dev/null +++ b/common/enum/coupon/ExpireType.js @@ -0,0 +1,10 @@ +import Enum from '../enum' + +/** + * 枚举类:优惠券到期类型 + * ExpireTypeEnum + */ +export default new Enum([ + { key: 'RECEIVE', name: '领取后', value: 10 }, + { key: 'FIXED_TIME', name: '固定时间', value: 20 } +]) diff --git a/common/enum/coupon/index.js b/common/enum/coupon/index.js new file mode 100644 index 0000000..be1bdc8 --- /dev/null +++ b/common/enum/coupon/index.js @@ -0,0 +1,5 @@ +import ApplyRangeEnum from './ApplyRange' +import ExpireTypeEnum from './ExpireType' +import CouponTypeEnum from './CouponType' + +export { ApplyRangeEnum, CouponTypeEnum, ExpireTypeEnum } diff --git a/common/enum/enum.js b/common/enum/enum.js new file mode 100644 index 0000000..0894708 --- /dev/null +++ b/common/enum/enum.js @@ -0,0 +1,85 @@ +/** + * 枚举类 + * Enum.IMAGE.name => "图片" + * Enum.getNameByKey('IMAGE') => "图片" + * Enum.getValueByKey('IMAGE') => 10 + * Enum.getNameByValue(10) => "图片" + * Enum.getData() => [{key: "IMAGE", name: "图片", value: 10}] + */ +class Enum { + constructor (param) { + const keyArr = [] + const valueArr = [] + + if (!Array.isArray(param)) { + throw new Error('param is not an array!') + } + + param.map(element => { + if (!element.key || !element.name) { + return + } + // 保存key值组成的数组,方便A.getName(name)类型的调用 + keyArr.push(element.key) + valueArr.push(element.value) + // 根据key生成不同属性值,以便A.B.name类型的调用 + this[element.key] = element + if (element.key !== element.value) { + this[element.value] = element + } + }) + + + // 保存源数组 + this.data = param + this.keyArr = keyArr + this.valueArr = valueArr + + // 防止被修改 + // Object.freeze(this) + } + + // 根据key得到对象 + keyOf (key) { + return this.data[this.keyArr.indexOf(key)] + } + + // 根据key得到对象 + valueOf (key) { + return this.data[this.valueArr.indexOf(key)] + } + + // 根据key获取name值 + getNameByKey (key) { + const prop = this.keyOf(key) + if (!prop) { + throw new Error('No enum constant' + key) + } + return prop.name + } + + // 根据value获取name值 + getNameByValue (value) { + const prop = this.valueOf(value) + if (!prop) { + throw new Error('No enum constant' + value) + } + return prop.name + } + + // 根据key获取value值 + getValueByKey (key) { + const prop = this.keyOf(key) + if (!prop) { + throw new Error('No enum constant' + key) + } + return prop.key + } + + // 返回源数组 + getData () { + return this.data + } +} + +export default Enum diff --git a/common/enum/order/DeliveryStatus.js b/common/enum/order/DeliveryStatus.js new file mode 100644 index 0000000..ed55f95 --- /dev/null +++ b/common/enum/order/DeliveryStatus.js @@ -0,0 +1,10 @@ +import Enum from '../enum' + +/** + * 枚举类:订单发货状态 + * DeliveryStatusEnum + */ +export default new Enum([ + { key: 'NOT_DELIVERED', name: '未发货', value: 10 }, + { key: 'DELIVERED', name: '已发货', value: 20 } +]) diff --git a/common/enum/order/DeliveryType.js b/common/enum/order/DeliveryType.js new file mode 100644 index 0000000..fe6623c --- /dev/null +++ b/common/enum/order/DeliveryType.js @@ -0,0 +1,9 @@ +import Enum from '../enum' + +/** + * 枚举类:配送方式 + * DeliveryTypeEnum + */ +export default new Enum([ + { key: 'EXPRESS', name: '快递配送', value: 10 } +]) diff --git a/common/enum/order/OrderSource.js b/common/enum/order/OrderSource.js new file mode 100644 index 0000000..e46062c --- /dev/null +++ b/common/enum/order/OrderSource.js @@ -0,0 +1,11 @@ +import Enum from '../enum' + +/** + * 枚举类:订单来源 + * OrderSourceEnum + */ +export default new Enum([ + { key: 'MASTER', name: '普通订单', value: 10 }, + { key: 'BARGAIN', name: '砍价订单', value: 20 }, + { key: 'SHARP', name: '秒杀订单', value: 30 } +]) diff --git a/common/enum/order/OrderStatus.js b/common/enum/order/OrderStatus.js new file mode 100644 index 0000000..ac444ba --- /dev/null +++ b/common/enum/order/OrderStatus.js @@ -0,0 +1,16 @@ +import Enum from '../enum' + +/** + * 枚举类:订单状态 + * OrderStatusEnum + */ +export default new Enum([ + { key: 'CREATED', name: '待支付', value: 'A' }, + { key: 'PAID', name: '已支付', value: 'B' }, + { key: 'CANCEL', name: '已取消', value: 'C' }, + { key: 'DELIVERY', name: '待发货', value: 'D' }, + { key: 'DELIVERED', name: '已发货', value: 'E' }, + { key: 'RECEIVED', name: '已收货', value: 'F' }, + { key: 'DELETED', name: '已删除', value: 'G' }, + { key: 'REFUND', name: '已退款', value: 'H' }, +]) diff --git a/common/enum/order/PayStatus.js b/common/enum/order/PayStatus.js new file mode 100644 index 0000000..f0e4b1d --- /dev/null +++ b/common/enum/order/PayStatus.js @@ -0,0 +1,10 @@ +import Enum from '../enum' + +/** + * 枚举类:订单支付状态 + * PayStatusEnum + */ +export default new Enum([ + { key: 'PENDING', name: '待支付', value: 10 }, + { key: 'SUCCESS', name: '已支付', value: 20 } +]) diff --git a/common/enum/order/PayType.js b/common/enum/order/PayType.js new file mode 100644 index 0000000..1106806 --- /dev/null +++ b/common/enum/order/PayType.js @@ -0,0 +1,13 @@ +import Enum from '../enum' + +/** + * 枚举类:订单支付方式 + * PayTypeEnum + */ +export default new Enum([ + { key: 'BALANCE', name: '余额支付', value: 'BALANCE' }, + { key: 'WECHAT', name: '微信支付', value: 'JSAPI' }, + { key: 'CASH', name: '余额支付', value: 'CASH' }, + { key: 'MICROPAY', name: '微信扫码支付', value: 'MICROPAY' }, + { key: 'ALISCAN', name: '支付宝支付', value: 'ALISCAN' }, +]) diff --git a/common/enum/order/ReceiptStatus.js b/common/enum/order/ReceiptStatus.js new file mode 100644 index 0000000..34916a0 --- /dev/null +++ b/common/enum/order/ReceiptStatus.js @@ -0,0 +1,10 @@ +import Enum from '../enum' + +/** + * 枚举类:订单收货状态 + * ReceiptStatusEnum + */ +export default new Enum([ + { key: 'NOT_RECEIVED', name: '未收货', value: 10 }, + { key: 'RECEIVED', name: '已收货', value: 20 } +]) diff --git a/common/enum/order/index.js b/common/enum/order/index.js new file mode 100644 index 0000000..e8b7fa5 --- /dev/null +++ b/common/enum/order/index.js @@ -0,0 +1,17 @@ +import DeliveryStatusEnum from './DeliveryStatus' +import DeliveryTypeEnum from './DeliveryType' +import OrderSourceEnum from './OrderSource' +import OrderStatusEnum from './OrderStatus' +import PayStatusEnum from './PayStatus' +import PayTypeEnum from './PayType' +import ReceiptStatusEnum from './ReceiptStatus' + +export { + DeliveryStatusEnum, + DeliveryTypeEnum, + OrderSourceEnum, + OrderStatusEnum, + PayStatusEnum, + PayTypeEnum, + ReceiptStatusEnum +} diff --git a/common/enum/order/refund/AuditStatus.js b/common/enum/order/refund/AuditStatus.js new file mode 100644 index 0000000..2d9f5f0 --- /dev/null +++ b/common/enum/order/refund/AuditStatus.js @@ -0,0 +1,11 @@ +import Enum from '../../enum' + +/** + * 枚举类:商家审核状态 + * AuditStatusEnum + */ +export default new Enum([ + { key: 'WAIT', name: '待审核', value: 0 }, + { key: 'REVIEWED', name: '已同意', value: 10 }, + { key: 'REJECTED', name: '已拒绝', value: 20 } +]) diff --git a/common/enum/order/refund/RefundStatus.js b/common/enum/order/refund/RefundStatus.js new file mode 100644 index 0000000..9ad59fc --- /dev/null +++ b/common/enum/order/refund/RefundStatus.js @@ -0,0 +1,12 @@ +import Enum from '../../enum' + +/** + * 枚举类:售后单状态 + * RefundStatusEnum + */ +export default new Enum([ + { key: 'A', name: '待审核' }, + { key: 'B', name: '已同意' }, + { key: 'C', name: '已拒绝' }, + { key: 'D', name: '已取消' } +]) diff --git a/common/enum/order/refund/RefundType.js b/common/enum/order/refund/RefundType.js new file mode 100644 index 0000000..8adb1d9 --- /dev/null +++ b/common/enum/order/refund/RefundType.js @@ -0,0 +1,10 @@ +import Enum from '../../enum' + +/** + * 枚举类:售后类型 + * RefundTypeEnum + */ +export default new Enum([ + { key: 'RETURN', name: '退货退款', value: 'return' }, + { key: 'EXCHANGE', name: '换货', value: 'exchange' } +]) diff --git a/common/enum/order/refund/index.js b/common/enum/order/refund/index.js new file mode 100644 index 0000000..803b268 --- /dev/null +++ b/common/enum/order/refund/index.js @@ -0,0 +1,9 @@ +import AuditStatusEnum from './AuditStatus' +import RefundStatusEnum from './RefundStatus' +import RefundTypeEnum from './RefundType' + +export { + AuditStatusEnum, + RefundStatusEnum, + RefundTypeEnum +} diff --git a/common/enum/setting/Key.js b/common/enum/setting/Key.js new file mode 100644 index 0000000..69e1a2b --- /dev/null +++ b/common/enum/setting/Key.js @@ -0,0 +1,19 @@ +import Enum from '../enum' + +/** + * 枚举类:设置项索引 + * SettingKeyEnum + */ +export default new Enum([{ + key: 'PAGE_CATEGORY_TEMPLATE', + name: '分类页模板', + value: 'page_category_template' +}, { + key: 'POINTS', + name: '积分设置', + value: 'points' +}, { + key: 'RECHARGE', + name: '充值设置', + value: 'recharge' +}]) diff --git a/common/enum/store/page/category/Style.js b/common/enum/store/page/category/Style.js new file mode 100644 index 0000000..82b9073 --- /dev/null +++ b/common/enum/store/page/category/Style.js @@ -0,0 +1,11 @@ +import Enum from '../../../enum' + +/** + * 枚举类:地址类型 + * PageCategoryStyleEnum + */ +export default new Enum([ + { key: 'ONE_LEVEL_BIG', name: '一级分类[大图]', value: 10 }, + { key: 'ONE_LEVEL_SMALL', name: '一级分类[小图]', value: 11 }, + { key: 'TWO_LEVEL', name: '二级分类', value: 20 } +]) diff --git a/common/enum/store/page/category/index.js b/common/enum/store/page/category/index.js new file mode 100644 index 0000000..bf350e1 --- /dev/null +++ b/common/enum/store/page/category/index.js @@ -0,0 +1,3 @@ +import PageCategoryStyleEnum from './Style' + +export { PageCategoryStyleEnum } diff --git a/common/model/Region.js b/common/model/Region.js new file mode 100644 index 0000000..47763b8 --- /dev/null +++ b/common/model/Region.js @@ -0,0 +1,57 @@ +import * as Api from '@/api/region' +import storage from '@/utils/storage' + +const REGION_TREE = 'region_tree' + +/** + * 商品分类 model类 + * RegionModel + */ +export default { + + // 从服务端获取全部地区数据(树状) + getTreeDataFromApi () { + return new Promise((resolve, reject) => { + Api.tree().then(result => resolve(result.data.data)) + }) + }, + + // 获取所有地区(树状) + getTreeData () { + return new Promise((resolve, reject) => { + // 判断缓存中是否存在 + const data = storage.get(REGION_TREE) + // 从服务端获取全部地区数据 + if (data) { + resolve(data) + } else { + this.getTreeDataFromApi().then(list => { + // 缓存24小时 + storage.set(REGION_TREE, list, 1 * 24 * 60 * 60 * 1000) + resolve(list) + }) + } + }) + }, + + // 获取所有地区的总数 + getCitysCount () { + return new Promise((resolve, reject) => { + // 获取所有地区(树状) + this.getTreeData().then(data => { + const cityIds = [] + // 遍历省份 + for (const pidx in data) { + const province = data[pidx] + // 遍历城市 + for (const cidx in province.city) { + const cityItem = province.city[cidx] + cityIds.push(cityItem.id) + } + } + resolve(cityIds.length) + }) + }) + } + +} diff --git a/common/model/Setting.js b/common/model/Setting.js new file mode 100644 index 0000000..23df31f --- /dev/null +++ b/common/model/Setting.js @@ -0,0 +1,58 @@ +import * as SettingApi from '@/api/setting' +import storage from '@/utils/storage' + +const CACHE_KEY = 'Setting' + +// 写入缓存, 到期时间30分钟 +const setStorage = (data) => { + const expireTime = 30 * 60; + storage.set(CACHE_KEY, data, expireTime); +} + +// 获取缓存中的数据 +const getStorage = () => { + return storage.get(CACHE_KEY); +} + +// 获取系统设置 +const getApiData = () => { + return new Promise((resolve, reject) => { + SettingApi.data() + .then(result => { + resolve(result.data.setting); + }) + }) +} + +/** + * 获取商城设置 + * 有缓存的情况下返回缓存, 没有缓存从后端api获取 + * @param {bool} isCache 是否从缓存中获取 + */ +const data = (isCache = true) => { + return new Promise((resolve, reject) => { + const cacheData = getStorage() + if (isCache && cacheData) { + resolve(cacheData) + } else { + getApiData().then(data => { + setStorage(data) + resolve(data) + }) + } + }) +} + +// 获取指定的系统设置 +const item = (key, isCache = true) => { + return new Promise((resolve, reject) => { + data(isCache).then(setting => { + resolve(setting[key]) + }) + }) +} + +export default { + data, + item +} diff --git a/components/actionsheet/index.js b/components/actionsheet/index.js new file mode 100644 index 0000000..46056ed --- /dev/null +++ b/components/actionsheet/index.js @@ -0,0 +1,42 @@ +'use strict'; + +Component({ + externalClasses: ['mask-class', 'container-class'], + properties: { + actions: { + type: Array, + value: [] + }, + show: { + type: Boolean, + value: false + }, + cancelWithMask: { + type: Boolean, + value: true + }, + cancelText: { + type: String, + value: '' + } + }, + methods: { + onMaskClick: function onMaskClick() { + if (this.data.cancelWithMask) { + this.cancelClick(); + } + }, + cancelClick: function cancelClick() { + this.triggerEvent('cancel'); + }, + handleBtnClick: function handleBtnClick(_ref) { + var _ref$currentTarget = _ref.currentTarget, + currentTarget = _ref$currentTarget === undefined ? {} : _ref$currentTarget; + + var dataset = currentTarget.dataset || {}; + var index = dataset.index; + + this.triggerEvent('actionclick', { index: index }); + } + } +}); \ No newline at end of file diff --git a/components/actionsheet/index.json b/components/actionsheet/index.json new file mode 100644 index 0000000..9d70aaf --- /dev/null +++ b/components/actionsheet/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "zan-btn": "../btn/index" + } +} diff --git a/components/actionsheet/index.wxml b/components/actionsheet/index.wxml new file mode 100644 index 0000000..1825897 --- /dev/null +++ b/components/actionsheet/index.wxml @@ -0,0 +1,39 @@ + + + + + + + + {{ item.name }} + + {{ item.subname }} + + + + + + + {{ cancelText }} + + + diff --git a/components/actionsheet/index.wxss b/components/actionsheet/index.wxss new file mode 100644 index 0000000..85b2f97 --- /dev/null +++ b/components/actionsheet/index.wxss @@ -0,0 +1,86 @@ +.zan-actionsheet { + background-color: #f8f8f8; +} + +.zan-actionsheet__mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 10; + background: rgba(0, 0, 0, 0.7); + display: none; +} + +.zan-actionsheet__container { + position: fixed; + left: 0; + right: 0; + bottom: 0; + background: #f8f8f8; + -webkit-transform: translate3d(0, 50%, 0); + transform: translate3d(0, 50%, 0); + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transition: all 0.2s ease; + transition: all 0.2s ease; + z-index: 11; + opacity: 0; + visibility: hidden; +} + +.zan-actionsheet__btn { + margin-bottom: 0 !important; +} + +.zan-actionsheet__footer .zan-actionsheet__btn { + background: #fff; +} + +.zan-actionsheet__btn-content { + display: -webkit-box; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + flex-direction: row; + -webkit-box-pack: center; + justify-content: center; +} + +.zan-actionsheet__subname { + color: #999; +} + +.zan-actionsheet__name, .zan-actionsheet__subname { + height: 45px; + line-height: 45px; +} + +.zan-actionsheet__btn.zan-btn:last-child::after { + border-bottom-width: 0; +} + +.zan-actionsheet__subname { + margin-left: 2px; + font-size: 12px; +} + +.zan-actionsheet__footer { + margin-top: 10px; +} + +.zan-actionsheet__btn--loading .zan-actionsheet__subname { + color: transparent; +} + +.zan-actionsheet--show .zan-actionsheet__container { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + visibility: visible; +} + +.zan-actionsheet--show .zan-actionsheet__mask { + display: block; +} diff --git a/components/bian-keywords/iconfont/iconfont.css b/components/bian-keywords/iconfont/iconfont.css new file mode 100644 index 0000000..d968bcc --- /dev/null +++ b/components/bian-keywords/iconfont/iconfont.css @@ -0,0 +1,25 @@ +@font-face {font-family: "iconfont"; + src: url('~@/static/iconfont/iconfont.eot?t=1590026368431'); /* IE9 */ + src: url('~@/static/iconfont/iconfont.eot?t=1590026368431#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAANcAAsAAAAAB2gAAAMOAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqCTIIbATYCJAMMCwgABCAFhG0HPBtnBsgekiSCCAEFAIljCIAi+Bp73Xd3QXRIKhMdHh+ViULQwAVUZSMrKzs1HjQb8f93LcvsbAE4b23LkkEhDPxkATMpOUB4vqzaA9Qt2zvWwHpT5GDE57mc3iiQKJy/bTmttW3jUS/AOKDA9sQo4EAKJCBvGLugJd4nUK9XCmGlvLYBeSvMZYE4M1EJeWeyisIatUJ1xd4i3iIPtem17hrxJvh+/Ecz4U1SlZlrVw/KVFT4q1/B4pB7SIdHIN10YbBDZExDCrFRGV0nRtVponrVrNd6kWpFSFMV3G4CrWav3ugfLxHVzOZGMA5riV9ejpLgV/A+CWRQ7THqO5BzxO68JJRhf//OUI1uDkdGbsyEq8SVCV8bigBVJmJ9NoqCOaruDDqzE9W8Obs+FN6w5jcT2bQxnOqIaFzfavSfuaChneG4monP/QK+3CTo9q7Z2ho7LyJg80gQHx9G+q+F5/dWVl27Fn465iozfe29kHZXVlUQc34YrtJX3gnwEvQrMuTu+f5BX8TPcHpwQFb9CONG/ogkb3B0t3D2Niz91cn91+Tzs8dbHPY2I0j/Qh/0OVHwHjq52/319t4QOBFouH/760gPhMrn/En0g3yj2/4Nv/H1rHypOyj3f21DAd+/CY+CbOVz0d1ee5Kx4KXrOvYVzWD6clG0jtaIZXOptARU84QKMpPtPg63d3VuJtTqSpDU6EFWa5gs7GlUaTCLarXmUW9KxeEGHRhRlDpMGgcIrc6QNPuGrNUNWdgfUKXbd1RrDRH11iLszAajYfItYSBxULE8iE2Kw07sAPcNW+uA9lolljYEvCZgmqmAM9My8o0KsAObYoPWR7M4J5gwhw2Xg8fAanVgJ3OYQeFpRs6d2enppOpFaYrDhnwtY4CEAypMNggzUTjYEW8451v4fB1A9bKSsAZGVbUJYDSm8bFMaTI6kBVWeyfGrTyj6UNl4TgCIxgHG6wchIHVqjpgzupZZkDBpTEOKDtlS0eDSFdr2vJ22/sdgXrmmTlS5CiqD3slu2zykSXFojndCCAEAAA=') format('woff2'), + url('~@/static/iconfont/iconfont.woff?t=1590026368431') format('woff'), + url('~@/static/iconfont/iconfont.ttf?t=1590026368431') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ + url('~@/static/iconfont/iconfont.svg?t=1590026368431#iconfont') format('svg'); /* iOS 4.1- */ +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-guanbi:before { + content: "\e607"; +} + +.icon-backspace:before { + content: "\e610"; +} + diff --git a/components/bian-keywords/iconfont/iconfont.eot b/components/bian-keywords/iconfont/iconfont.eot new file mode 100644 index 0000000000000000000000000000000000000000..1c04364489b2a6b07c540690a9477bd45ba653da GIT binary patch literal 2064 zcmd^A&2Jk;6n}5m@%m%eA2^A7q1`xXifCjfZU`s}F-jq!Q6#FgL>v%k-+OQN z&3I;BEI?G!h?o=-O`$&31z>KoKuecB{aCs*)CbGk`^Rh-#i&eqs#A>$u5@6C&@$On zq;;y0MNKe+v;w9{EqDuGlO`xl0m27M6)Z_Wz;0rrVl|X0@)enI0 zp^ucR&UGCCzCS|fm3rQyIr;+eCFp^wb-lrHT7>-+bhBnv?b)lH8$>?DE7eB50G~58jT>{7GTY_oqL&E!@2E=)gy67-~TN zUEWM8&5B9U#Ge?#kLXCKXyQvDI!$B5FV8PsMWpBHS-4UzTHvGxo3Jt%Cck8%`-pE- z9|e?;lyAY_@<#rhvW(c{GXvWb?Q-FjHG1h#JB)ejSKHKvgIvA%RJQ~6p^LL8_6#(? zCH>w2DD|=aX3hQPx%ZtKS}55MWmY= z#n-Zf{m9}%3OP+qWs!$JIg}a|T8?M=!q90>#v{xThABBT%g@CpN6!uUHU2ej=yw7G zQEf~6IIP_XLBLEn9yIT7KTkp#21^H0%3v7>Gqfb_7q zX9E%|q|wt7tKdf@_5tJWx{-a@he?V3;Byj(ur~`5hbe()6*tBgM9j1Fp~Q@bbz5Qu z5Art>tKjz~_5uGQaUY)OM-uxf#;U|2TH%DmVH)Lf=wj2h9DB`N-89SjdaY2eIiW6C zwu|c(tJzh%2J7syUAd?MkI?Hk$QocHT*s z9H%jz$%qdLKAo>u@i1J(vTals2Xc)}TBS|M-dYs;5A$SY>h0E7f2Y;3@;1>wMgbY` literal 0 HcmV?d00001 diff --git a/components/bian-keywords/iconfont/iconfont.js b/components/bian-keywords/iconfont/iconfont.js new file mode 100644 index 0000000..f5217eb --- /dev/null +++ b/components/bian-keywords/iconfont/iconfont.js @@ -0,0 +1 @@ +!function(e){var t,n,o,c,i,a,l,d='',s=(t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss");if(s&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(e){console&&console.log(e)}}function r(){a||(a=!0,c())}n=function(){var e,t,n,o,c,i=document.createElement("div");i.innerHTML=d,d=null,(e=i.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",t=e,(n=document.body).firstChild?(o=t,(c=n.firstChild).parentNode.insertBefore(o,c)):n.appendChild(t))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),n()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(c=n,i=e.document,a=!1,(l=function(){try{i.documentElement.doScroll("left")}catch(e){return void setTimeout(l,50)}r()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,r())})}(window); \ No newline at end of file diff --git a/components/bian-keywords/iconfont/iconfont.json b/components/bian-keywords/iconfont/iconfont.json new file mode 100644 index 0000000..849f510 --- /dev/null +++ b/components/bian-keywords/iconfont/iconfont.json @@ -0,0 +1,23 @@ +{ + "id": "1831825", + "name": "keywords", + "font_family": "iconfont", + "css_prefix_text": "icon-", + "description": "", + "glyphs": [ + { + "icon_id": "9673157", + "name": "关 闭", + "font_class": "guanbi", + "unicode": "e607", + "unicode_decimal": 58887 + }, + { + "icon_id": "9512492", + "name": "退格", + "font_class": "backspace", + "unicode": "e610", + "unicode_decimal": 58896 + } + ] +} diff --git a/components/bian-keywords/iconfont/iconfont.svg b/components/bian-keywords/iconfont/iconfont.svg new file mode 100644 index 0000000..a24756e --- /dev/null +++ b/components/bian-keywords/iconfont/iconfont.svg @@ -0,0 +1,32 @@ + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + diff --git a/components/bian-keywords/iconfont/iconfont.ttf b/components/bian-keywords/iconfont/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b78d76be68c158ffa85997ca81c0c836e0846276 GIT binary patch literal 1896 zcmd^AOK%%h6h3Fh_V_X52TtN{XeUnUA{se~8v=?#j8brDR0))phy?;o?D3=cC3_Mz zKqW7r602512(h5qAy#c9q_C+}WlvF2yFyT96_B7y=n9+f&Rm0(_8)Mqd+v9>^PMy2 zUf;2ai6}xnQfX%8!duI`{cj%;@k?Nr-?%WHTfFkR0{&1rEE`4$DXZQ!0S1a}H z@(+)1|3##>;h(SCR_WN|!f((bPV-d|+C%kY;MNMp*uO&LL%z~zx4O>4{#V}+X;X+V5_(sAgC4!(g9{ZBUGSe# zT?XvkTZQZI#TNghh^PJO5AF$>w+;?`q(B;bMq*n2ysF z@vDXN7m?{Hy$IK96$_m75ED@b!xWG#d>`?3@>5XxRQVq4HE-qLDaXiF$ghHZ%6PN< zT8Umc)DGj`{?#7!Ad|Znj~Y%uKc=W7&I~laD|K&!6&X`lu`}>KR};X>q=@PR>~^?9 zDSG$17k5IS|NHQ+^Kw#=ZIPof3B){NO_|8bB4juw9((|?-}VR!#mgi&f|EMS0%S4kf9jR0RhO22}99! zUhVJcx?)Ti=v7<}Qa@C_#G9X@)ATaF&2$D&%Z-hoi!*8TG&i3^AA!_(IwQP1FY%f2 z`D!%D?4A5G^iZ6rJ4RtWEZ(zGi51f5S&3EflM?%Y@$R~rew@Rc!~yVm ziNiRX6^SF1q>gxFd?DmKPoGH46sKDfD-@+W606|vO6&vvMPfgV(Ibfi6lYc9Fs*Y^ z;s|B97CzgtEypgI8{1~B*lLzrO(#4AYj$O`Zgqz4a9y`M-CC<@&SqzZ)Qa7-JHtBN ztxC>u%4WIKYM2ESwCnYj+3vJ1*+nN?b)5FX^t5=8;IqY613wIBv2B|ya$rkj(gtnA z)~HA=YEs#?4s=JEHRvm}Np<9Qo`@b*uS4CTE_9-*NwbutnJ2PVplZ6xqy2Pg3s1|T zO9wrfm>pDV02O41Hae*To78q=mr$n&b(X4bR+|=R8lT~ghWf0#(}uVx!~X{HKk&4n avcf8U)B}}GtGQ7NZCJ(kyKSpz6a52_+6Tt~ literal 0 HcmV?d00001 diff --git a/components/bian-keywords/iconfont/iconfont.woff b/components/bian-keywords/iconfont/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..2268d6e55081b4cd311cec2dc6db337be210bf91 GIT binary patch literal 1248 zcmXT-cXMN4WB>w|2MpXGnmq%;2eDCsdvK@|0|O%mP}CTRoi_a2{MJ8M-v}sX1LV5^ zahOf52UBuxVgXRB0mu&p(rqczFWgDbsZ0a1Zve3f5c{0_zUNy;YGMil1JfIzI(;BE zllboTA_FMMz`!g6D9GTImzbLh6w3kH=?b(f*DmB=Z9#r<3DCb=fNHdX*v9JM+!Ymbk`q!A z5*{Q?NWPGmP*V7rGx0$}LSh5M1fFESv?`?lo>R=HHa2APDWo-bFfnu~Gy5}u^&}?D zIdI_AfrD30mb5iCE|hmN-j`;O^duo6At@m>?En|krI=s|nRy%Sg%k3A+&>_2_|Aa~ z3?gYPCm9*;z2N>;G3V`sgS-s}Jk0u;nnI5*8dewx=pTD8b<{VJTPJpnMWtj!gNon8 zgLyp*y;r)XNog{TnabyLM>f2F3aV0f}ejAN*i0 zt7~0;+GAt>z1w%U|K@PnAOCK(bdaY=g57SX(2fShrt4>!+TRKAYD>mbq_z5B2j1L;8#dr9nT{Za5vQJp``oBt*sE_7TNR`*K|Ge2qT%ZA$)$e`bAl zXEc8H2=%akOEhph&uPWZDbcH*%i#HiUES0o02;>(k2b%)t9In`?V8jFX^9Mt(fJb6 z0$={K>+qbpvz~dpf&y%`x2p5D-znDuqH8T z{1sfC7ZH;6J+|cjGQZhcoyy18USTef>pQ?{!E~p=`h$o1Y_n;{@9(Kh_Gh^BfL*Td zzV7#lwlPN5MZDrW#McGa3*=3RZ<(F(ICO{WU*8+Yjh7wDElI3wzP=;rTT6K&zibW1 z^@3jihgM(pAF}<7-qC6Ohim(VkFO5dJ&Oz9(d(}N?Rc2}oVb-w9gi+NsWjPgf78sk z_mf)JUV1erJNk%PaPxwA&)~V4(RYL2Tz7u1BpNw+73XRz&z@6jZ@#*~D*gOZ;Ck^+ zxfZpj5y}6y9b@V%WNlUD>oIhaNa;BB;)Qi++L!ekoe#xThuNNeUJ@;G<$rN2Bh#1j zF~PewU8=P5Z?uh<4k|6t&O1GCipj*dvz|hmoZ_x+3vqhIXqFn@Cs-A8vD027-Qzz4 zXH?z^U{Hg?IjMm`kL^vv%!!>7XHINw)ZJ@hsINKMSkusQ_YMU^%c+fw3@!<5b_@U= C)8oVd literal 0 HcmV?d00001 diff --git a/components/bian-keywords/iconfont/iconfont.woff2 b/components/bian-keywords/iconfont/iconfont.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..56ed8bca556e29dfcd5a8c4454a843e619941eb2 GIT binary patch literal 860 zcmV-i1Ec(RPew8T0RR9100UeA3jhEB00(FQ00RyH0RR9100000000000000000000 z0000SLIzd3Z3jFXX9ma~k|cr%0R;ewV+epE_!@iN zcXvT_NGcN@9v_v7LeRhkRAnP8D?2qFG#l~%cP-28YymiLZOf8DAq@Ov0W&E%KzP2a z+5^-r+dJ04dQ;?J#OJx3-YAeLoWE^3t+j3AQ7^zapuqOTDBwT}Bp`1XyPzfBCs40f z3Sp(ZwgGu7%w>T%Gf@e7XR?aI8nr@o#oi*`A`i9cweA}6Cis5*M>F9~Qk9u&R}acm zRQRi3!Qzm6NQXxt-E?8FLu5=t3b9ccT_;A>X`*`7tk-&xYDGv>72IwDt!A&@=pQc; z)y(EbFb->pUtW%q;8*ZI31m?1G3q;zbHwhvB$Q!)|ISd2ZVpFAZp?(M#FYtO8;Sr` zCSrXyih?<+?hHD!6V<#qyFL`&u;w=t*|ag7>WFAu-)i)qxuBt);kcTK&;0_v+$8As zuG!ieJ1-(&^GFaMA4dAGh3EHHR$aRmemdqVGkxv7kakyARSBi{Rrbm{)i-RaCEnD_BJg2)ye(WqrlT%IEw^^n-k(+x`u|@%5~HsXHk5e{Dkn-@gfuf^6k;(cNBq zlCj{W>pJ!o&0zX+QM8WMh-GuBv;;U%-TkC-KS|ye?1iU6-nyG*@(=zgn3a|s4VuRL4vp6T1FozA7gU7&X zbzmoRm_gxbM$Vnt>FK2EMQMt|hI}n!fP@1oOg0EJQ8?HUZ#d^$_}3Jfz_%yV9x4UW + + + + + + + + {{ title ? title : "请输入您的密码" }} + + 付款金额:{{price}} + + + {{password[item] ? '●' : ''}} + + 忘记密码? + + + + + + {{item == 10 ? '' : item == 11 ? '0' : item == 12 ? '': item}} + + + + {{item == 10 ? '' : item == 11 ? '0' : item == 12 ? '': item}} + + + + + + + + \ No newline at end of file diff --git a/components/btn/index.js b/components/btn/index.js new file mode 100644 index 0000000..1ec7783 --- /dev/null +++ b/components/btn/index.js @@ -0,0 +1,61 @@ +'use strict'; + +var nativeButtonBehavior = require('./native-button-behaviors'); + +Component({ + externalClasses: ['custom-class', 'theme-class'], + behaviors: [nativeButtonBehavior], + relations: { + '../btn-group/index': { + type: 'parent', + linked: function linked() { + this.setData({ inGroup: true }); + }, + unlinked: function unlinked() { + this.setData({ inGroup: false }); + } + } + }, + properties: { + type: { + type: String, + value: '' + }, + size: { + type: String, + value: '' + }, + plain: { + type: Boolean, + value: false + }, + disabled: { + type: Boolean, + value: false + }, + loading: { + type: Boolean, + value: false + } + }, + + data: { + inGroup: false, + isLast: false + }, + + methods: { + handleTap: function handleTap() { + if (this.data.disabled) { + this.triggerEvent('disabledclick'); + return; + } + this.triggerEvent('btnclick'); + }, + switchLastButtonStatus: function switchLastButtonStatus() { + var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + this.setData({ isLast: isLast }); + } + } +}); \ No newline at end of file diff --git a/components/btn/index.json b/components/btn/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/btn/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/btn/index.wxml b/components/btn/index.wxml new file mode 100644 index 0000000..13d69d7 --- /dev/null +++ b/components/btn/index.wxml @@ -0,0 +1,24 @@ + diff --git a/components/btn/index.wxss b/components/btn/index.wxss new file mode 100644 index 0000000..84d50b9 --- /dev/null +++ b/components/btn/index.wxss @@ -0,0 +1 @@ +.zan-btn{position:relative;color:#333;background-color:#fff;padding-left:15px;padding-right:15px;border-radius:2px;font-size:16px;line-height:45px;height:45px;box-sizing:border-box;text-decoration:none;text-align:center;vertical-align:middle;overflow:visible}.zan-btn--group{margin-bottom:10px}.zan-btn::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-width:1px;border-radius:4px}.zan-btn--primary{color:#fff;background-color:#4b0}.zan-btn--primary::after{border-color:#0a0}.zan-btn--warn{color:#fff;background-color:#f85}.zan-btn--warn::after{border-color:#f85}.zan-btn--danger{color:#fff;background-color:#f44}.zan-btn--danger::after{border-color:#e33}.zan-btn--small{display:inline-block;height:30px;line-height:30px;font-size:12px}.zan-btn--small.zan-btn--group{margin-bottom:0;margin-right:5px}.zan-btn--mini{display:inline-block;line-height:21px;height:22px;font-size:10px;padding-left:5px;padding-right:5px}.zan-btn--mini.zan-btn--group{margin-bottom:0;margin-right:5px}.zan-btn--large{border-radius:0;border:none;line-height:50px;height:50px}.zan-btn--large.zan-btn--group{margin-bottom:0}.zan-btn--plain.zan-btn{background-color:transparent}.zan-btn--plain.zan-btn--primary{color:#06bf04}.zan-btn--plain.zan-btn--warn{color:#f60}.zan-btn--plain.zan-btn--danger{color:#f44}.button-hover{opacity:.9}.zan-btn--loading{color:transparent;opacity:1}.zan-btn--loading::before{position:absolute;left:50%;top:50%;content:' ';width:16px;height:16px;margin-left:-8px;margin-top:-8px;border:3px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;border-radius:8px;box-sizing:border-box;-webkit-animation:btn-spin .6s linear;animation:btn-spin .6s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.zan-btn--danger.zan-btn--loading::before,.zan-btn--primary.zan-btn--loading::before,.zan-btn--warn.zan-btn--loading::before{border-color:#fff rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.1)}@-webkit-keyframes btn-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes btn-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.zan-btn.zan-btn--disabled{color:#999!important;background:#f8f8f8!important;border-color:#e5e5e5!important;cursor:not-allowed!important;opacity:1!important}.zan-btn.zan-btn--disabled::after{border-color:#e5e5e5!important}.zan-btn--group.zan-btn--last{margin-bottom:0;margin-right:0} \ No newline at end of file diff --git a/components/btn/native-button-behaviors.js b/components/btn/native-button-behaviors.js new file mode 100644 index 0000000..3bd240d --- /dev/null +++ b/components/btn/native-button-behaviors.js @@ -0,0 +1,74 @@ +'use strict'; + +module.exports = Behavior({ + properties: { + loading: Boolean, + // 在自定义组件中,无法与外界的 form 组件联动,暂时不开放 + // formType: String, + openType: String, + appParameter: String, + // 暂时不开放,直接传入无法设置样式 + // hoverClass: { + // type: String, + // value: 'button-hover' + // }, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + lang: { + type: String, + value: 'en' + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: String + }, + methods: { + bindgetuserinfo: function bindgetuserinfo() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$detail = _ref.detail, + detail = _ref$detail === undefined ? {} : _ref$detail; + + this.triggerEvent('getuserinfo', detail); + }, + bindcontact: function bindcontact() { + var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref2$detail = _ref2.detail, + detail = _ref2$detail === undefined ? {} : _ref2$detail; + + this.triggerEvent('contact', detail); + }, + bindgetphonenumber: function bindgetphonenumber() { + var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref3$detail = _ref3.detail, + detail = _ref3$detail === undefined ? {} : _ref3$detail; + + this.triggerEvent('getphonenumber', detail); + }, + bindopensetting: function bindopensetting() { + var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref4$detail = _ref4.detail, + detail = _ref4$detail === undefined ? {} : _ref4$detail; + + this.triggerEvent('opensetting', detail); + }, + binderror: function binderror() { + var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref5$detail = _ref5.detail, + detail = _ref5$detail === undefined ? {} : _ref5$detail; + + this.triggerEvent('error', detail); + } + } +}); \ No newline at end of file diff --git a/components/common/color.js b/components/common/color.js new file mode 100644 index 0000000..5f5e966 --- /dev/null +++ b/components/common/color.js @@ -0,0 +1,3 @@ +export const RED = '#f44'; +export const BLUE = '#1989fa'; +export const GREEN = '#07c160'; diff --git a/components/common/component.js b/components/common/component.js new file mode 100644 index 0000000..63ef1a9 --- /dev/null +++ b/components/common/component.js @@ -0,0 +1,48 @@ +import { basic } from '../mixins/basic'; +import { observe } from '../mixins/observer/index'; +function mapKeys(source, target, map) { + Object.keys(map).forEach(key => { + if (source[key]) { + target[map[key]] = source[key]; + } + }); +} +function VantComponent(vantOptions = {}) { + const options = {}; + mapKeys(vantOptions, options, { + data: 'data', + props: 'properties', + mixins: 'behaviors', + methods: 'methods', + beforeCreate: 'created', + created: 'attached', + mounted: 'ready', + relations: 'relations', + destroyed: 'detached', + classes: 'externalClasses' + }); + const { relation } = vantOptions; + if (relation) { + options.relations = Object.assign(options.relations || {}, { + [`../${relation.name}/index`]: relation + }); + } + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic); + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true + }; + observe(vantOptions, options); + Component(options); +} +export { VantComponent }; diff --git a/components/common/index.wxss b/components/common/index.wxss new file mode 100644 index 0000000..474d28b --- /dev/null +++ b/components/common/index.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} \ No newline at end of file diff --git a/components/common/style/clearfix.wxss b/components/common/style/clearfix.wxss new file mode 100644 index 0000000..df65a0a --- /dev/null +++ b/components/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix::after{content:'';display:table;clear:both} \ No newline at end of file diff --git a/components/common/style/ellipsis.wxss b/components/common/style/ellipsis.wxss new file mode 100644 index 0000000..94eba8e --- /dev/null +++ b/components/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical} \ No newline at end of file diff --git a/components/common/style/hairline.wxss b/components/common/style/hairline.wxss new file mode 100644 index 0000000..0988a6a --- /dev/null +++ b/components/common/style/hairline.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} \ No newline at end of file diff --git a/components/common/style/mixins/clearfix.wxss b/components/common/style/mixins/clearfix.wxss new file mode 100644 index 0000000..e69de29 diff --git a/components/common/style/mixins/ellipsis.wxss b/components/common/style/mixins/ellipsis.wxss new file mode 100644 index 0000000..e69de29 diff --git a/components/common/style/mixins/hairline.wxss b/components/common/style/mixins/hairline.wxss new file mode 100644 index 0000000..e69de29 diff --git a/components/common/style/var.wxss b/components/common/style/var.wxss new file mode 100644 index 0000000..e69de29 diff --git a/components/common/utils.js b/components/common/utils.js new file mode 100644 index 0000000..2f0a66a --- /dev/null +++ b/components/common/utils.js @@ -0,0 +1,14 @@ +function isDef(value) { + return value !== undefined && value !== null; +} +function isObj(x) { + const type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} +function isNumber(value) { + return /^\d+$/.test(value); +} +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +export { isObj, isDef, isNumber, range }; diff --git a/components/dialog/data.js b/components/dialog/data.js new file mode 100644 index 0000000..597b192 --- /dev/null +++ b/components/dialog/data.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = { + // 标题 + title: '', + // 内容 + message: ' ', + // 选择节点 + selector: '#zan-dialog', + // 按钮是否展示为纵向 + buttonsShowVertical: false, + // 是否展示确定 + showConfirmButton: true, + // 确认按钮文案 + confirmButtonText: '确定', + // 确认按钮颜色 + confirmButtonColor: '#3CC51F', + // 是否展示取消 + showCancelButton: false, + // 取消按钮文案 + cancelButtonText: '取消', + // 取消按钮颜色 + cancelButtonColor: '#333', + // 点击按钮自动关闭 dialog + autoClose: true +}; \ No newline at end of file diff --git a/components/dialog/dialog.js b/components/dialog/dialog.js new file mode 100644 index 0000000..a305fa1 --- /dev/null +++ b/components/dialog/dialog.js @@ -0,0 +1,104 @@ +'use strict'; + +var defaultData = require('./data'); + +function getDialogCtx(_ref) { + var selector = _ref.selector, + pageCtx = _ref.pageCtx; + + var ctx = pageCtx; + if (!ctx) { + var pages = getCurrentPages(); + ctx = pages[pages.length - 1]; + } + return ctx.selectComponent(selector); +} + +function getParsedOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + return Object.assign({ + // 自定义 btn 列表 + // { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色 } + buttons: [] + }, defaultData, options); +} + +// options 使用参数 +// pageCtx 页面 page 上下文 +function Dialog(options, pageCtx) { + var parsedOptions = getParsedOptions(options); + + var dialogCtx = getDialogCtx({ + selector: parsedOptions.selector, + pageCtx: pageCtx + }); + + if (!dialogCtx) { + console.error('无法找到对应的dialog组件,请于页面中注册并在 wxml 中声明 dialog 自定义组件'); + return Promise.reject({ type: 'component error' }); + } + + // 处理默认按钮的展示 + // 纵向排布确认按钮在上方 + var _parsedOptions$button = parsedOptions.buttons, + buttons = _parsedOptions$button === undefined ? [] : _parsedOptions$button; + + var showCustomBtns = false; + if (buttons.length === 0) { + if (parsedOptions.showConfirmButton) { + buttons.push({ + type: 'confirm', + text: parsedOptions.confirmButtonText, + color: parsedOptions.confirmButtonColor + }); + } + + if (parsedOptions.showCancelButton) { + var cancelButton = { + type: 'cancel', + text: parsedOptions.cancelButtonText, + color: parsedOptions.cancelButtonColor + }; + if (parsedOptions.buttonsShowVertical) { + buttons.push(cancelButton); + } else { + buttons.unshift(cancelButton); + } + } + } else { + showCustomBtns = true; + } + + return new Promise(function (resolve, reject) { + dialogCtx.setData(Object.assign({}, parsedOptions, { + buttons: buttons, + showCustomBtns: showCustomBtns, + key: '' + new Date().getTime(), + show: true, + promiseFunc: { resolve: resolve, reject: reject }, + openTypePromiseFunc: null + })); + }); +} + +Dialog.close = function (options, pageCtx) { + var parsedOptions = getParsedOptions(options); + + var dialogCtx = getDialogCtx({ + selector: parsedOptions.selector, + pageCtx: pageCtx + }); + + if (!dialogCtx) { + return; + } + + dialogCtx.setData({ + show: false, + promiseFunc: null, + openTypePromiseFunc: null + }); +}; + +module.exports = Dialog; \ No newline at end of file diff --git a/components/dialog/index.js b/components/dialog/index.js new file mode 100644 index 0000000..9260a69 --- /dev/null +++ b/components/dialog/index.js @@ -0,0 +1,148 @@ +'use strict'; + +var _f = function _f() {}; +var needResponseOpenTypes = ['getUserInfo', 'getPhoneNumber', 'openSetting']; + +Component({ + properties: {}, + + data: { + // 标题 + title: '', + // 自定义 btn 列表 + // { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色, openType: 微信开放能力 } + buttons: [], + // 内容 + message: ' ', + // 选择节点 + selector: '#zan-dialog', + // 是否允许滚动 + isScroll: false, + // 按钮是否展示为纵向 + buttonsShowVertical: false, + // 是否展示确定 + showConfirmButton: true, + // 确认按钮文案 + confirmButtonText: '确定', + // 确认按钮颜色 + confirmButtonColor: '#3CC51F', + // 是否展示取消 + showCancelButton: false, + // 取消按钮文案 + cancelButtonText: '取消', + // 取消按钮颜色 + cancelButtonColor: '#333', + key: '', + autoClose: true, + show: false, + showCustomBtns: false, + promiseFunc: {}, + openTypePromiseFunc: {} + }, + + methods: { + handleButtonClick: function handleButtonClick(e) { + var _this = this; + + var _e$currentTarget = e.currentTarget, + currentTarget = _e$currentTarget === undefined ? {} : _e$currentTarget; + var _currentTarget$datase = currentTarget.dataset, + dataset = _currentTarget$datase === undefined ? {} : _currentTarget$datase; + + // 获取当次弹出框的信息 + + var _ref = this.data.promiseFunc || {}, + _ref$resolve = _ref.resolve, + resolve = _ref$resolve === undefined ? _f : _ref$resolve, + _ref$reject = _ref.reject, + reject = _ref$reject === undefined ? _f : _ref$reject; + + // 重置展示 + + + if (this.data.autoClose) { + this.setData({ + show: false + }); + } + + // 自定义按钮,全部 resolve 形式返回,根据 type 区分点击按钮 + if (this.data.showCustomBtns) { + var isNeedOpenDataButton = needResponseOpenTypes.indexOf(dataset.openType) > -1; + var resolveData = { + type: dataset.type + }; + // 如果需要 openData,就额外返回一个 promise,用于后续 open 数据返回 + if (isNeedOpenDataButton) { + resolveData.openDataPromise = new Promise(function(resolve, reject) { + _this.setData({ + openTypePromiseFunc: { + resolve: resolve, + reject: reject + } + }); + }); + resolveData.hasOpenDataPromise = true; + } + resolve(resolveData); + return; + } + + // 默认按钮,确认为 resolve,取消为 reject + if (dataset.type === 'confirm') { + resolve({ + type: 'confirm' + }); + } else { + reject({ + type: 'cancel' + }); + } + + this.setData({ + promiseFunc: {} + }); + }, + + + // 以下为处理微信按钮开放能力的逻辑 + handleUserInfoResponse: function handleUserInfoResponse(_ref2) { + var detail = _ref2.detail; + + this.__handleOpenDataResponse({ + type: detail.errMsg === 'getUserInfo:ok' ? 'resolve' : 'reject', + data: detail + }); + }, + handlePhoneResponse: function handlePhoneResponse(_ref3) { + var detail = _ref3.detail; + + this.__handleOpenDataResponse({ + type: detail.errMsg === 'getPhoneNumber:ok' ? 'resolve' : 'reject', + data: detail + }); + }, + handleOpenSettingResponse: function handleOpenSettingResponse(_ref4) { + var detail = _ref4.detail; + + this.__handleOpenDataResponse({ + type: detail.errMsg === 'openSetting:ok' ? 'resolve' : 'reject', + data: detail + }); + }, + __handleOpenDataResponse: function __handleOpenDataResponse(_ref5) { + var _ref5$type = _ref5.type, + type = _ref5$type === undefined ? 'resolve' : _ref5$type, + _ref5$data = _ref5.data, + data = _ref5$data === undefined ? {} : _ref5$data; + + var promiseFuncs = this.data.openTypePromiseFunc || {}; + var responseFunc = promiseFuncs[type] || _f; + + responseFunc(data); + this.setData({ + openTypePromiseFunc: null + }); + } + } +}); \ No newline at end of file diff --git a/components/dialog/index.json b/components/dialog/index.json new file mode 100644 index 0000000..e783dbb --- /dev/null +++ b/components/dialog/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "pop-manager": "../pop-manager/index", + "zan-button": "../btn/index" + } +} diff --git a/components/dialog/index.wxml b/components/dialog/index.wxml new file mode 100644 index 0000000..b7896b6 --- /dev/null +++ b/components/dialog/index.wxml @@ -0,0 +1,18 @@ + + + {{ title }} + + + {{ message }} + + + + + + {{ item.text }} + + + + + \ No newline at end of file diff --git a/components/dialog/index.wxss b/components/dialog/index.wxss new file mode 100644 index 0000000..2d7efdf --- /dev/null +++ b/components/dialog/index.wxss @@ -0,0 +1,79 @@ +.zan-dialog--container { + width: 80vw; + font-size: 16px; + overflow: hidden; + border-radius: 4px; + background-color: #fff; + color: #333; +} + +.zan-dialog__header { + padding: 15px 0 0; + text-align: center; +} + +.zan-dialog__content { + position: relative; + padding: 15px 20px; + line-height: 1.5; + min-height: 40px; +} + +.zan-dialog__content::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + -webkit-transform: scale(0.5); + transform: scale(0.5); + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + border: 0 solid #e5e5e5; + border-bottom-width: 1px; +} + +.zan-dialog__content--title { + color: #999; + font-size: 14px; +} + +.zan-dialog__content--scroll { + max-height: 70vh; +} + +.zan-dialog__footer { + overflow: hidden; +} + +.zan-dialog__button { + -webkit-box-flex: 1; + flex: 1; +} + +.zan-dialog__button-inside, .zan-dialog__button-inside--first { + margin-bottom: 0; + line-height: 50px; + height: 50px; +} + +.zan-dialog__button-inside--first::after, .zan-dialog__button-inside::after { + border-width: 0; + border-radius: 0; +} + +.zan-dialog__footer--horizon { + display: -webkit-box; + display: flex; +} + +.zan-dialog__footer--horizon .zan-dialog__button-inside::after { + border-left-width: 1px; +} + +.zan-dialog__footer--vertical .zan-dialog__button-inside::after { + border-top-width: 1px; +} diff --git a/components/empty/index.vue b/components/empty/index.vue new file mode 100644 index 0000000..ad790be --- /dev/null +++ b/components/empty/index.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/components/goods-sku-popup/index.vue b/components/goods-sku-popup/index.vue new file mode 100644 index 0000000..a317f6a --- /dev/null +++ b/components/goods-sku-popup/index.vue @@ -0,0 +1,869 @@ + + + + + diff --git a/components/goods-sku-popup/number-box/index.vue b/components/goods-sku-popup/number-box/index.vue new file mode 100644 index 0000000..2cf44d5 --- /dev/null +++ b/components/goods-sku-popup/number-box/index.vue @@ -0,0 +1,394 @@ + + + + diff --git a/components/grade-popup/index.vue b/components/grade-popup/index.vue new file mode 100644 index 0000000..4a67449 --- /dev/null +++ b/components/grade-popup/index.vue @@ -0,0 +1,524 @@ + + + + + diff --git a/components/jyf-parser/jyf-parser.vue b/components/jyf-parser/jyf-parser.vue new file mode 100644 index 0000000..0c78621 --- /dev/null +++ b/components/jyf-parser/jyf-parser.vue @@ -0,0 +1,645 @@ + + + + + diff --git a/components/jyf-parser/libs/CssHandler.js b/components/jyf-parser/libs/CssHandler.js new file mode 100644 index 0000000..8f06b99 --- /dev/null +++ b/components/jyf-parser/libs/CssHandler.js @@ -0,0 +1,100 @@ +const cfg = require('./config.js'), + isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + +function CssHandler(tagStyle) { + var styles = Object.assign(Object.create(null), cfg.userAgentStyles); + for (var item in tagStyle) + styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item]; + this.styles = styles; +} +CssHandler.prototype.getStyle = function(data) { + this.styles = new parser(data, this.styles).parse(); +} +CssHandler.prototype.match = function(name, attrs) { + var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : ''; + if (attrs.class) { + var items = attrs.class.split(' '); + for (var i = 0, item; item = items[i]; i++) + if (tmp = this.styles['.' + item]) + matched += tmp + ';'; + } + if (tmp = this.styles['#' + attrs.id]) + matched += tmp + ';'; + return matched; +} +module.exports = CssHandler; + +function parser(data, init) { + this.data = data; + this.floor = 0; + this.i = 0; + this.list = []; + this.res = init; + this.state = this.Space; +} +parser.prototype.parse = function() { + for (var c; c = this.data[this.i]; this.i++) + this.state(c); + return this.res; +} +parser.prototype.section = function() { + return this.data.substring(this.start, this.i); +} +// 状态机 +parser.prototype.Space = function(c) { + if (c == '.' || c == '#' || isLetter(c)) { + this.start = this.i; + this.state = this.Name; + } else if (c == '/' && this.data[this.i + 1] == '*') + this.Comment(); + else if (!cfg.blankChar[c] && c != ';') + this.state = this.Ignore; +} +parser.prototype.Comment = function() { + this.i = this.data.indexOf('*/', this.i) + 1; + if (!this.i) this.i = this.data.length; + this.state = this.Space; +} +parser.prototype.Ignore = function(c) { + if (c == '{') this.floor++; + else if (c == '}' && !--this.floor) { + this.list = []; + this.state = this.Space; + } +} +parser.prototype.Name = function(c) { + if (cfg.blankChar[c]) { + this.list.push(this.section()); + this.state = this.NameSpace; + } else if (c == '{') { + this.list.push(this.section()); + this.Content(); + } else if (c == ',') { + this.list.push(this.section()); + this.Comma(); + } else if (!isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_') + this.state = this.Ignore; +} +parser.prototype.NameSpace = function(c) { + if (c == '{') this.Content(); + else if (c == ',') this.Comma(); + else if (!cfg.blankChar[c]) this.state = this.Ignore; +} +parser.prototype.Comma = function() { + while (cfg.blankChar[this.data[++this.i]]); + if (this.data[this.i] == '{') this.Content(); + else { + this.start = this.i--; + this.state = this.Name; + } +} +parser.prototype.Content = function() { + this.start = ++this.i; + if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length; + var content = this.section(); + for (var i = 0, item; item = this.list[i++];) + if (this.res[item]) this.res[item] += ';' + content; + else this.res[item] = content; + this.list = []; + this.state = this.Space; +} diff --git a/components/jyf-parser/libs/MpHtmlParser.js b/components/jyf-parser/libs/MpHtmlParser.js new file mode 100644 index 0000000..5ddd4c0 --- /dev/null +++ b/components/jyf-parser/libs/MpHtmlParser.js @@ -0,0 +1,580 @@ +/** + * html 解析器 + * @tutorial https://github.com/jin-yufeng/Parser + * @version 20201029 + * @author JinYufeng + * @listens MIT + */ +const cfg = require('./config.js'), + blankChar = cfg.blankChar, + CssHandler = require('./CssHandler.js'), + windowWidth = uni.getSystemInfoSync().windowWidth; +var emoji; + +function MpHtmlParser(data, options = {}) { + this.attrs = {}; + this.CssHandler = new CssHandler(options.tagStyle, windowWidth); + this.data = data; + this.domain = options.domain; + this.DOM = []; + this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0; + options.prot = (this.domain || '').includes('://') ? this.domain.split('://')[0] : 'http'; + this.options = options; + this.state = this.Text; + this.STACK = []; + // 工具函数 + this.bubble = () => { + for (var i = this.STACK.length, item; item = this.STACK[--i];) { + if (cfg.richOnlyTags[item.name]) return false; + item.c = 1; + } + return true; + } + this.decode = (val, amp) => { + var i = -1, + j, en; + while (1) { + if ((i = val.indexOf('&', i + 1)) == -1) break; + if ((j = val.indexOf(';', i + 2)) == -1) break; + if (val[i + 1] == '#') { + en = parseInt((val[i + 2] == 'x' ? '0' : '') + val.substring(i + 2, j)); + if (!isNaN(en)) val = val.substr(0, i) + String.fromCharCode(en) + val.substr(j + 1); + } else { + en = val.substring(i + 1, j); + if (cfg.entities[en] || en == amp) + val = val.substr(0, i) + (cfg.entities[en] || '&') + val.substr(j + 1); + } + } + return val; + } + this.getUrl = url => { + if (url[0] == '/') { + if (url[1] == '/') url = this.options.prot + ':' + url; + else if (this.domain) url = this.domain + url; + } else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://')) + url = this.domain + '/' + url; + return url; + } + this.isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>'); + this.section = () => this.data.substring(this.start, this.i); + this.parent = () => this.STACK[this.STACK.length - 1]; + this.siblings = () => this.STACK.length ? this.parent().children : this.DOM; +} +MpHtmlParser.prototype.parse = function() { + if (emoji) this.data = emoji.parseEmoji(this.data); + for (var c; c = this.data[this.i]; this.i++) + this.state(c); + if (this.state == this.Text) this.setText(); + while (this.STACK.length) this.popNode(this.STACK.pop()); + return this.DOM; +} +// 设置属性 +MpHtmlParser.prototype.setAttr = function() { + var name = this.attrName.toLowerCase(), + val = this.attrVal; + if (cfg.boolAttrs[name]) this.attrs[name] = 'T'; + else if (val) { + if (name == 'src' || (name == 'data-src' && !this.attrs.src)) this.attrs.src = this.getUrl(this.decode(val, 'amp')); + else if (name == 'href' || name == 'style') this.attrs[name] = this.decode(val, 'amp'); + else if (name.substr(0, 5) != 'data-') this.attrs[name] = val; + } + this.attrVal = ''; + while (blankChar[this.data[this.i]]) this.i++; + if (this.isClose()) this.setNode(); + else { + this.start = this.i; + this.state = this.AttrName; + } +} +// 设置文本节点 +MpHtmlParser.prototype.setText = function() { + var back, text = this.section(); + if (!text) return; + text = (cfg.onText && cfg.onText(text, () => back = true)) || text; + if (back) { + this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i); + let j = this.start + text.length; + for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]); + return; + } + if (!this.pre) { + // 合并空白符 + var flag, tmp = []; + for (let i = text.length, c; c = text[--i];) + if (!blankChar[c]) { + tmp.unshift(c); + if (!flag) flag = 1; + } else { + if (tmp[0] != ' ') tmp.unshift(' '); + if (c == '\n' && flag == void 0) flag = 0; + } + if (flag == 0) return; + text = tmp.join(''); + } + this.siblings().push({ + type: 'text', + text: this.decode(text) + }); +} +// 设置元素节点 +MpHtmlParser.prototype.setNode = function() { + var node = { + name: this.tagName.toLowerCase(), + attrs: this.attrs + }, + close = cfg.selfClosingTags[node.name]; + if (this.options.nodes.length) node.type = 'node'; + this.attrs = {}; + if (!cfg.ignoreTags[node.name]) { + // 处理属性 + var attrs = node.attrs, + style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''), + styleObj = {}; + if (attrs.id) { + if (this.options.compress & 1) attrs.id = void 0; + else if (this.options.useAnchor) this.bubble(); + } + if ((this.options.compress & 2) && attrs.class) attrs.class = void 0; + switch (node.name) { + case 'a': + case 'ad': // #ifdef APP-PLUS + case 'iframe': + // #endif + this.bubble(); + break; + case 'font': + if (attrs.color) { + styleObj['color'] = attrs.color; + attrs.color = void 0; + } + if (attrs.face) { + styleObj['font-family'] = attrs.face; + attrs.face = void 0; + } + if (attrs.size) { + var size = parseInt(attrs.size); + if (size < 1) size = 1; + else if (size > 7) size = 7; + var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']; + styleObj['font-size'] = map[size - 1]; + attrs.size = void 0; + } + break; + case 'embed': + // #ifndef APP-PLUS + var src = node.attrs.src || '', + type = node.attrs.type || ''; + if (type.includes('video') || src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8')) + node.name = 'video'; + else if (type.includes('audio') || src.includes('.m4a') || src.includes('.wav') || src.includes('.mp3') || src.includes( + '.aac')) + node.name = 'audio'; + else break; + if (node.attrs.autostart) + node.attrs.autoplay = 'T'; + node.attrs.controls = 'T'; + // #endif + // #ifdef APP-PLUS + this.bubble(); + break; + // #endif + case 'video': + case 'audio': + if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]); + else this[`${node.name}Num`]++; + if (node.name == 'video') { + if (this.videoNum > 3) + node.lazyLoad = 1; + if (attrs.width) { + styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px'); + attrs.width = void 0; + } + if (attrs.height) { + styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px'); + attrs.height = void 0; + } + } + if (!attrs.controls && !attrs.autoplay) attrs.controls = 'T'; + attrs.source = []; + if (attrs.src) { + attrs.source.push(attrs.src); + attrs.src = void 0; + } + this.bubble(); + break; + case 'td': + case 'th': + if (attrs.colspan || attrs.rowspan) + for (var k = this.STACK.length, item; item = this.STACK[--k];) + if (item.name == 'table') { + item.flag = 1; + break; + } + } + if (attrs.align) { + if (node.name == 'table') { + if (attrs.align == 'center') styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto'; + else styleObj['float'] = attrs.align; + } else styleObj['text-align'] = attrs.align; + attrs.align = void 0; + } + // 压缩 style + var styles = style.split(';'); + style = ''; + for (var i = 0, len = styles.length; i < len; i++) { + var info = styles[i].split(':'); + if (info.length < 2) continue; + let key = info[0].trim().toLowerCase(), + value = info.slice(1).join(':').trim(); + if (value[0] == '-' || value.includes('safe')) + style += `;${key}:${value}`; + else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) + styleObj[key] = value; + } + if (node.name == 'img') { + if (attrs.src && !attrs.ignore) { + if (this.bubble()) + attrs.i = (this.imgNum++).toString(); + else attrs.ignore = 'T'; + } + if (attrs.ignore) { + style += ';-webkit-touch-callout:none'; + styleObj['max-width'] = '100%'; + } + var width; + if (styleObj.width) width = styleObj.width; + else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : parseFloat(attrs.width) + 'px'; + if (width) { + styleObj.width = width; + attrs.width = '100%'; + if (parseInt(width) > windowWidth) { + styleObj.height = ''; + if (attrs.height) attrs.height = void 0; + } + } + if (styleObj.height) { + attrs.height = styleObj.height; + styleObj.height = ''; + } else if (attrs.height && !attrs.height.includes('%')) + attrs.height = parseFloat(attrs.height) + 'px'; + } + for (var key in styleObj) { + var value = styleObj[key]; + if (!value) continue; + if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1; + // 填充链接 + if (value.includes('url')) { + var j = value.indexOf('('); + if (j++ != -1) { + while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++; + value = value.substr(0, j) + this.getUrl(value.substr(j)); + } + } + // 转换 rpx + else if (value.includes('rpx')) + value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px'); + else if (key == 'white-space' && value.includes('pre') && !close) + this.pre = node.pre = true; + style += `;${key}:${value}`; + } + style = style.substr(1); + if (style) attrs.style = style; + if (!close) { + node.children = []; + if (node.name == 'pre' && cfg.highlight) { + this.remove(node); + this.pre = node.pre = true; + } + this.siblings().push(node); + this.STACK.push(node); + } else if (!cfg.filter || cfg.filter(node, this) != false) + this.siblings().push(node); + } else { + if (!close) this.remove(node); + else if (node.name == 'source') { + var parent = this.parent(); + if (parent && (parent.name == 'video' || parent.name == 'audio') && node.attrs.src) + parent.attrs.source.push(node.attrs.src); + } else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href; + } + if (this.data[this.i] == '/') this.i++; + this.start = this.i + 1; + this.state = this.Text; +} +// 移除标签 +MpHtmlParser.prototype.remove = function(node) { + var name = node.name, + j = this.i; + // 处理 svg + var handleSvg = () => { + var src = this.data.substring(j, this.i + 1); + node.attrs.xmlns = 'http://www.w3.org/2000/svg'; + for (var key in node.attrs) { + if (key == 'viewbox') src = ` viewBox="${node.attrs.viewbox}"` + src; + else if (key != 'style') src = ` ${key}="${node.attrs[key]}"` + src; + } + src = '', this.i)) == -1) this.i = this.data.length; + if (name == 'svg') handleSvg(); + return; + } + } +} +// 节点出栈处理 +MpHtmlParser.prototype.popNode = function(node) { + // 空白符处理 + if (node.pre) { + node.pre = this.pre = void 0; + for (let i = this.STACK.length; i--;) + if (this.STACK[i].pre) + this.pre = true; + } + var siblings = this.siblings(), + len = siblings.length, + childs = node.children; + if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false)) + return siblings.pop(); + var attrs = node.attrs; + // 替换一些标签名 + if (cfg.blockTags[node.name]) node.name = 'div'; + else if (!cfg.trustTags[node.name]) node.name = 'span'; + // 处理列表 + if (node.c && (node.name == 'ul' || node.name == 'ol')) { + if ((node.attrs.style || '').includes('list-style:none')) { + for (let i = 0, child; child = childs[i++];) + if (child.name == 'li') + child.name = 'div'; + } else if (node.name == 'ul') { + var floor = 1; + for (let i = this.STACK.length; i--;) + if (this.STACK[i].name == 'ul') floor++; + if (floor != 1) + for (let i = childs.length; i--;) + childs[i].floor = floor; + } else { + for (let i = 0, num = 1, child; child = childs[i++];) + if (child.name == 'li') { + child.type = 'ol'; + child.num = ((num, type) => { + if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26); + if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26); + if (type == 'i' || type == 'I') { + num = (num - 1) % 99 + 1; + var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'], + ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], + res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || ''); + if (type == 'i') return res.toLowerCase(); + return res; + } + return num; + })(num++, attrs.type) + '.'; + } + } + } + // 处理表格 + if (node.name == 'table') { + var padding = parseFloat(attrs.cellpadding), + spacing = parseFloat(attrs.cellspacing), + border = parseFloat(attrs.border); + if (node.c) { + if (isNaN(padding)) padding = 2; + if (isNaN(spacing)) spacing = 2; + } + if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`; + if (node.flag && node.c) { + // 有 colspan 或 rowspan 且含有链接的表格转为 grid 布局实现 + attrs.style = `${attrs.style || ''};${spacing ? `;grid-gap:${spacing}px` : ';border-left:0;border-top:0'}`; + var row = 1, + col = 1, + colNum, + trs = [], + children = [], + map = {}; + (function f(ns) { + for (var i = 0; i < ns.length; i++) { + if (ns[i].name == 'tr') trs.push(ns[i]); + else f(ns[i].children || []); + } + })(node.children) + for (let i = 0; i < trs.length; i++) { + for (let j = 0, td; td = trs[i].children[j]; j++) { + if (td.name == 'td' || td.name == 'th') { + while (map[row + '.' + col]) col++; + var cell = { + name: 'div', + c: 1, + attrs: { + style: (td.attrs.style || '') + (border ? `;border:${border}px solid gray` + (spacing ? '' : + ';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '') + }, + children: td.children + } + if (td.attrs.colspan) { + cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + parseInt(td.attrs.colspan)); + if (!td.attrs.rowspan) cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + 1); + col += parseInt(td.attrs.colspan) - 1; + } + if (td.attrs.rowspan) { + cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + parseInt(td.attrs.rowspan)); + if (!td.attrs.colspan) cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + 1); + for (var k = 1; k < td.attrs.rowspan; k++) map[(row + k) + '.' + col] = 1; + } + children.push(cell); + col++; + } + } + if (!colNum) { + colNum = col - 1; + attrs.style += `;grid-template-columns:repeat(${colNum},auto)` + } + col = 1; + row++; + } + node.children = children; + } else { + attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`; + if (border || padding) + (function f(ns) { + for (var i = 0, n; n = ns[i]; i++) { + if (n.name == 'th' || n.name == 'td') { + if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style || ''}`; + if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style || ''}`; + } else f(n.children || []); + } + })(childs) + } + if (this.options.autoscroll) { + var table = Object.assign({}, node); + node.name = 'div'; + node.attrs = { + style: 'overflow:scroll' + } + node.children = [table]; + } + } + this.CssHandler.pop && this.CssHandler.pop(node); + // 自动压缩 + if (node.name == 'div' && !Object.keys(attrs).length && childs.length == 1 && childs[0].name == 'div') + siblings[len - 1] = childs[0]; +} +// 状态机 +MpHtmlParser.prototype.Text = function(c) { + if (c == '<') { + var next = this.data[this.i + 1], + isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + if (isLetter(next)) { + this.setText(); + this.start = this.i + 1; + this.state = this.TagName; + } else if (next == '/') { + this.setText(); + if (isLetter(this.data[++this.i + 1])) { + this.start = this.i + 1; + this.state = this.EndTag; + } else this.Comment(); + } else if (next == '!' || next == '?') { + this.setText(); + this.Comment(); + } + } +} +MpHtmlParser.prototype.Comment = function() { + var key; + if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->'; + else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>'; + else key = '>'; + if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length; + else this.i += key.length - 1; + this.start = this.i + 1; + this.state = this.Text; +} +MpHtmlParser.prototype.TagName = function(c) { + if (blankChar[c]) { + this.tagName = this.section(); + while (blankChar[this.data[this.i]]) this.i++; + if (this.isClose()) this.setNode(); + else { + this.start = this.i; + this.state = this.AttrName; + } + } else if (this.isClose()) { + this.tagName = this.section(); + this.setNode(); + } +} +MpHtmlParser.prototype.AttrName = function(c) { + if (c == '=' || blankChar[c] || this.isClose()) { + this.attrName = this.section(); + if (blankChar[c]) + while (blankChar[this.data[++this.i]]); + if (this.data[this.i] == '=') { + while (blankChar[this.data[++this.i]]); + this.start = this.i--; + this.state = this.AttrValue; + } else this.setAttr(); + } +} +MpHtmlParser.prototype.AttrValue = function(c) { + if (c == '"' || c == "'") { + this.start++; + if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length; + this.attrVal = this.section(); + this.i++; + } else { + for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++); + this.attrVal = this.section(); + } + this.setAttr(); +} +MpHtmlParser.prototype.EndTag = function(c) { + if (blankChar[c] || c == '>' || c == '/') { + var name = this.section().toLowerCase(); + for (var i = this.STACK.length; i--;) + if (this.STACK[i].name == name) break; + if (i != -1) { + var node; + while ((node = this.STACK.pop()).name != name) this.popNode(node); + this.popNode(node); + } else if (name == 'p' || name == 'br') + this.siblings().push({ + name, + attrs: {} + }); + this.i = this.data.indexOf('>', this.i); + this.start = this.i + 1; + if (this.i == -1) this.i = this.data.length; + else this.state = this.Text; + } +} +module.exports = MpHtmlParser; diff --git a/components/jyf-parser/libs/config.js b/components/jyf-parser/libs/config.js new file mode 100644 index 0000000..f135a8d --- /dev/null +++ b/components/jyf-parser/libs/config.js @@ -0,0 +1,80 @@ +/* 配置文件 */ +var cfg = { + // 出错占位图 + errorImg: null, + // 过滤器函数 + filter: null, + // 代码高亮函数 + highlight: null, + // 文本处理函数 + onText: null, + // 实体编码列表 + entities: { + quot: '"', + apos: "'", + semi: ';', + nbsp: '\xA0', + ensp: '\u2002', + emsp: '\u2003', + ndash: '–', + mdash: '—', + middot: '·', + lsquo: '‘', + rsquo: '’', + ldquo: '“', + rdquo: '”', + bull: '•', + hellip: '…' + }, + blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'), + boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'), + // 块级标签,将被转为 div + blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'), + // 将被移除的标签 + ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'), + // 只能被 rich-text 显示的标签 + richOnlyTags: makeMap('a,colgroup,fieldset,legend'), + // 自闭合的标签 + selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'), + // 信任的标签 + trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'), + // 默认的标签样式 + userAgentStyles: { + address: 'font-style:italic', + big: 'display:inline;font-size:1.2em', + blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px', + caption: 'display:table-caption;text-align:center', + center: 'text-align:center', + cite: 'font-style:italic', + dd: 'margin-left:40px', + mark: 'background-color:yellow', + pre: 'font-family:monospace;white-space:pre;overflow:scroll', + s: 'text-decoration:line-through', + small: 'display:inline;font-size:0.8em', + u: 'text-decoration:underline' + } +} + +function makeMap(str) { + var map = Object.create(null), + list = str.split(','); + for (var i = list.length; i--;) + map[list[i]] = true; + return map; +} + +// #ifdef MP-WEIXIN +if (wx.canIUse('editor')) { + cfg.blockTags.pre = void 0; + cfg.ignoreTags.rp = true; + Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby')); + Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby')); +} +// #endif + +// #ifdef APP-PLUS +cfg.ignoreTags.iframe = void 0; +Object.assign(cfg.trustTags, makeMap('embed,iframe')); +// #endif + +module.exports = cfg; diff --git a/components/jyf-parser/libs/handler.wxs b/components/jyf-parser/libs/handler.wxs new file mode 100644 index 0000000..fa0d252 --- /dev/null +++ b/components/jyf-parser/libs/handler.wxs @@ -0,0 +1,22 @@ +var inline = { + abbr: 1, + b: 1, + big: 1, + code: 1, + del: 1, + em: 1, + i: 1, + ins: 1, + label: 1, + q: 1, + small: 1, + span: 1, + strong: 1, + sub: 1, + sup: 1 +} +module.exports = { + use: function(item) { + return !item.c && !inline[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1 + } +} diff --git a/components/jyf-parser/libs/trees.vue b/components/jyf-parser/libs/trees.vue new file mode 100644 index 0000000..5101cae --- /dev/null +++ b/components/jyf-parser/libs/trees.vue @@ -0,0 +1,506 @@ +