| .. | .. |
|---|
| 90 | 90 | </view> |
|---|
| 91 | 91 | </view> |
|---|
| 92 | 92 | <view @click="goLottery" class="lottery_banner" v-if="info && info.isLottery && info.lotteryBanner"> |
|---|
| 93 | | - <image class="lottery_bannerImg" :src="info.lotteryBanner" mode="widthFix"> |
|---|
| 93 | + <image class="lottery_bannerImg" :src="info.lotteryBanner" mode="widthFix" |
|---|
| 94 | + :style="{ height: lotteryBannerHeight }"> |
|---|
| 94 | 95 | </image> |
|---|
| 95 | 96 | </view> |
|---|
| 96 | 97 | <view class="tag-img-container" v-if="info.zoneType == 7"> |
|---|
| .. | .. |
|---|
| 642 | 643 | stockEmpty: true, |
|---|
| 643 | 644 | urlOption: {}, |
|---|
| 644 | 645 | homeTop: '200', |
|---|
| 646 | + lotteryBannerHeight: '', //抽奖banner预计算高度(rpx),空字符串表示未取到,按原逻辑自适应 |
|---|
| 645 | 647 | hasNewPop: false, |
|---|
| 646 | 648 | leftCoupon: {}, |
|---|
| 647 | 649 | rightCoupon: {}, |
|---|
| .. | .. |
|---|
| 1480 | 1482 | this.$refs.popNewuserRef.show() |
|---|
| 1481 | 1483 | } |
|---|
| 1482 | 1484 | }, |
|---|
| 1485 | + // 预取抽奖banner真实宽高,计算出高度后再渲染,避免加载前被组件默认高度(225px)撑大 |
|---|
| 1486 | + setLotteryBannerSize(info) { |
|---|
| 1487 | + let that = this |
|---|
| 1488 | + that.lotteryBannerHeight = '' |
|---|
| 1489 | + if (!info || !info.isLottery || !info.lotteryBanner) return |
|---|
| 1490 | + uni.getImageInfo({ |
|---|
| 1491 | + src: info.lotteryBanner, |
|---|
| 1492 | + success: (img) => { |
|---|
| 1493 | + if (img.width > 0 && img.height > 0) { |
|---|
| 1494 | + that.lotteryBannerHeight = (690 * img.height / img.width).toFixed(2) + 'rpx' |
|---|
| 1495 | + } |
|---|
| 1496 | + }, |
|---|
| 1497 | + fail: () => { } |
|---|
| 1498 | + }) |
|---|
| 1499 | + }, |
|---|
| 1483 | 1500 | getZoneDetail: function () { |
|---|
| 1484 | 1501 | let that = this; |
|---|
| 1485 | 1502 | let belong = this.$store.getters.belong; |
|---|
| .. | .. |
|---|
| 1487 | 1504 | console.log('专区详情入参::', params) |
|---|
| 1488 | 1505 | getZoneDetail(that.id, params).then(res => { |
|---|
| 1489 | 1506 | that.info = res.data; |
|---|
| 1490 | | - //that.info.zoneType=8; |
|---|
| 1507 | + that.setLotteryBannerSize(res.data); |
|---|
| 1491 | 1508 | that.updateZoneShareMenu(); |
|---|
| 1492 | 1509 | if (res.data.zoneType == 6) { |
|---|
| 1493 | 1510 | that.setYueyangZone() |
|---|