Jacob
昨天 6a0a2c52a4ea8049909b8d7a40d0c2d098b5e74c
pages/zone/index.vue
....@@ -72,7 +72,8 @@
7272 </view>
7373 </view>
7474 <view @click="goLottery" class="lottery_banner" v-if="info && info.isLottery && info.lotteryBanner">
75
- <image class="lottery_bannerImg" :src="info.lotteryBanner" mode="widthFix">
75
+ <image class="lottery_bannerImg" :src="info.lotteryBanner" mode="widthFix"
76
+ :style="{ height: lotteryBannerHeight }">
7677 </image>
7778 </view>
7879 <view class="tag-img-container" v-if="info.zoneType == 7">
....@@ -622,6 +623,7 @@
622623 stockEmpty: true,
623624 urlOption: {},
624625 homeTop: '200',
626
+ lotteryBannerHeight: '', //抽奖banner预计算高度(rpx),空字符串表示未取到,按原逻辑自适应
625627 hasNewPop: false,
626628 leftCoupon: {},
627629 rightCoupon: {},
....@@ -1449,6 +1451,21 @@
14491451 this.$refs.popNewuserRef.show()
14501452 }
14511453 },
1454
+ // 预取抽奖banner真实宽高,计算出高度后再渲染,避免加载前被组件默认高度(225px)撑大
1455
+ setLotteryBannerSize(info) {
1456
+ let that = this
1457
+ that.lotteryBannerHeight = ''
1458
+ if (!info || !info.isLottery || !info.lotteryBanner) return
1459
+ uni.getImageInfo({
1460
+ src: info.lotteryBanner,
1461
+ success: (img) => {
1462
+ if (img.width > 0 && img.height > 0) {
1463
+ that.lotteryBannerHeight = (690 * img.height / img.width).toFixed(2) + 'rpx'
1464
+ }
1465
+ },
1466
+ fail: () => { }
1467
+ })
1468
+ },
14521469 getZoneDetail: function () {
14531470 let that = this;
14541471 let belong = this.$store.getters.belong;
....@@ -1456,6 +1473,11 @@
14561473 console.log('专区详情入参::', params)
14571474 getZoneDetail(that.id, params).then(res => {
14581475 that.info = res.data;
1476
+<<<<<<< Updated upstream
1477
+=======
1478
+ //that.info.zoneType=8;
1479
+ that.setLotteryBannerSize(res.data);
1480
+>>>>>>> Stashed changes
14591481 that.updateZoneShareMenu();
14601482 if (res.data.zoneType == 6) {
14611483 that.setYueyangZone()