diff --git a/pages/other_package/productInfo/productInfo.vue b/pages/other_package/productInfo/productInfo.vue index 47bfe08..09fb744 100644 --- a/pages/other_package/productInfo/productInfo.vue +++ b/pages/other_package/productInfo/productInfo.vue @@ -2,15 +2,16 @@ - + + @change="(e) => (currentNum = e.current)" :height="swiperHeight + 'rpx'" img-mode="widthFix"> + @@ -399,6 +400,7 @@ export default { tuiList: ["破损", "污渍", "划痕", "标签", "其他"], swiperList: [], currentNum: 0, + swiperHeight: 800, specificationShow: false, specificationShowType: "", // 弹框类型 orderInfo: {}, @@ -518,6 +520,19 @@ export default { } return `${Math.floor(num / 10000)}万+`; }, + async calcSwiperHeight() { + if (!this.swiperList || this.swiperList.length === 0) return; + try { + const imgUrl = this.swiperList[0]; + const res = await uni.getImageInfo({ + src: imgUrl + }); + const ratio = res.height / res.width; + this.swiperHeight = Math.round(750 * ratio); + } catch (e) { + console.error('calcSwiperHeight error:', e); + } + }, onOpenApp() { //https://download.tbmall.xin/1002/apppacket/20251113/20251113183449483.apk @@ -923,6 +938,7 @@ export default { // 商品图 if (data.goodsGraph) { this.swiperList = data.goodsGraph.split(","); + this.calcSwiperHeight(); } data.addressObj = {}; // 收件人地址 data.quantity = 1; // 数量 @@ -981,6 +997,7 @@ export default { currentThumb = domain + "/static/upload/" + objData.thumb; } this.swiperList = [currentThumb]; // 封面图 + this.calcSwiperHeight(); this.orderInfo = orderInfo; } }, @@ -1338,20 +1355,18 @@ export default { position: relative; .product_info_header_swiper { - height: 800rpx !important; - .u-swiper { - height: 800rpx !important; + height: 100% !important; } ::v-deep(.u-swiper__wrapper) { - height: 800rpx !important; + height: 100% !important; .u-swiper__wrapper { - height: 800rpx !important; + height: 100% !important; .u-swiper__wrapper__item__wrapper__image { - height: 800rpx !important; + height: 100% !important; } } }