<template>
	<view class="zcbox">
		<view class="flex1 zctop">
			<view class="tit">皖源融资担保有限公司担保材料清单</view>
			 <rich-text :nodes="content"></rich-text>
		</view>
		<!-- <view class="flex0 zcfbtns">
			<view class="rzbtn" @click="getDownFn">一键下载模板</view>
		</view> -->
	</view>
</template>

<script>
	import {getDocumentList} from "@/api/mine/work.js"
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import config from '@/config'
	const baseUrlimg=config.baseUrl
	export default{
		components:{},
		data(){
			return{
				content:"",
			}
		},
		onLoad() {
			this.getDocumentList()
		},
		methods:{
			checkPermi, checkRole,
			getDownFn(){
				
			},
			getDocumentList(){
				var params={
					explainType:1
				}
				getDocumentList(params).then(res=>{
					if(res.code==200){
						var list=res.rows;
						if(list&&list.length){
							var content=list[0].explainContent;
							// this.content=content;
							this.content=this.formatRichText(content);
						}
					}
				})
			},
			//解析富文本方法
			formatRichText(html) {
					let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
						match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '').replace(/style=""/gi, '');
						match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
						match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
						return match;
					});
					newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
						match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
						return match;
					});
					newContent = newContent.replace(/<br[^>]*\/>/gi, '');
					newContent = newContent.replace(/\<img src="/gi,
						'<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;" src="' +baseUrlimg);
					return newContent;
			},
		}
	}
</script>
<style>
	page{background:#ffffff;}
</style>
<style lang="scss" scoped>
.zcbox{
	display: flex;flex-direction: column;height: 100vh;
	.zctop{
		overflow: auto;padding: 52rpx 36rpx 0;
		.tit{
			font-size: 30rpx;color: #222327;font-weight: bold;text-align: center;margin-bottom: 24rpx;
		}
	}
	.zcfbtns{padding:40rpx 36rpx 60rpx;}
}
</style>