<template>
	<view class="content" v-if="content">
		<view class="acitve-content">
			<video autoplay :src="content" controls></video>
		</view>
		<view class="titles">{{title}}</view>
	</view>
</template>

<script>
	import { promoTerminalDetail } from '@/api/video.js'
	export default {
		data() {
			return {
				title: null,
				content: '',
				id: null
			}
		},
		onLoad(opts) {
			if(opts.form=='videoList'){
				this.title = opts.title
				this.content = opts.content
			}else{
				this.id = opts.sn
				this.getDetail()
			}
		},
		methods: {
			getDetail(){
				promoTerminalDetail({sn:this.id}).then(res => {
					this.title = res.data.name
					this.content = res.data.content
					uni.setNavigationBarTitle({
						title: res.data.name || '活动内容'
					})
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		padding: 0;
	}
	.content{
		padding: 0;
		.titles{
			text-align: center;
			padding: 20rpx;
			font-weight: bold;
		}
		.acitve-content{
			padding: 0;
			video{
				width:100%;
			}
		}
	}
</style>
