<template>
	<view class="activity">
		<web-view :webview-styles="webviewStyles" :src="activityPath"></web-view>
		<!-- 侧边 -->
		<scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
	</view>
</template>

<script>
export default {
	data() {
		return {
			webviewStyles: {
				progress: {
					color: '#FF3333'
				}
			},
			productID: '',
			activityPath: '',
			isScrollTop: false,
		}
	},
	onLoad(option) {
		this.initPageFree(option.linkId, option.link)
	},
	methods: {
		initPageFree(linkId, link) {
			this.CommonService.GetPageFree({ id: linkId })
				.then(response => {
					this.activityPath = link
					uni.setNavigationBarTitle({ title: response.data.title })
					uni.setStorageSync('pageLabel', `${response.data.contentLabel}`)
					console.log('activityPath',this.activityPath)
				})
				.catch(error => {
					console.log('获取活动专题页数据异常')
				})
		}
	},
	onPageScroll(e) {
		//实时获取到滚动的值
		if (e.scrollTop > 600) {
			this.isScrollTop = true
		} else {
			this.isScrollTop = false
		}
	}
}
</script>

<style lang="scss">
.activity {
	width: 100%;
	height: auto;
	image {
		width: 100%;
		height: auto;
	}
}
</style>
