<template>
	<view class="activity">
		<image :src="banner" mode="widthFix" @click="previewImg()"></image>
	</view>
</template>

<script>
	export default {
	    data() {
	        return {
				banner:'',
				productImage:[]
	        }
	    },
		onLoad() {
			this.GetHomeLiveAdvertising()
		},
		methods:{
			GetHomeLiveAdvertising(){
				this.CommonService.GetHomeLiveAdvertising().then(response =>{
                    this.banner = response.data.liveImage
					this.productImage.push(this.banner)
				}).catch(error =>{
					this.$util.msg(error.msg,3000)
				})
			},
			previewImg (index) {//顶部商品图片预览
				let previewUrls = this.productImage
				uni.previewImage({
					current: 0, 	//图片索引
					urls: previewUrls, //必须是http图片，本地图片无效
					longPressActions:''
				})
			}
		},
		onPullDownRefresh() {
			setTimeout(() => {
				this.GetHomeLiveAdvertising()
				uni.stopPullDownRefresh()
			}, 200)
		},
		onShow() {
			
		}
	}
</script>
	
<style lang="scss">
	.activity{
		width: 100%;
		height: auto;
		image{
			width: 100%;
			height: auto;
		}
	}
</style>
