<template>
	<view class="content" v-if="detail">
		<view class="titles">{{detail.title}}</view>
		<view class="acitve-content">
			<u-parse :html="content" :tag-style="style"></u-parse>
		</view>
	</view>
</template>

<script>
	import { promoTerminalDetail } from '@/api/video.js'
	export default {
		data() {
			return {
				detail: null,
				style: {
					p: 'margin-bottom:10px;'
				},
				promoActiveSn: null
			}
		},
		computed: {
			content() {
				return this.detail && this.detail.content 
			}
		},
		onLoad(opts) {
			this.promoActiveSn = opts.sn
			this.getDetail()
		},
		methods: {
			getDetail(){
				uni.showLoading({
					title: "正在加载..."
				})
				promoTerminalDetail({sn:this.promoActiveSn}).then(res => {
					this.detail = res.data
					uni.setNavigationBarTitle({
						title: res.data.name || '活动内容'
					})
					uni.hideLoading()
				})
			}
		}
	}
</script>

<style lang="less">
	.content{
		padding: 30rpx;
		.titles{
			text-align: center;
			padding: 20rpx 0;
			border-bottom: 1px solid #eee;
			font-weight: bold;
		}
		.acitve-content{
			padding: 20rpx 0;
		}
	}
</style>
