<template>
	<view class="schedule">
		<view v-if="industryinform">
			
			<view class='dytasl' >
				<p v-if="industryinform">{{industryinform.title}}</p>
				<p  v-if="industryinform" style="color: #BFBFBF;font-size: 26rpx;font-weight: 500;margin:10px 0;">{{industryinform.ptime}} 来源：{{industryinform.source}}</p>
				<!-- <img src="http://image.keyitest.cn/static/all/hang/7.png" alt=""> -->
				<img style="height:95vw;" v-if="industryinform.title=='美国网络安全企业向阿联酋出售iMessage漏洞利用工具'" src="https://www.keyitest.cn/prod-api/profile/article/wKgBaWFnpNSARmDiAAGvxfWHWMw450.png" alt="">
				<!-- <img v-else :src="logoimg?logoimg:'http://www.keyitest.cn/assets/dynamic/dydeau.png'" alt=""> -->
			</view>
			<view v-if="industryinform.content">
				<!-- <div class="article-body"  v-html='industryinform.content'></div>  -->
				<rich-text  class="article-body" :nodes="industryinform&&industryinform.content | filtersRichText"></rich-text>
			</view>
		</view>
		<u-divider v-else bg-color='transparent'>加载中...</u-divider>
		<view style="height:20px;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// industryinform:{ptime:'',source:'',content:'',title:''},
				industryinform:null,
				logoimg:''
			}
		},
		filters: {
			filtersRichText(html) { //控制小程序中图片大小
				if(html){
					
					let newContent = html.replace(/<img[^>]*>/gi, (match, capture)=>{
						match = match.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, (match, capture)=>{
						match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
						return match;
					});
					// let newContentsss = html.replace(/<span[^>]*>/gi, (match, capture)=>{
					// 	console.log('sss---',match, capture)
					// 	if(capture==12428 || capture==12693){
					// 		match = match.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(/<br[^>]*\/>/gi, '');
					newContent = newContent.replace(/\<img/gi,
						'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
					// newContentsss = newContentsss.replace(/\<span/gi,
					// 	'<span style="word-wrap:break-word;width:90vw;display:block;margin:10rpx auto;"');newContentsss;
					return newContent;
				}
			}
		},

		onLoad(options) {
			console.log('options--',options)
			this.logoimg=options.picWeb
			this.http.quickGet(`/news/${options.id}`).then(res=>{
				this.industryinform=res.data
				console.log('咨询详情',res.data)
				
				// this.industryinform.content=content.replace(/\<span/gi, '<span style="color:#BFBFBF" ');
			})
		},
		methods: {
			
		}
	}
</script>

<style>
	page{
		background-color: rgb(255, 255, 255)!important;
	}
    .schedule{
		width:90vw;
		margin:16px 5vw 20px 5vw;
	}
	.dytasl{
		display: flex;
		align-items: center;
		flex-direction: column;
		text-align: center;
	}
	.dytasl p{
		font-size: 34rpx;
		font-weight: bold;
		color: #1A1A1A;
	}
	.dytasl img{
		max-width:100%;
		object-fit:contain;
		/* height:34vw; */
		margin:10px auto;
	}
	.article-body{
		 line-height: 26px!important;
		/* width: 100%; */
		 /* color:rgb(17, 16, 16)!important; */
	}
	.detailsp{
		font-size:24rpx;
		color:#666666;
		line-height:43rpx;
		
		padding:5px 10px!;
	}
	.article-body p {
	            font-size: 34rpx!important;
	            color: #666666!important;
	            line-height: 35rpx!important;
				background-color:transparent!important;
	        }
	.article-body>>> span {
	            font-size: 34rpx!important;
	            color: #666666!important;
	            line-height: 35rpx!important;
				background-color:transparent!important;
	        }

</style>
