<template>
	<view style="column hb">
		<view class="detail-cont">
			<view class="title">{{item.title}}</view>
			<view class="info">
				<view class="reads">阅读数：{{item.views?item.views:''}}</view>
				<view class="time">{{item.publishTime?item.publishTime:""}}</view>
			</view>
			<view class="video"  v-if="item.videoUrl!=null">
				<video class="VerticalVideo" id="myVideo" :src="item.videoUrl" object-fit='cover'
				@error="videoErrorCallback"   controls></video>
			</view>
			<!-- 正文 -->
			<view class="full-text"  >
				<view v-html="item.content"></view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {getbeilidetail} from '@/api/doc.js'
	export default {
		data() {
			return {
				id:"",
				item:{}
			}
		},
		onLoad(option) {
			if (option.title) {
			    uni.setNavigationBarTitle({
			      title: option.title
			    });
			  }
			  this.id=option.id
		},
		mounted() {
			this.getclassification()
		},
		methods: {
			getclassification(){
				uni.showLoading({
					title: "加载中..."
				})
				const data={
					articleId:this.id
				}
				getbeilidetail(data).then(res=>{
					if(res.code==200){
						uni.hideLoading()
						this.item=res.data
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.detail-cont{
		width: calc(100% - 80rpx) ;
		flex: 1;
		padding: 40upx;
		overflow-y: auto;
		.title{
			font-size: 40upx;
			font-family: PingFang SC;
			// font-weight: bold;
			color: #222222;
			line-height: 70upx;
		}
		.info{
			display: flex;
			align-items: center;
			font-size: 24upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #999999;
			line-height: 48upx;
			margin: 23upx 0;
			.reads{
				margin-right: 30upx;
			}
		}
		.full-text{
			width: 100%;
			font-size: 36upx;
			font-family: PingFang SC;
			// font-weight: 500;
			color: #222222;
			line-height: 60upx;
		}
		.video{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			.horizontalVideo{
				height: 1200rpx;
			}
			.VerticalVideo{
				height: 400rpx;
			}
			video{
				width: 100%;
			}
		}
	}
</style>
