feat:优化

This commit is contained in:
2026-07-23 18:22:22 +08:00
parent df7cdce7cb
commit 6042342641
7 changed files with 85 additions and 66 deletions
@@ -3,8 +3,10 @@
<!-- <image v-if="tmpImg" :src="tmpImg" style="width:620rpx;height:960rpx"></image> -->
<!-- 头部产品描述图 -->
<view class="product_info_header_warp" :style="{ height: swiperHeight + 'rpx' }">
<up-swiper :list="swiperList" class="product_info_header_swiper" @click="onSwiper"
@change="(e) => (currentNum = e.current)" :height="swiperHeight + 'rpx'" img-mode="widthFix">
<up-swiper v-if="swiperList && swiperList.length > 0" :key="swiperHeight + '_' + swiperList.length"
:list="swiperList" class="product_info_header_swiper" @click="onSwiper"
@change="(e) => (currentNum = e.current)" :height="swiperHeight + 'rpx'">
<template #indicator>
<view class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length }}</text>
@@ -12,6 +14,8 @@
</template>
</up-swiper>
<view class="img_comm left_warp">
<up-image src="/static/common/left_b_st.png" width="30" height="30" bgColor="#f1f6ff00" v-if="!isShareUrl"
@click="jumpLeft"></up-image>
@@ -534,10 +538,13 @@ export default {
const res = await uni.getImageInfo({
src: imgUrl
});
const ratio = res.height / res.width;
this.swiperHeight = Math.round(750 * ratio);
if (res && res.width && res.height) {
const ratio = res.height / res.width;
this.swiperHeight = Math.round(750 * ratio);
}
} catch (e) {
console.error('calcSwiperHeight error:', e);
this.swiperHeight = 750;
}
},
@@ -975,9 +982,10 @@ export default {
this.isShowCart = this.activedType === 'seckill' || data.type == 3 ? 1 : 0;
// 商品图
if (data.goodsGraph) {
this.swiperList = data.goodsGraph.split(",");
this.swiperList = data.goodsGraph.split(",").map(item => item.trim()).filter(Boolean);
this.calcSwiperHeight();
}
console.log('----', data.goodsGraph, this.swiperList)
data.addressObj = {}; // 收件人地址
data.quantity = 1; // 数量
data.inventory = 0; // 库存
@@ -1382,6 +1390,12 @@ export default {
border-radius: 16rpx !important;
}
::v-deep(.u-swiper__wrapper) {
.u-swiper__wrapper__item__wrapper {
height: 100%;
}
}
.product_info_warp {
min-height: 100vh;
background-color: $app-bj;