<template>
	<view>
		<status-nav :navBarTitle="detailTitle" returnColor="#c2c2c2"></status-nav>
		<container-subgroup>
			<view slot="content" style="margin: 0 -30rpx;" class="fon28">
				<view class="bacf pad-zy30 pad-sx20" style="margin-top: -10rpx;">
					<!-- 标题 -->
					<view class="fon38 col0 tcenter">{{dataObj.title}}</view>
					<!-- 时间 -->
					<view class="col6 fon28 tcenter mar-sx20">{{dataObj.create_time}}</view>
					<view class="fon30 line-h60">
						<!-- 封面图 -->
						<image :src="dataObj.cover_img" mode="widthFix" style="width: 100%;"></image>
						<!-- 详情 -->
						<rich-text :nodes="rich_text"></rich-text>
					</view>
				</view>
			</view>
		</container-subgroup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailTitle:'',
				current:0,
				dataObj:{},
				rich_text:''//富文本
			}
		},
		onLoad(op) {
			this.detailTitle = `${['方案详情','详情概述','产品详情'][op.index*1]}`;
			this.current = op.index*1;
			this.getDetail(op.id);
		},
		methods: {
			// 去新产品详情
			goDetail(index){
				uni.navigateTo({
					url:'/pagesB/product-detail/product-detail'
				})
			},
			// 查看详情
			getDetail(id){
				let urls = [
					'/universal/api.solution/solution_info',
					'/universal/api.question/question_info',
				]
				this.$requst.get(urls[this.current],{id}).then(res=>{
					if(res.code==1) {
						this.dataObj = res.data;
						// 日期转换
						this.dataObj.create_time = this.$toolAll.tools.timestampToTime(this.dataObj.create_time);
						// 封面图
						this.dataObj.cover_img = uni.getStorageSync('hostapi') + '/' + this.dataObj.cover_img,
						this.rich_text = this.$toolAll.tools.escape2Html(this.dataObj.content);
					}
				})
			}
		}
	}
</script>

<style>

</style>
