From 962764e90a4cd06b9f8a18ec8f542e689fd50131 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 16 六月 2025 12:08:21 +0800
Subject: [PATCH] 刷视频-轮播展示多商品,发布视频字段bug
---
pages/tabbar/video/video.vue | 2 +-
pages/tabbar/index/home.vue | 51 +++++++++++++++++++++++++++++----------------------
2 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index 8444073..d665256 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -82,27 +82,25 @@
<!-- 鎮寕鍟嗗搧閾炬帴灞� -->
- <view class="goods-link-warp">
+ <view class="goods-link-warp" v-if="item.goodsList.length > 0">
<view class="goods-link">
- <view class="goods-container">
- <!-- 鍟嗗搧鍥剧墖 -->
- <image class="goods-image" :src="item.goods.imageUrl" mode="aspectFill"></image>
-
- <!-- 鍟嗗搧淇℃伅 -->
- <view class="goods-info">
- <text class="goods-name">{{item.goods.name}}</text>
- <view class="price-section">
- <text class="current-price">楼{{item.goods.price}}</text>
- <text class="original-price" v-if="item.goods.originalPrice">楼{{item.goods.originalPrice}}</text>
- </view>
- <text class="sales-count">{{item.goods.saleNum}}浜哄凡璐�</text>
- </view>
-
- <!-- 璐拱鎸夐挳 -->
- <view class="buy-button">
- <text>璐拱</text>
- </view>
- </view>
+ <swiper @change="goodsChange" :autoplay="true" :interval="4000" style="height: 120rpx;">
+ <swiper-item v-for="goods in item.goodsList" :key="goods.goodsId">
+ <view class="goods-container">
+ <!-- 鍟嗗搧鍥剧墖 -->
+ <image class="goods-image" :src="goods.thumbnail" mode="aspectFill"></image>
+
+ <!-- 鍟嗗搧淇℃伅 -->
+ <view class="goods-info">
+ <text class="goods-name">{{goods.goodsName}}</text>
+ <view class="price-section">
+ <text class="current-price">楼{{goods.price}}</text>
+ <text class="original-price" v-if="goods.originalPrice">楼{{goods.originalPrice}}</text>
+ </view>
+ </view>
+ </view>
+ </swiper-item>
+ </swiper>
</view>
</view>
@@ -237,6 +235,7 @@
data() {
return {
currentImgIndex: 0, // 鎾斁鍒扮鍑犲紶鍥�--绱㈠紩
+ currentGoodsIndex: 0, // 鎾斁鍒扮鍑犱釜鍟嗗搧--绱㈠紩
currentTime: 0,
formartDuration: '',
duration: 0,
@@ -323,6 +322,10 @@
// 杞挱鍥惧彉鍖�
imgChange(e) {
this.currentImgIndex = e.detail.current;
+ },
+ // 鍟嗗搧杞挱鍥惧彉鍖�
+ goodsChange(e) {
+ this.currentGoodsIndex = e.detail.current;
},
// 鑾峰彇杩涘害鏉$殑浣嶇疆鍜屽昂瀵�
getBarRect() {
@@ -898,6 +901,7 @@
}
.goods-link {
position: relative;
+ width: 450rpx;
margin: 20rpx 0;
padding: 12rpx;
background-color: rgba(255, 255, 255, 0.9);
@@ -906,6 +910,7 @@
}
.goods-container {
+ width: 100%;
display: flex;
align-items: center;
}
@@ -928,11 +933,13 @@
font-size: 28rpx;
color: #333;
font-weight: bold;
- display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
- overflow: hidden;
margin-bottom: 8rpx;
+ width: 280rpx; /* 闇�瑕佹寚瀹氬搴� */
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
.price-section {
diff --git a/pages/tabbar/video/video.vue b/pages/tabbar/video/video.vue
index b852579..4a7c780 100644
--- a/pages/tabbar/video/video.vue
+++ b/pages/tabbar/video/video.vue
@@ -622,7 +622,7 @@
if (valid && this.canPublish) {
this.loading = true;
this.formData.fileInfo = this.videoInfo;
- this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.id, goodsNum: item.selectNum}});
+ this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsNum: item.selectNum}});
publish(this.formData).then(res => {
uni.showToast({
title: '瑙嗛宸叉彁浜ゅ鏍竳',
--
Gitblit v1.8.0