重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
Component({
|
||||
properties: {
|
||||
item: {
|
||||
type: Object,
|
||||
value: {}
|
||||
},
|
||||
showMeta: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<view class="product-card" bindtap="handleTap">
|
||||
<view class="product-cover-wrap">
|
||||
<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>
|
||||
<view class="product-body">
|
||||
<view class="product-title">{{item.displayTitle}}</view>
|
||||
<view wx:if="{{item.shopNameText}}" class="product-shop">{{item.shopNameText}}</view>
|
||||
<view wx:if="{{!showMeta && item.metaText}}" class="product-meta">{{item.metaText}}</view>
|
||||
<view wx:if="{{item.tagsPreview && item.tagsPreview.length}}" class="product-tags">
|
||||
<text wx:for="{{item.tagsPreview}}" wx:key="*this" class="tag-item">{{item}}</text>
|
||||
</view>
|
||||
<view class="product-footer">
|
||||
<view class="product-price-wrap">
|
||||
<text class="product-price">{{item.priceText}}</text>
|
||||
<text wx:if="{{showStats}}" class="product-stats">{{item.statsText}}</text>
|
||||
</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>
|
||||
@@ -0,0 +1,227 @@
|
||||
.product-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 28rpx;
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
border: 1rpx solid var(--theme-border);
|
||||
box-shadow: 0 18rpx 42rpx rgba(74, 68, 63, 0.08);
|
||||
}
|
||||
|
||||
.product-cover-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.product-cover {
|
||||
width: 100%;
|
||||
height: 288rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.product-cover-shadow {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 120rpx;
|
||||
background: linear-gradient(180deg, rgba(28, 23, 26, 0), rgba(28, 23, 26, 0.28));
|
||||
}
|
||||
|
||||
.product-meta-badge {
|
||||
position: absolute;
|
||||
left: 16rpx;
|
||||
top: 16rpx;
|
||||
max-width: calc(100% - 32rpx);
|
||||
padding: 8rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
color: var(--theme-primary-action);
|
||||
font-size: 19rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.product-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
min-height: 220rpx;
|
||||
padding: 20rpx 20rpx 22rpx;
|
||||
}
|
||||
|
||||
.product-title {
|
||||
min-height: 74rpx;
|
||||
font-size: 27rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.38;
|
||||
color: var(--text-primary);
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.product-meta {
|
||||
font-size: 22rpx;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.product-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.tag-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
max-width: 100%;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--theme-primary);
|
||||
font-size: 18rpx;
|
||||
line-height: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-footer {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 14rpx;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.product-price-wrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.product-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
display: block;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.12;
|
||||
font-weight: 800;
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.product-stats {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.4;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.product-quick-add {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 22rpx;
|
||||
background: var(--theme-gradient);
|
||||
box-shadow: 0 14rpx 30rpx rgba(232, 180, 184, 0.26);
|
||||
}
|
||||
|
||||
.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: var(--theme-primary-soft);
|
||||
color: var(--theme-accent);
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-shop {
|
||||
margin-top: 6rpx;
|
||||
color: var(--text-secondary);
|
||||
font-size: 22rpx;
|
||||
line-height: 1.45;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
Reference in New Issue
Block a user