功能:收口小程序前后台安全与防重复提交

This commit is contained in:
xiaowang
2026-04-20 16:02:57 +08:00
parent eb1c209d79
commit a3df262fae
237 changed files with 14068 additions and 728 deletions
@@ -11,12 +11,24 @@ Component({
showStats: {
type: Boolean,
value: false
},
showQuickAdd: {
type: Boolean,
value: false
},
inCart: {
type: Boolean,
value: false
}
},
methods: {
handleTap() {
this.triggerEvent('select', this.properties.item)
},
handleQuickAdd() {
this.triggerEvent('quickadd', this.properties.item)
}
}
})
@@ -1,6 +1,6 @@
<view class="product-card" bindtap="handleTap">
<view class="product-cover-wrap">
<image class="product-cover" src="{{item.coverUrl}}" mode="aspectFill"></image>
<image class="product-cover" src="{{item.coverUrl}}" mode="aspectFill" lazy-load="{{true}}"></image>
<view class="product-cover-shadow"></view>
<view wx:if="{{showMeta && item.metaText}}" class="product-meta-badge">{{item.metaText}}</view>
</view>
@@ -15,7 +15,19 @@
<text class="product-price">{{item.priceText}}</text>
<text wx:if="{{showStats}}" class="product-stats">{{item.statsText}}</text>
</view>
<view class="product-arrow">查看</view>
<view wx:if="{{showQuickAdd}}" class="product-actions">
<view wx:if="{{!inCart}}" class="product-quick-add" catchtap="handleQuickAdd">
<view class="product-quick-add-icon">
<view class="product-quick-add-handle"></view>
<view class="product-quick-add-basket"></view>
<view class="product-quick-add-wheel product-quick-add-wheel--left"></view>
<view class="product-quick-add-wheel product-quick-add-wheel--right"></view>
<view class="product-quick-add-plus product-quick-add-plus--horizontal"></view>
<view class="product-quick-add-plus product-quick-add-plus--vertical"></view>
</view>
</view>
<view wx:else class="product-in-cart">购物车已有</view>
</view>
</view>
</view>
</view>
@@ -1,8 +1,9 @@
.product-card {
display: flex;
flex-direction: column;
min-width: 0;
overflow: hidden;
border-radius: 30rpx;
border-radius: 28rpx;
background: #ffffff;
border: 1rpx solid rgba(239, 216, 224, 0.84);
box-shadow: 0 18rpx 42rpx rgba(122, 67, 88, 0.08);
@@ -14,7 +15,7 @@
.product-cover {
width: 100%;
height: 300rpx;
height: 288rpx;
background: #f7ecf0;
}
@@ -29,60 +30,72 @@
.product-meta-badge {
position: absolute;
left: 18rpx;
top: 18rpx;
max-width: calc(100% - 36rpx);
padding: 10rpx 16rpx;
left: 16rpx;
top: 16rpx;
max-width: calc(100% - 32rpx);
padding: 8rpx 14rpx;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.92);
color: #7a5262;
font-size: 20rpx;
font-size: 19rpx;
font-weight: 700;
}
.product-body {
display: flex;
flex-direction: column;
gap: 12rpx;
padding: 22rpx 22rpx 24rpx;
gap: 10rpx;
min-height: 220rpx;
padding: 20rpx 20rpx 22rpx;
}
.product-title {
font-size: 28rpx;
min-height: 74rpx;
font-size: 27rpx;
font-weight: 700;
line-height: 1.5;
line-height: 1.38;
color: #2d2430;
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.product-meta {
font-size: 24rpx;
font-size: 22rpx;
color: #8d7a84;
line-height: 1.5;
line-height: 1.4;
}
.product-tags {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
gap: 8rpx;
}
.tag-item {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8rpx 16rpx;
max-width: 100%;
padding: 6rpx 14rpx;
border-radius: 999rpx;
background: #fbecf1;
color: #c6597d;
font-size: 20rpx;
font-size: 18rpx;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.product-footer {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16rpx;
margin-top: 4rpx;
gap: 14rpx;
margin-top: auto;
}
.product-price-wrap {
@@ -90,30 +103,115 @@
min-width: 0;
}
.product-actions {
display: flex;
align-items: center;
flex-shrink: 0;
}
.product-price {
display: block;
font-size: 30rpx;
font-weight: 700;
font-size: 34rpx;
line-height: 1.12;
font-weight: 800;
color: #d5536f;
}
.product-stats {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
margin-top: 6rpx;
font-size: 20rpx;
line-height: 1.4;
color: #9d8a92;
}
.product-arrow {
.product-quick-add {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 96rpx;
height: 52rpx;
width: 64rpx;
height: 64rpx;
border-radius: 22rpx;
background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%);
box-shadow: 0 14rpx 30rpx rgba(198, 89, 125, 0.22);
}
.product-quick-add-icon {
position: relative;
width: 32rpx;
height: 28rpx;
}
.product-quick-add-handle {
position: absolute;
left: 2rpx;
top: 2rpx;
width: 12rpx;
height: 4rpx;
border-radius: 999rpx;
background: #ffffff;
transform: rotate(20deg);
transform-origin: left center;
}
.product-quick-add-basket {
position: absolute;
left: 6rpx;
top: 8rpx;
width: 18rpx;
height: 11rpx;
border: 3rpx solid #ffffff;
border-top: 0;
border-radius: 0 0 6rpx 6rpx;
}
.product-quick-add-wheel {
position: absolute;
top: 22rpx;
width: 6rpx;
height: 6rpx;
border-radius: 50%;
background: #ffffff;
}
.product-quick-add-wheel--left {
left: 10rpx;
}
.product-quick-add-wheel--right {
left: 22rpx;
}
.product-quick-add-plus {
position: absolute;
border-radius: 999rpx;
background: #ffffff;
}
.product-quick-add-plus--horizontal {
top: 2rpx;
right: 0;
width: 10rpx;
height: 3rpx;
}
.product-quick-add-plus--vertical {
top: -1rpx;
right: 4rpx;
width: 3rpx;
height: 10rpx;
}
.product-in-cart {
display: inline-flex;
align-items: center;
justify-content: center;
height: 56rpx;
padding: 0 18rpx;
border-radius: 999rpx;
background: #fff1f5;
color: #c6597d;
font-size: 22rpx;
background: #f8eef1;
color: #8f6e7a;
font-size: 20rpx;
font-weight: 700;
white-space: nowrap;
}