<template>
	<view class="container">
		<view class="">
			<view class="ft36 header-title">
				{{info.title}}
			</view>
			<view class="ft24 coh header-time">
				{{info.create_time}} 			
				{{info.click}}次阅读
			</view>
		</view>
		
		<view class="pd10rpx">
			<rich-text :nodes="nodes" style="font-size: 14px;"></rich-text>
		</view>
		
		<view class="video" v-if="tabType==2">
			<video :src="video_url" controls></video>
		</view>
		
	</view>
</template>

<script>
	export default {
	     data() {
	     	return {
	     		nodes:"",
				info:{},
				video_url:"",
				tabType:1,
	     	}
	     },
	     onLoad(e) {
				console.log(e,"e")
				this.tabType=e.tabType;
				let url=e.tabType==1?"Content/jcdetail":"Content/vddetail";
			    wx.setNavigationBarTitle({
			      title:e.tabType==1?'教程详情':'视频详情',
			      success: (res) => {},
			      fail: (res) => {},
			      complete: (res) => {},
			    })
				 this.request({
				   	url,
					data: {
						id: e.id,
					},
				   }).then(res => {
					   console.log(res,"res")
				    if (res.code === '200') {
						 if(e.tabType==1){
							 this.info=res.data;
							 this.nodes = res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');		  
						 }else{
							 this.info=res.data;
							 this.nodes = res.data.desc.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
							 this.video_url = res.data.video_url;
						 }
				   } 
			     });
	     },		
		 
	     onShareAppMessage(e) {
	
	     },
	     methods: {

	     }
	}
</script>

<style>
	page{
		width: 100%;
		height: 100%;
	}
	.container{
		padding: 0 40rpx;
		width: 100%;
		height: 100%;
	}
	.pd10rpx{
		padding: 0 10px;
	}
	.header-title{
		margin-bottom: 16rpx;
	}
	.header-time{
		margin-bottom: 20rpx;
	}
	
	.video{
		width: 100%;
	}
	.video video{
		width: 100%;
	}
</style>
