<template>
	<view class="adv-item" @click.stop="openVideo(item.vod_id)">
		<view class="adv-image" @click="openApp(adv.adv_link)">
			<!-- <vod-image :src="adv.adv_image"  /> -->
			<image :src="adv.adv_image" mode="widthFix" @load="handleImageLoad"></image>
		</view>
		<view class="" :style="{ height: newHeight + 'rpx' }"></view>
	</view>
</template>

<script>
import vodImage from '@/components/vod-image.vue';
export default {
	props: {
		adv: {
			type: Object,
			default: {}
		}
	},
	components: {
		vodImage
	},
	data() {
		return {
			newHeight: 0
		};
	},
	mounted() {},
	methods: {
		handleImageLoad(event) {
			uni.getImageInfo({
				src: this.adv.adv_image,
				success: (res) => {
					const aspectRatio = res.width / res.height;
					const newWidth = 720;
					const newHeight = newWidth / aspectRatio;
					this.newHeight = newHeight;
				},
				fail: (error) => {}
			});
		}
	}
};
</script>

<style lang="scss">
.adv-item {
	.adv-image {
		width: 100%;
		position: absolute;
		left: 0px;
		padding: 5px 15px;
		border-radius: 8px;
		uni-image {
			width: 100%;
			padding: 5px 0;
			border-radius: 8px;
		}
	}
}
</style>
