<template>
	<view class="hzIndex" >
	<hzHeader title="防疫政策"></hzHeader>
	<view class="hzContent"  style="padding-top: 200upx;">
		<view v-if="item.title" style="margin: 0 20upx;border-radius: 20upx;">
			<view style="font-size: 40upx;font-weight: bold;padding:20upx;background: white;">{{item.title}}</view>
			<view v-if="item.create_time" style="font-size: 26upx;color: #666;padding: 0px 20upx;background: white;">{{'发布日期：'+formatDate(item.create_time)}}</view>
			<view class="uni-common-mt" style="background:#FFF; padding:20upx;background: white;">
				<rich-text :nodes="item.content"></rich-text>
			</view>
		</view>
		<view v-else>
			<content-none  :padTop="20"></content-none>
		</view>
	</view>
	</view>
</template>

<script>
import { travelPolicy } from '@/common/api.js';
import contentNone from '@/components/contentNone.vue';
import { callbackRequest, alertTip, compare,formatDate } from '@/common/util.js';
export default {
	components: {
		contentNone
	},
	data() {
		return {
			id:0,
			item:{},
			formatDate: formatDate,
		};
	},
	onLoad(option) {
		let id = option.id||''
		this.travelPolicy(id);
	},
	methods: {
		
		travelPolicy(id){
			let params = {
				method: travelPolicy, 
				data: {
					id:id
				} 
			};
			callbackRequest(params)
			.then(res =>{
				if (res.data.returnCode == 1) {
					if(res.data.returnData.length!=0){
						this.item = res.data.returnData[0];
						var content = this.item.content.replace(/\<img/gi,"<img style='max-width:100%'");
						content = content.replace(/	/g,"　　");
						//.replace(/\<p/gi, '<p class="p_class"')
						this.item.content = content;
						console.log(this.item)
					}
				}
				else {
					alertTip(res.data.returnMsg);
				}
			})
		},
	
	}
};
</script>
<style>
	 img{max-width:100%!important}
	 .p_class {
		 color: #666;
	  }
	  .uni-common-mt>>>.ql-align-right{
		  text-align: right;
	  }
</style>
