<template>
	<view :class="[AppTheme]" class="transmit">
		<view class="pop">
			<view class="video_blck">
				<yfsVideo ref="yvideo" :src="videoSrc"></yfsVideo>
			</view>
		</view>
		<view :class="hasptz==1?'detail-desc':'detail-desc1'" v-if="content">
			<view class="d-header"><text>图文详情</text></view>
			<u-parse :content="content" :lazy-load="true" :show-with-animation="true">
			</u-parse>
		</view>
		<admyself :opshow="true"></admyself>
	</view>
</template>
<script>
	import Api from '@/api/broadcast/index.js';
	import yfsVideo from '@/components/yfs-video/yfs-video.vue';
	export default {
		data() {
			return {
				primary: this.$theme.primary,
				videoSrc: '',
				title: '',
				content: '',
				settingFile: getApp().globalData.siteinfo,
				hasptz:0
			};
		},
		components: {
			yfsVideo
		},
		onLoad(options) {
			let that = this;
			Api.getvideo({
				id: options.id
			}).then(res => {
				if (res.status == 200) {
					console.log(res.data)
					that.videoSrc = res.data.src;
					/* 处理富文本*/
					if (res.data.content) {
						that.content = res.data.content.replace(/\<img src="/gi,
							`<img style='width:100%;display:block' src="${that.settingFile.root_rich_img}`);
					}
				    that.hasptz=res.data.hasptz;
					that.$refs.yvideo.playvideo(that.videoSrc,res.data.device_id,res.data.hasptz);
					uni.setNavigationBarTitle({
						title: res.data.title,
						success: () => {
							console.log("修改标题成功")
						},
						fail: () => {
							console.log("修改标题失败")
						},
						complete: () => {
							console.log("修改标题结束")
						},
					})
					that.title = res.data.title;
				} else {
					that.$api.msg(res.msg);
					setTimeout(() => {
						uni.navigateBack({})
					}, 1000)
				}
			});
		},
		methods: {

		},
	};
</script>
<style lang="scss">
	page {
		width: 100%;
		height: 100%;
		background-color: #FFFFFF;
	}

	/*  详情 */
	.detail-desc {
		background-color: #FFFFFF;
		margin-top: 450rpx;
		line-height: 40rpx;
		padding: 0 20rpx 50rpx 20rpx;
		box-sizing: border-box;

		.d-header {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 80upx;
			font-size: $font-base + 2upx;
			position: relative;

			text {
				padding: 0 20upx;
				background: #fff;
				position: relative;
				z-index: 1;
			}

			&:after {
				position: absolute;
				left: 50%;
				top: 50%;
				transform: translateX(-50%);
				width: 300upx;
				height: 0;
				content: '';
				border-bottom: 1px solid #ccc;
			}
		}
	}

	.detail-desc1 {
		background-color: #FFFFFF;
		margin-top: 20rpx;
		line-height: 40rpx;
		padding: 0 20rpx 50rpx 20rpx;
		box-sizing: border-box;

		.d-header {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 80upx;
			font-size: $font-base + 2upx;
			position: relative;

			text {
				padding: 0 20upx;
				background: #fff;
				position: relative;
				z-index: 1;
			}

			&:after {
				position: absolute;
				left: 50%;
				top: 50%;
				transform: translateX(-50%);
				width: 300upx;
				height: 0;
				content: '';
				border-bottom: 1px solid #ccc;
			}
		}
	}

	.transmit {
		width: 100%;
		height: 100%;

		.pop {
			top: 0;
			left: 0;
			width: 100%;

			.video_blck {
				width: 100%;
				height: 100%;
				justify-content: cener;
				align-items: center;
			}
		}

		.left_img {
			position: absolute;
			top: 80rpx;
			left: 25rpx;
			z-index: 9;

			image {
				width: 25rpx;
				height: 30rpx;
			}
		}
	}
</style>
