<template>
	<view class="page">
		<!-- 文章内容 -->
		<view class="article-data">
			<view class="article-title">
				<text>{{data.title}}</text>
			</view>
			<view class="article-content">
				<p v-html="SetContent(data.content)"></p>
			</view>
			<view class="article-img">
				<image v-for="item in data.images" :src="BASE_URL+item.url" mode="widthFix"></image>
			</view>
		</view>
		<!-- 底部 -->
		<view class="my-phone">
			<view>客服电话：654564</view>
			<view>彭州市人社局监督电话：541516</view>
			<view>备案号：6556121212</view>
		</view>
	</view>
</template>

<script>
	import BASE_URL from '@/common/config.js'
	export default {
		data() {
			return {
				BASE_URL,
				id: 0,
				data: {},
			};
		},
		onLoad(e) {
			this.id = e.id;
			console.log(this.id);
			this.GetTbpolicyById(this.id);
		},
		methods: {
			SetContent(res) {
				const regex = new RegExp('<img', 'gi');
				return res.replace(regex, '<img style="max-width:100%;height:auto" ')
			},
			GetTbpolicyById(id) {
				this.API.GetTbpolicyById(id).then(res => {
					if (res.code == 200) {
						this.data = res.data;
						this.data.images = JSON.parse(this.data.images);
					}
				})
			}
		}



	}
</script>

<style scoped lang="scss">
	@import 'ArticleDetails.scss';
</style>
