<template>
	<view>
		<!-- 空白页 -->
		<empty v-if="!article" tip='没详细内容'></empty>
		<view style="display: flex;justify-content: center;">{{title}}</view>
		<view class="tip">
			<view class="type">类型:{{type}}</view>
			<view class="addtime">发布时间:{{time}}</view>
		</view>
		<view class="main" style="background:#FFF; padding:20rpx;">
		<!-- <u-parse :content="article" @preview="preview" @navigate="navigate" ></u-parse> -->
		<rich-text :nodes="article"></rich-text>
		</view>
	</view>
</template>

<script>
	import uParse from '@/components/u-parse/u-parse.vue';
	import empty from "@/components/empty";
	export default {
		components: {
		    uParse,empty
		  },
		data() {
			return {
				adid:0,
				article: '',
				title:'',
				type:'',
				time:''
			}
		},
		onLoad(option) {
			console.log("option: " + JSON.stringify(option));
			let getadid = parseInt(option.id);
			this.adid=getadid;
			this.detaildesc(this.adid);
		},
		methods: {
			async detaildesc(adid){
				let info= await this.$api.detaildesc({action:'detaildesc',id:adid});
				this.title=info.data[0].title;
				this.time=info.data[0].create_time;
				this.type=info.data[0].type;
				this.article=info.data[0].contents.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
			},
			preview(src, e) {
			      // do something
				  console.log(src,'图片地址')
				  console.log(e,'图片e')
			    },
			    navigate(href, e) {
			      // do something
			    }
		}
	}
</script>

<style lang="scss">
	.main{
		color: #808080;
		font-size: 30rpx;
	}
	.tip{
		display: flex;
		justify-content: space-between;
		color: #808080;
		font-size: 30upx;
		margin:10upx 35upx;
	}
// @import "../../components/u-parse/u-parse.css";
</style>
