This commit is contained in:
左哥 2025-12-01 22:34:11 +08:00
parent 72284c0ba7
commit 0682240bf8

View File

@ -215,13 +215,29 @@
<view class="review-list" v-if="reviews.length">
<view class="review-item" v-for="(review, index) in reviews" :key="index">
<view class="review-header">
<view class="review-user">{{ review?.user_info?.username || review.username || '用户' + (index + 1) }}</view>
<view class="review-user-info">
<image class="review-avatar"
:src="review?.user_info?.avatar_url || review?.user_info?.avatar || review.avatar || defaultAvatar"
mode="aspectFill"></image>
<view class="review-user-text">
<view class="review-user">
{{ review?.user_info?.username || review.username || '用户' + (index +
1) }}
</view>
<view class="review-sku">
{{ review.product_info.sku_name }}
<!-- ¥{{ formatPrice(review.product_info.price) }} -->
</view>
</view>
</view>
<view class="review-rating">
<text class="iconfont icon-xingxing" v-for="n in (review.rating || 0)" :key="n"></text>
<text class="iconfont icon-xingxing" v-for="n in (review.rating || 0)"
:key="n"></text>
</view>
</view>
<view class="review-content">{{ review.comment || review.content || '商品很不错,香味持久,包装精美!' }}</view>
<view class="review-time">{{ review.created_at || review.time || '' }}</view>
<view class="review-content">{{ review.comment || review.content || '商品很不错,香味持久,包装精美!' }}
</view>
<view class="review-time">{{ review.created_at || review.time || '' }}</view>
</view>
</view>
<view class="review-empty" v-else-if="!isLoadingReviews">
@ -340,7 +356,9 @@ export default {
reviewPage: 1,
reviewPageSize: 5,
reviewsTotal: 0,
isLoadingReviews: false
isLoadingReviews: false,
//
defaultAvatar: 'https://via.placeholder.com/120x120/eeeeee/999999?text=U'
};
},
computed: {
@ -676,7 +694,7 @@ export default {
this.reviews = reset ? list : [...this.reviews, ...list];
this.reviewsTotal = total || this.reviews.length;
console.log(this.reviews)
if (list.length > 0) {
this.reviewPage += 1;
}
@ -1315,6 +1333,31 @@ export default {
color: #ffd700;
}
.review-user-info {
display: flex;
align-items: center;
max-width: 70%;
}
.review-avatar {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
margin-right: 16rpx;
background-color: #f5f5f5;
}
.review-user-text {
display: flex;
flex-direction: column;
}
.review-sku {
margin-top: 4rpx;
font-size: 24rpx;
color: #999;
}
.review-content {
font-size: 28rpx;
color: #666;