<template>
	<view>
		<u-sticky v-if="info.video_url" bgColor="#fff">
			<zxVideo :url="info.video_url" :isSpeed="isSpeed" :showCasting="showCasting" :lockButton="lockButton">
			</zxVideo>
		</u-sticky>
		<view class="detail">
			<view v-if="info.asset_name" class="title">
				{{info.asset_name}}
			</view>
			<view v-if="info.digest" class="desc">
				{{info.digest}}
			</view>
			<view v-if="info.content" class="parse">
				<u-parse :content="info.content"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import zxVideo from '@/components/zx-video/zx-video.vue';
	import {
		assetInfo
	} from '@/api/train.js'
	export default {
		components: {
			zxVideo
		},
		data() {
			return {
				urls: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
				//是否打开倍速功能
				isSpeed: true,
				//是否显示投屏按钮
				showCasting: true,
				//是否显示锁屏按钮
				lockButton: true,

				assets_id: '',
				info: {}
			}
		},
		onLoad(option) {
			this.assets_id = option.assets_id
			this.getAssetInfo()
		},
		onShow() {},
		methods: {
			getAssetInfo() {
				uni.showLoading({
					title: '加载中...'
				})
				assetInfo({
					id: this.assets_id
				}).then(res => {
					uni.hideLoading()
					this.info = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.detail {
		display: flex;
		flex-direction: column;
		margin: 30rpx;
		background-color: #FFFFFF;

		.title {
			font-size: 32rpx;
			color: #000000,

		}

		.desc {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 24rpx;
			color: #595959;
			margin-top: 10rpx;
		}

		.parse {
			margin-top: 30rpx;
		}
	}
</style>