create-weapp-vite 2.0.32 → 2.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/{chunk-IT75MAH3.js → chunk-MXKCD6NA.js} +2 -3
- package/dist/cli.js +1 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/templates/wevu/package.json +1 -1
- package/templates/wevu-tdesign/package.json +1 -1
- package/templates/wevu-retail/.editorconfig +0 -9
- package/templates/wevu-retail/.vscode/settings.json +0 -10
- package/templates/wevu-retail/AGENTS.md +0 -35
- package/templates/wevu-retail/README.md +0 -26
- package/templates/wevu-retail/auto-import-components.json +0 -1
- package/templates/wevu-retail/gitignore +0 -35
- package/templates/wevu-retail/package.json +0 -42
- package/templates/wevu-retail/postcss.config.js +0 -6
- package/templates/wevu-retail/project.config.json +0 -44
- package/templates/wevu-retail/project.private.config.json +0 -8
- package/templates/wevu-retail/src/app.vue +0 -104
- package/templates/wevu-retail/src/common/updateManager.ts +0 -29
- package/templates/wevu-retail/src/components/filter/index.vue +0 -134
- package/templates/wevu-retail/src/components/filter-popup/index.vue +0 -67
- package/templates/wevu-retail/src/components/goods-card/index.vue +0 -219
- package/templates/wevu-retail/src/components/goods-list/index.vue +0 -91
- package/templates/wevu-retail/src/components/load-more/index.vue +0 -99
- package/templates/wevu-retail/src/components/loading-content/index.vue +0 -48
- package/templates/wevu-retail/src/components/price/index.vue +0 -104
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +0 -143
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +0 -18
- package/templates/wevu-retail/src/components/swipeout/index.vue +0 -118
- package/templates/wevu-retail/src/components/swipeout/swipe.wxs +0 -151
- package/templates/wevu-retail/src/components/webp-image/index.vue +0 -105
- package/templates/wevu-retail/src/components/webp-image/utils.wxs +0 -140
- package/templates/wevu-retail/src/config/index.ts +0 -20437
- package/templates/wevu-retail/src/custom-tab-bar/data.ts +0 -22
- package/templates/wevu-retail/src/custom-tab-bar/index.vue +0 -62
- package/templates/wevu-retail/src/model/activities.ts +0 -7
- package/templates/wevu-retail/src/model/activity.ts +0 -18
- package/templates/wevu-retail/src/model/address.ts +0 -31
- package/templates/wevu-retail/src/model/cart.ts +0 -306
- package/templates/wevu-retail/src/model/category.ts +0 -175
- package/templates/wevu-retail/src/model/comments/queryDetail.ts +0 -50
- package/templates/wevu-retail/src/model/comments.ts +0 -298
- package/templates/wevu-retail/src/model/coupon.ts +0 -39
- package/templates/wevu-retail/src/model/detailsComments.ts +0 -30
- package/templates/wevu-retail/src/model/good.ts +0 -1904
- package/templates/wevu-retail/src/model/goods.ts +0 -7
- package/templates/wevu-retail/src/model/order/applyService.ts +0 -329
- package/templates/wevu-retail/src/model/order/orderConfirm.ts +0 -147
- package/templates/wevu-retail/src/model/order/orderDetail.ts +0 -1191
- package/templates/wevu-retail/src/model/order/orderList.ts +0 -1033
- package/templates/wevu-retail/src/model/promotion.ts +0 -20
- package/templates/wevu-retail/src/model/search.ts +0 -60
- package/templates/wevu-retail/src/model/submitComment.ts +0 -58
- package/templates/wevu-retail/src/model/swiper.ts +0 -39
- package/templates/wevu-retail/src/model/usercenter.ts +0 -52
- package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +0 -104
- package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +0 -41
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +0 -333
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +0 -5
- package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +0 -20
- package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +0 -334
- package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +0 -100
- package/templates/wevu-retail/src/pages/cart/index.vue +0 -342
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +0 -95
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +0 -73
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +0 -121
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +0 -74
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +0 -102
- package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +0 -137
- package/templates/wevu-retail/src/pages/category/index.vue +0 -50
- package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +0 -95
- package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +0 -44
- package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +0 -135
- package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +0 -94
- package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +0 -136
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +0 -65
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +0 -92
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +0 -93
- package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +0 -196
- package/templates/wevu-retail/src/pages/goods/comments/index.vue +0 -293
- package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +0 -117
- package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +0 -440
- package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +0 -83
- package/templates/wevu-retail/src/pages/goods/details/index.vue +0 -598
- package/templates/wevu-retail/src/pages/goods/list/index.vue +0 -299
- package/templates/wevu-retail/src/pages/goods/result/index.vue +0 -350
- package/templates/wevu-retail/src/pages/goods/search/index.vue +0 -196
- package/templates/wevu-retail/src/pages/home/home.vue +0 -215
- package/templates/wevu-retail/src/pages/home/readme +0 -8
- package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +0 -34
- package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +0 -430
- package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +0 -1262
- package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +0 -299
- package/templates/wevu-retail/src/pages/order/apply-service/index.vue +0 -665
- package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +0 -142
- package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +0 -75
- package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +0 -356
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +0 -17
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +0 -125
- package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +0 -262
- package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +0 -126
- package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +0 -86
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +0 -161
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +0 -25
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +0 -22
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +0 -16
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +0 -207
- package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +0 -185
- package/templates/wevu-retail/src/pages/order/config.ts +0 -94
- package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +0 -145
- package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +0 -7
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +0 -71
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +0 -267
- package/templates/wevu-retail/src/pages/order/invoice/index.vue +0 -94
- package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +0 -78
- package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +0 -11
- package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +0 -11
- package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +0 -707
- package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +0 -8
- package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +0 -115
- package/templates/wevu-retail/src/pages/order/order-detail/index.vue +0 -456
- package/templates/wevu-retail/src/pages/order/order-list/index.vue +0 -288
- package/templates/wevu-retail/src/pages/order/pay-result/index.vue +0 -77
- package/templates/wevu-retail/src/pages/order/receipt/index.vue +0 -336
- package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +0 -145
- package/templates/wevu-retail/src/pages/user/address/edit/index.vue +0 -514
- package/templates/wevu-retail/src/pages/user/address/list/index.vue +0 -249
- package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +0 -156
- package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +0 -92
- package/templates/wevu-retail/src/pages/user/name-edit/index.vue +0 -49
- package/templates/wevu-retail/src/pages/user/person-info/index.vue +0 -198
- package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +0 -33
- package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +0 -90
- package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +0 -108
- package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +0 -82
- package/templates/wevu-retail/src/pages/usercenter/index.vue +0 -301
- package/templates/wevu-retail/src/services/_utils/delay.ts +0 -3
- package/templates/wevu-retail/src/services/_utils/timeout.ts +0 -3
- package/templates/wevu-retail/src/services/activity/fetchActivity.ts +0 -20
- package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +0 -20
- package/templates/wevu-retail/src/services/address/edit.ts +0 -33
- package/templates/wevu-retail/src/services/address/fetchAddress.ts +0 -48
- package/templates/wevu-retail/src/services/address/list.ts +0 -31
- package/templates/wevu-retail/src/services/cart/cart.ts +0 -20
- package/templates/wevu-retail/src/services/comments/fetchComments.ts +0 -18
- package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +0 -18
- package/templates/wevu-retail/src/services/coupon/index.ts +0 -65
- package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +0 -20
- package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +0 -18
- package/templates/wevu-retail/src/services/good/fetchGood.ts +0 -18
- package/templates/wevu-retail/src/services/good/fetchGoods.ts +0 -29
- package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +0 -37
- package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +0 -39
- package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +0 -35
- package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +0 -38
- package/templates/wevu-retail/src/services/home/home.ts +0 -53
- package/templates/wevu-retail/src/services/order/applyService.ts +0 -70
- package/templates/wevu-retail/src/services/order/orderConfirm.ts +0 -69
- package/templates/wevu-retail/src/services/order/orderDetail.ts +0 -39
- package/templates/wevu-retail/src/services/order/orderList.ts +0 -39
- package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +0 -22
- package/templates/wevu-retail/src/services/promotion/detail.ts +0 -18
- package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +0 -28
- package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +0 -18
- package/templates/wevu-retail/src/sitemap.json +0 -7
- package/templates/wevu-retail/src/utils/addressParse.ts +0 -25
- package/templates/wevu-retail/src/utils/getPermission.ts +0 -45
- package/templates/wevu-retail/src/utils/mock.ts +0 -51
- package/templates/wevu-retail/src/utils/util.ts +0 -134
- package/templates/wevu-retail/src/vite-env.d.ts +0 -1
- package/templates/wevu-retail/tailwind.config.ts +0 -15
- package/templates/wevu-retail/tsconfig.app.json +0 -58
- package/templates/wevu-retail/tsconfig.json +0 -11
- package/templates/wevu-retail/tsconfig.node.json +0 -33
- package/templates/wevu-retail/vite.config.ts +0 -14
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
Component({
|
|
3
|
-
options: {
|
|
4
|
-
addGlobalClass: true,
|
|
5
|
-
multipleSlots: true,
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
externalClasses: ['coupon-class'],
|
|
9
|
-
|
|
10
|
-
properties: {
|
|
11
|
-
mask: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
value: false, // 是否添加遮罩
|
|
14
|
-
},
|
|
15
|
-
superposable: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
value: false, // 是否可叠加
|
|
18
|
-
},
|
|
19
|
-
type: {
|
|
20
|
-
type: String,
|
|
21
|
-
value: '', // 优惠券类型:CouponType
|
|
22
|
-
},
|
|
23
|
-
value: {
|
|
24
|
-
type: String,
|
|
25
|
-
value: '', // 优惠金额
|
|
26
|
-
},
|
|
27
|
-
tag: {
|
|
28
|
-
type: String,
|
|
29
|
-
value: '', // 优惠标签,优惠券名字标签,img
|
|
30
|
-
},
|
|
31
|
-
desc: {
|
|
32
|
-
type: String,
|
|
33
|
-
value: '', // 优惠金额描述,金额下方
|
|
34
|
-
},
|
|
35
|
-
title: {
|
|
36
|
-
type: String, // 优惠券名称
|
|
37
|
-
value: '',
|
|
38
|
-
},
|
|
39
|
-
timeLimit: {
|
|
40
|
-
type: String, // 优惠券时限
|
|
41
|
-
value: '',
|
|
42
|
-
},
|
|
43
|
-
ruleDesc: {
|
|
44
|
-
type: String, // 优惠券适用规则描述
|
|
45
|
-
value: '',
|
|
46
|
-
},
|
|
47
|
-
currency: {
|
|
48
|
-
type: String,
|
|
49
|
-
value: '¥', // 优惠货币
|
|
50
|
-
},
|
|
51
|
-
status: {
|
|
52
|
-
type: String,
|
|
53
|
-
value: 'default',
|
|
54
|
-
},
|
|
55
|
-
image: {
|
|
56
|
-
type: String,
|
|
57
|
-
value: '',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
data: {
|
|
62
|
-
CouponType: {
|
|
63
|
-
MJ_COUPON: 1,
|
|
64
|
-
ZK_COUPON: 2,
|
|
65
|
-
MJF_COUPON: 3,
|
|
66
|
-
GIFT_COUPON: 4,
|
|
67
|
-
},
|
|
68
|
-
theme: 'primary',
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
observers: {
|
|
72
|
-
status: function (value) {
|
|
73
|
-
let theme = 'primary';
|
|
74
|
-
// 已过期或已使用的券 颜色置灰
|
|
75
|
-
if (value === 'useless' || value === 'disabled') {
|
|
76
|
-
theme = 'weak';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.setData({ theme });
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
attached() {
|
|
84
|
-
this.setData({
|
|
85
|
-
color: `color${this.properties.colorStyle}`,
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<template>
|
|
92
|
-
<wxs src="./tools.wxs" module="tools"></wxs>
|
|
93
|
-
<view class="wr-coupon coupon-class theme-{{theme}} [display:flex] [background-image:url(https://tdesign.gtimg.com/miniprogram/template/retail/coupon/coupon-bg-nocorners.png)] [background-size:100%_100%] [background-repeat:no-repeat] [position:relative] [margin-bottom:24rpx] [overflow:hidden] [background-image:url('https://tdesign.gtimg.com/miniprogram/template/retail/coupon/coupon-bg-nocorners.png')]">
|
|
94
|
-
<view class="wr-coupon__left [width:200rpx] [height:180rpx] [display:flex] [flex-direction:column] [justify-content:center] [text-align:center] [color:#fa4126] [overflow:hidden] [position:relative]">
|
|
95
|
-
<view wx:if="{{type == CouponType.ZK_COUPON || type === CouponType.MERCHANT_ZK_COUPON}}">
|
|
96
|
-
<text class="wr-coupon__left--value [font-size:64rpx] [line-height:88rpx] [font-weight:bold] [font-family:\'DIN_Alternate\',_cursive] [font-family:'DIN_Alternate',_cursive]">{{value}}</text>
|
|
97
|
-
<text class="wr-coupon__left--unit [font-size:24rpx] [line-height:32rpx]">折</text>
|
|
98
|
-
<view class="wr-coupon__left--desc [font-size:24rpx] [line-height:32rpx] [color:#fa4126]">{{desc}}</view>
|
|
99
|
-
</view>
|
|
100
|
-
<view wx:if="{{type == CouponType.MJ_COUPON || type === CouponType.MERCHANT_MJ_COUPON}}">
|
|
101
|
-
<text class="wr-coupon__left--value [font-size:64rpx] [line-height:88rpx] [font-weight:bold] [font-family:\'DIN_Alternate\',_cursive] [font-family:'DIN_Alternate',_cursive]" wx:if="{{tools.isBigValue(value)}}">
|
|
102
|
-
<text class="wr-coupon__left--value-int [font-size:48rpx] [line-height:88rpx]">{{tools.getBigValues(value)[0]}}</text>
|
|
103
|
-
<text class="wr-coupon__left--value-decimal [font-size:36rpx] [line-height:48rpx]">.{{tools.getBigValues(value)[1]}}</text>
|
|
104
|
-
</text>
|
|
105
|
-
<text class="wr-coupon__left--value [font-size:64rpx] [line-height:88rpx] [font-weight:bold] [font-family:\'DIN_Alternate\',_cursive] [font-family:'DIN_Alternate',_cursive]" wx:else>{{value / 100}}</text>
|
|
106
|
-
<text class="wr-coupon__left--unit [font-size:24rpx] [line-height:32rpx]">元</text>
|
|
107
|
-
<view class="wr-coupon__left--desc [font-size:24rpx] [line-height:32rpx] [color:#fa4126]">{{desc}}</view>
|
|
108
|
-
</view>
|
|
109
|
-
<view wx:if="{{type === CouponType.MJF_COUPON || type === CouponType.MYF_COUPON}}">
|
|
110
|
-
<text class="wr-coupon__left--value [font-size:64rpx] [line-height:88rpx] [font-weight:bold] [font-family:\'DIN_Alternate\',_cursive] [font-family:'DIN_Alternate',_cursive]" style="font-family: PingFang SC; font-size: 44rpx">免邮</text>
|
|
111
|
-
<view class="wr-coupon__left--desc [font-size:24rpx] [line-height:32rpx] [color:#fa4126]">{{desc}}</view>
|
|
112
|
-
</view>
|
|
113
|
-
<view wx:if="{{type == CouponType.GIFT_COUPON}}">
|
|
114
|
-
<t-image t-class="wr-coupon__left--image [width:128rpx] [height:128rpx] [border-radius:8px] [margin-top:30rpx]" src="{{image}}" mode="aspectFill" />
|
|
115
|
-
</view>
|
|
116
|
-
</view>
|
|
117
|
-
<view class="wr-coupon__right [flex-grow:1] [padding:0_20rpx] [height:180rpx] [box-sizing:border-box] [overflow:hidden] [display:flex] [align-items:center]">
|
|
118
|
-
<view class="wr-coupon__right--title [display:flex] [-webkit-display:flex] [flex-direction:column] [align-items:flex-start] [color:#999999] [font-size:24rpx] [flex:1] [&_.coupon-title]:[max-width:320rpx] [&_.coupon-title]:[color:#333333] [&_.coupon-title]:[font-size:28rpx] [&_.coupon-title]:[line-height:40rpx] [&_.coupon-title]:[font-weight:bold] [&_.coupon-title]:[display:-webkit-box] [&_.coupon-title]:[-webkit-line-clamp:1] [&_.coupon-title]:[-webkit-box-orient:vertical] [&_.coupon-title]:[overflow:hidden] [&_.coupon-title]:[white-space:normal] [&_.coupon-time]:[margin-top:16rpx] [&_.coupon-desc]:[margin-top:8rpx] [&_.coupon-arrow]:[font-size:22rpx]">
|
|
119
|
-
<text class="coupon-title">{{title}}</text>
|
|
120
|
-
<view class="coupon-time">{{timeLimit}}</view>
|
|
121
|
-
<view class="coupon-desc">
|
|
122
|
-
<view wx:if="{{ruleDesc}}">{{ruleDesc}}</view>
|
|
123
|
-
</view>
|
|
124
|
-
</view>
|
|
125
|
-
<view class="wr-coupon__right--oper [display:flex] [justify-content:center] [align-items:center]">
|
|
126
|
-
<slot name="operator" />
|
|
127
|
-
</view>
|
|
128
|
-
</view>
|
|
129
|
-
<view wx:if="{{status === 'useless' || status === 'disabled'}}" class="wr-coupon__seal seal-{{status}}} [width:128rpx] [height:128rpx] [position:absolute] [top:0] [right:0] [background-size:100%_100%] [&_.seal-useless]:[background-image:url('https://tdesign.gtimg.com/miniprogram/template/retail/coupon/seal-used.png')] [&_.seal-disabled]:[background-image:url('https://tdesign.gtimg.com/miniprogram/template/retail/coupon/coupon-expired.png')]" />
|
|
130
|
-
<view wx:if="{{mask}}" class="wr-coupon__mask [width:702rpx] [height:182rpx] [position:absolute] [top:0] [left:0] [background-color:#ffffff] [opacity:0.5]" />
|
|
131
|
-
<view wx:if="{{superposable}}" class="wr-coupon__tag [position:absolute] [top:8px] [right:-24rpx] [text-align:center] [width:106rpx] [height:28rpx] [opacity:0.9] [font-size:20rpx] [line-height:28rpx] [color:#fa4126] [border:0.5px_solid_#fa4126] [box-sizing:border-box] [transform:rotate(45deg)]">可叠加</view>
|
|
132
|
-
</view>
|
|
133
|
-
</template>
|
|
134
|
-
|
|
135
|
-
<json>
|
|
136
|
-
{
|
|
137
|
-
"component": true,
|
|
138
|
-
"usingComponents": {
|
|
139
|
-
"t-icon": "tdesign-miniprogram/icon/icon",
|
|
140
|
-
"t-image": "/components/webp-image/index"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
</json>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function isBigValue(value) {
|
|
2
|
-
var values = (value + '').split('.');
|
|
3
|
-
if (values[1] && values[0].length >= 3) {
|
|
4
|
-
return true;
|
|
5
|
-
}
|
|
6
|
-
else {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function getBigValues(value) {
|
|
12
|
-
return value.split('.');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
isBigValue: isBigValue,
|
|
17
|
-
getBigValues: getBigValues,
|
|
18
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let ARRAY = [];
|
|
3
|
-
Component({
|
|
4
|
-
externalClasses: ['wr-class'],
|
|
5
|
-
|
|
6
|
-
options: {
|
|
7
|
-
multipleSlots: true,
|
|
8
|
-
},
|
|
9
|
-
properties: {
|
|
10
|
-
disabled: Boolean,
|
|
11
|
-
leftWidth: {
|
|
12
|
-
type: Number,
|
|
13
|
-
value: 0,
|
|
14
|
-
},
|
|
15
|
-
rightWidth: {
|
|
16
|
-
type: Number,
|
|
17
|
-
value: 0,
|
|
18
|
-
},
|
|
19
|
-
asyncClose: Boolean,
|
|
20
|
-
},
|
|
21
|
-
attached() {
|
|
22
|
-
ARRAY.push(this);
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
detached() {
|
|
26
|
-
ARRAY = ARRAY.filter((item) => item !== this);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Component initial data
|
|
31
|
-
*/
|
|
32
|
-
data: {
|
|
33
|
-
wrapperStyle: '',
|
|
34
|
-
asyncClose: false,
|
|
35
|
-
closed: true,
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Component methods
|
|
40
|
-
*/
|
|
41
|
-
methods: {
|
|
42
|
-
open(position) {
|
|
43
|
-
this.setData({ closed: false });
|
|
44
|
-
this.triggerEvent('close', {
|
|
45
|
-
position,
|
|
46
|
-
instance: this,
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
close() {
|
|
51
|
-
this.setData({ closed: true });
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
closeOther() {
|
|
55
|
-
ARRAY.filter((item) => item !== this).forEach((item) => item.close());
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
noop() {
|
|
59
|
-
return;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
onClick(event) {
|
|
63
|
-
const { key: position = 'outside' } = event.currentTarget.dataset;
|
|
64
|
-
this.triggerEvent('click', position);
|
|
65
|
-
|
|
66
|
-
if (this.data.closed) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (this.data.asyncClose) {
|
|
71
|
-
this.triggerEvent('close', {
|
|
72
|
-
position,
|
|
73
|
-
instance: this,
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
this.close();
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<template>
|
|
84
|
-
<wxs src="./swipe.wxs" module="swipe"></wxs>
|
|
85
|
-
|
|
86
|
-
<view
|
|
87
|
-
class="wr-class wr-swipeout [position:relative] [overflow:hidden]"
|
|
88
|
-
data-key="cell"
|
|
89
|
-
capture-bind:tap="onClick"
|
|
90
|
-
bindtouchstart="{{disabled || swipe.startDrag}}"
|
|
91
|
-
capture-bind:touchmove="{{disabled || swipe.onDrag}}"
|
|
92
|
-
bindtouchend="{{disabled || swipe.endDrag}}"
|
|
93
|
-
bindtouchcancel="{{disabled || swipe.endDrag}}"
|
|
94
|
-
closed="{{closed}}"
|
|
95
|
-
change:closed="{{swipe.onCloseChange}}"
|
|
96
|
-
leftWidth="{{leftWidth}}"
|
|
97
|
-
rightWidth="{{rightWidth}}"
|
|
98
|
-
change:leftWidth="{{swipe.initLeftWidth}}"
|
|
99
|
-
change:rightWidth="{{swipe.initRightWidth}}"
|
|
100
|
-
>
|
|
101
|
-
<view id="wrapper">
|
|
102
|
-
<view wx:if="{{ leftWidth }}" class="wr-swipeout__left [position:absolute] [top:0] [height:100%] [left:0] [transform:translate3d(-100%,_0,_0)]" data-key="left" catch:tap="onClick">
|
|
103
|
-
<slot name="left" />
|
|
104
|
-
</view>
|
|
105
|
-
<slot />
|
|
106
|
-
<view wx:if="{{ rightWidth }}" class="wr-swipeout__right [position:absolute] [top:0] [height:100%] [right:0] [transform:translate3d(100%,_0,_0)]" data-key="right" catch:tap="onClick">
|
|
107
|
-
<slot name="right" />
|
|
108
|
-
</view>
|
|
109
|
-
</view>
|
|
110
|
-
</view>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<json>
|
|
114
|
-
{
|
|
115
|
-
"component": true,
|
|
116
|
-
"usingComponents": {}
|
|
117
|
-
}
|
|
118
|
-
</json>
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
var THRESHOLD = 0.3;
|
|
2
|
-
var MIN_DISTANCE = 10;
|
|
3
|
-
var owner;
|
|
4
|
-
var state;
|
|
5
|
-
|
|
6
|
-
var getState = function(ownerInstance) {
|
|
7
|
-
owner = ownerInstance;
|
|
8
|
-
state = owner.getState();
|
|
9
|
-
state.leftWidth = state.leftWidth || 0;
|
|
10
|
-
state.rightWidth = state.rightWidth || 0;
|
|
11
|
-
state.offset = state.offset || 0;
|
|
12
|
-
state.startOffset = state.startOffset || 0;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var initRightWidth = function(newVal, oldVal, ownerInstance) {
|
|
16
|
-
getState(ownerInstance);
|
|
17
|
-
state.rightWidth = newVal;
|
|
18
|
-
if (state.offset < 0) {
|
|
19
|
-
swipeMove(-state.rightWidth);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var initLeftWidth = function(newVal, oldVal, ownerInstance) {
|
|
24
|
-
getState(ownerInstance);
|
|
25
|
-
state.leftWidth = newVal;
|
|
26
|
-
if (state.offset > 0) {
|
|
27
|
-
swipeMove(state.leftWidth);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var resetTouchStatus = function() {
|
|
32
|
-
state.direction = '';
|
|
33
|
-
state.deltaX = 0;
|
|
34
|
-
state.deltaY = 0;
|
|
35
|
-
state.offsetX = 0;
|
|
36
|
-
state.offsetY = 0;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var touchMove = function(event) {
|
|
40
|
-
var touchPoint = event.touches[0];
|
|
41
|
-
state.deltaX = touchPoint.clientX - state.startX;
|
|
42
|
-
state.deltaY = touchPoint.clientY - state.startY;
|
|
43
|
-
state.offsetX = Math.abs(state.deltaX);
|
|
44
|
-
state.offsetY = Math.abs(state.deltaY);
|
|
45
|
-
state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var getDirection = function(x, y) {
|
|
49
|
-
if (x > y && x > MIN_DISTANCE) {
|
|
50
|
-
return 'horizontal';
|
|
51
|
-
}
|
|
52
|
-
if (y > x && y > MIN_DISTANCE) {
|
|
53
|
-
return 'vertical';
|
|
54
|
-
}
|
|
55
|
-
return '';
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var range = function(num, min, max) {
|
|
59
|
-
return Math.min(Math.max(num, min), max);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var swipeMove = function(_offset) {
|
|
63
|
-
if (_offset == null) {
|
|
64
|
-
_offset = 0;
|
|
65
|
-
}
|
|
66
|
-
state.offset = range(
|
|
67
|
-
_offset,
|
|
68
|
-
-state.rightWidth,
|
|
69
|
-
+state.leftWidth
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
var transform = 'translate3d(' + state.offset + 'px, 0, 0)';
|
|
73
|
-
var transition = state.dragging
|
|
74
|
-
? 'none'
|
|
75
|
-
: 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)';
|
|
76
|
-
owner.selectComponent('#wrapper').setStyle({
|
|
77
|
-
'-webkit-transform': transform,
|
|
78
|
-
'-webkit-transition': transition,
|
|
79
|
-
'transform': transform,
|
|
80
|
-
'transition': transition,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
var close = function() {
|
|
85
|
-
swipeMove(0);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var onCloseChange = function(newVal, oldVal, ownerInstance) {
|
|
89
|
-
getState(ownerInstance);
|
|
90
|
-
if (newVal === oldVal) return;
|
|
91
|
-
if (newVal) {
|
|
92
|
-
close();
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
var touchStart = function(event) {
|
|
97
|
-
resetTouchStatus();
|
|
98
|
-
state.startOffset = state.offset;
|
|
99
|
-
var touchPoint = event.touches[0];
|
|
100
|
-
state.startX = touchPoint.clientX;
|
|
101
|
-
state.startY = touchPoint.clientY;
|
|
102
|
-
owner.callMethod('closeOther');
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
var startDrag = function(event, ownerInstance) {
|
|
106
|
-
getState(ownerInstance);
|
|
107
|
-
touchStart(event);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
var onDrag = function(event, ownerInstance) {
|
|
111
|
-
getState(ownerInstance);
|
|
112
|
-
touchMove(event);
|
|
113
|
-
if (state.direction !== 'horizontal') {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
state.dragging = true;
|
|
117
|
-
swipeMove(state.startOffset + state.deltaX);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
var open = function(position) {
|
|
121
|
-
var _offset = position === 'left' ? +state.leftWidth : -state.rightWidth;
|
|
122
|
-
owner.callMethod('open', { position: position });
|
|
123
|
-
swipeMove(_offset);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
var endDrag = function(event, ownerInstance) {
|
|
127
|
-
getState(ownerInstance);
|
|
128
|
-
state.dragging = false;
|
|
129
|
-
// 左/右侧有可滑动区域,且当前不是已open状态,且滑动幅度超过阈值时open左/右侧(滚动到该侧的最边上)
|
|
130
|
-
if (+state.rightWidth > 0 && -state.startOffset < +state.rightWidth && -state.offset > +state.rightWidth * THRESHOLD) {
|
|
131
|
-
open('right');
|
|
132
|
-
}
|
|
133
|
-
else if (+state.leftWidth > 0 && state.startOffset < +state.leftWidth && state.offset > +state.leftWidth * THRESHOLD) {
|
|
134
|
-
open('left');
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
// 仅在有发生侧滑的情况下自动关闭(由js控制是否异步关闭)
|
|
138
|
-
if (state.startOffset !== state.offset) {
|
|
139
|
-
close();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
module.exports = {
|
|
145
|
-
initLeftWidth: initLeftWidth,
|
|
146
|
-
initRightWidth: initRightWidth,
|
|
147
|
-
startDrag: startDrag,
|
|
148
|
-
onDrag: onDrag,
|
|
149
|
-
endDrag: endDrag,
|
|
150
|
-
onCloseChange: onCloseChange,
|
|
151
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
const systemInfo = wx.getSystemInfoSync();
|
|
3
|
-
Component({
|
|
4
|
-
externalClasses: ['t-class', 't-class-load'],
|
|
5
|
-
properties: {
|
|
6
|
-
loadFailed: {
|
|
7
|
-
type: String,
|
|
8
|
-
value: 'default',
|
|
9
|
-
},
|
|
10
|
-
loading: {
|
|
11
|
-
type: String,
|
|
12
|
-
value: 'default',
|
|
13
|
-
},
|
|
14
|
-
src: {
|
|
15
|
-
type: String,
|
|
16
|
-
value: '',
|
|
17
|
-
},
|
|
18
|
-
mode: {
|
|
19
|
-
type: String,
|
|
20
|
-
value: 'aspectFill',
|
|
21
|
-
},
|
|
22
|
-
webp: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
value: true,
|
|
25
|
-
},
|
|
26
|
-
lazyLoad: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
value: false,
|
|
29
|
-
},
|
|
30
|
-
showMenuByLongpress: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
value: false,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
data: {
|
|
36
|
-
thumbHeight: 375,
|
|
37
|
-
thumbWidth: 375,
|
|
38
|
-
systemInfo,
|
|
39
|
-
},
|
|
40
|
-
lifetimes: {
|
|
41
|
-
ready() {
|
|
42
|
-
const { mode } = this.properties;
|
|
43
|
-
// 获取容器的真实宽高,设置图片的裁剪宽度
|
|
44
|
-
this.getRect('.J-image').then((res) => {
|
|
45
|
-
if (res) {
|
|
46
|
-
const { width, height } = res;
|
|
47
|
-
this.setData(
|
|
48
|
-
mode === 'heightFix'
|
|
49
|
-
? {
|
|
50
|
-
thumbHeight: this.px2rpx(height) || 375,
|
|
51
|
-
}
|
|
52
|
-
: {
|
|
53
|
-
thumbWidth: this.px2rpx(width) || 375,
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
methods: {
|
|
61
|
-
px2rpx(px) {
|
|
62
|
-
return (750 / (systemInfo.screenWidth || 375)) * px;
|
|
63
|
-
},
|
|
64
|
-
getRect(selector) {
|
|
65
|
-
return new Promise((resolve) => {
|
|
66
|
-
if (!this.selectorQuery) {
|
|
67
|
-
this.selectorQuery = this.createSelectorQuery();
|
|
68
|
-
}
|
|
69
|
-
this.selectorQuery.select(selector).boundingClientRect(resolve).exec();
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
onLoad(e) {
|
|
73
|
-
this.triggerEvent('load', e.detail);
|
|
74
|
-
},
|
|
75
|
-
onError(e) {
|
|
76
|
-
this.triggerEvent('error', e.detail);
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<template>
|
|
83
|
-
<wxs src="./utils.wxs" module="Utils" />
|
|
84
|
-
<t-image
|
|
85
|
-
class="J-image"
|
|
86
|
-
src="{{Utils.getSrc({src, thumbWidth: thumbWidth || 0, thumbHeight: thumbHeight || 0, systemInfo, webp, mode})}}"
|
|
87
|
-
t-class="t-class"
|
|
88
|
-
t-class-load="t-class-load"
|
|
89
|
-
mode="{{ mode }}"
|
|
90
|
-
lazy="{{ lazyLoad }}"
|
|
91
|
-
show-menu-by-longpress="{{showMenuByLongpress}}"
|
|
92
|
-
error="{{loadFailed}}"
|
|
93
|
-
loading="{{loading}}"
|
|
94
|
-
binderror="onError"
|
|
95
|
-
bindload="onLoad"
|
|
96
|
-
/>
|
|
97
|
-
</template>
|
|
98
|
-
|
|
99
|
-
<json>
|
|
100
|
-
{
|
|
101
|
-
"component": true,
|
|
102
|
-
"usingComponents": {
|
|
103
|
-
"t-image": "tdesign-miniprogram/image/image"
|
|
104
|
-
}
|
|
105
|
-
}</json>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
var isString = function (value) {
|
|
2
|
-
return typeof value === 'string';
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
var isNumber = function (value) {
|
|
6
|
-
return typeof value === 'number';
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
var getFileExt = function (src) {
|
|
10
|
-
var fileUrl = src.split('?')[0];
|
|
11
|
-
var splitUlr = fileUrl.split('/');
|
|
12
|
-
var filepath = splitUlr[splitUlr.length - 1];
|
|
13
|
-
return filepath.split('.')[1] || 'jpg';
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function isUrl(url) {
|
|
17
|
-
// NOCC:ToolNameCheck(非敏感词)
|
|
18
|
-
var urlReg = getRegExp(
|
|
19
|
-
'/[(http(s)?)://(www.)?a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/',
|
|
20
|
-
'ig',
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return urlReg.test(url);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function rpx2px(rpx, screenWidth) {
|
|
27
|
-
// px / systemWidth = rpx / 750
|
|
28
|
-
var result = (rpx * (screenWidth || 375)) / 750;
|
|
29
|
-
|
|
30
|
-
return Math.round(result);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function imageMogr(url, options) {
|
|
34
|
-
if (!isString(url) || !url) return '';
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
url.indexOf('qlogo.cn') !== -1 ||
|
|
38
|
-
url.indexOf('wxfile://') === 0 ||
|
|
39
|
-
url.indexOf('http://tmp/wx') === 0 ||
|
|
40
|
-
url.indexOf('imageMogr2') !== -1
|
|
41
|
-
) {
|
|
42
|
-
//qlogo.cn域名或者本地图片不做转换
|
|
43
|
-
return url;
|
|
44
|
-
} //强制转https
|
|
45
|
-
|
|
46
|
-
if (url.indexOf('http://') === 0) {
|
|
47
|
-
url = url.replace('http://', 'https://');
|
|
48
|
-
} else if (url.indexOf('//') === 0) {
|
|
49
|
-
url = 'https:' + url;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!options) return url;
|
|
53
|
-
|
|
54
|
-
var width = Math.ceil(options.width),
|
|
55
|
-
height = Math.ceil(options.height),
|
|
56
|
-
format = options.format,
|
|
57
|
-
_optionsQuality = options.quality,
|
|
58
|
-
quality = _optionsQuality === undefined ? 70 : _optionsQuality,
|
|
59
|
-
_optionsStrip = options.strip,
|
|
60
|
-
strip = _optionsStrip === undefined ? true : _optionsStrip,
|
|
61
|
-
crop = options.crop;
|
|
62
|
-
var isValidWidth = isNumber(width) && width > 0;
|
|
63
|
-
var isValidHeight = isNumber(height) && height > 0;
|
|
64
|
-
var imageMogrStr = '';
|
|
65
|
-
var size = '';
|
|
66
|
-
|
|
67
|
-
if (isValidWidth && isValidHeight) {
|
|
68
|
-
size = ''.concat(width, 'x').concat(height);
|
|
69
|
-
} else if (isValidWidth) {
|
|
70
|
-
size = ''.concat(width, 'x');
|
|
71
|
-
} else if (isValidHeight) {
|
|
72
|
-
size = 'x'.concat(height);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (size) {
|
|
76
|
-
//缩放或者裁剪
|
|
77
|
-
imageMogrStr += '/'.concat(crop ? 'crop' : 'thumbnail', '/').concat(size);
|
|
78
|
-
|
|
79
|
-
if (crop) {
|
|
80
|
-
//裁剪目前需求只有以图片中心为基准
|
|
81
|
-
imageMogrStr += '/gravity/center';
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (isNumber(quality)) {
|
|
86
|
-
//质量变换
|
|
87
|
-
imageMogrStr += '/quality/'.concat(quality);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (strip) {
|
|
91
|
-
//去除元信息
|
|
92
|
-
imageMogrStr += '/strip';
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var ext = getFileExt(url);
|
|
96
|
-
|
|
97
|
-
// gif 图片不做格式转换,否则会损坏动图
|
|
98
|
-
if (ext === 'gif') {
|
|
99
|
-
imageMogrStr += '/cgif/1';
|
|
100
|
-
} else if (format) {
|
|
101
|
-
//格式转换
|
|
102
|
-
imageMogrStr += '/format/'.concat(format);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (format === 'jpg' || (!format && (ext === 'jpg' || ext === 'jpeg'))) {
|
|
106
|
-
//渐进式 jpg 加载
|
|
107
|
-
imageMogrStr += '/interlace/1';
|
|
108
|
-
}
|
|
109
|
-
if (!imageMogrStr) return url;
|
|
110
|
-
return ''
|
|
111
|
-
.concat(url)
|
|
112
|
-
.concat(url.indexOf('?') !== -1 ? '&' : '?', 'imageMogr2')
|
|
113
|
-
.concat(imageMogrStr);
|
|
114
|
-
}
|
|
115
|
-
function getSrc(options) {
|
|
116
|
-
if (!options.src) return '';
|
|
117
|
-
|
|
118
|
-
if (options.thumbWidth || options.thumbHeight) {
|
|
119
|
-
return imageMogr(options.src, {
|
|
120
|
-
width:
|
|
121
|
-
options.mode !== 'heightFix'
|
|
122
|
-
? rpx2px(options.thumbWidth, options.systemInfo.screenWidth) *
|
|
123
|
-
options.systemInfo.pixelRatio
|
|
124
|
-
: null,
|
|
125
|
-
height:
|
|
126
|
-
options.mode !== 'widthFix'
|
|
127
|
-
? rpx2px(options.thumbHeight, options.systemInfo.screenWidth) *
|
|
128
|
-
options.systemInfo.pixelRatio
|
|
129
|
-
: null,
|
|
130
|
-
format: options.webp ? 'webp' : null,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return '';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
module.exports = {
|
|
138
|
-
imageMogr: imageMogr,
|
|
139
|
-
getSrc: getSrc,
|
|
140
|
-
};
|