<template>
	<view style="background-color: #fff;">
		<ujp-navbar :title="newsDetail.title"></ujp-navbar>
		<view class="main">
			
			
			<view class="news-content" v-html="newsDetailValue">
				 
			</view>
		</view>
	</view>
</template>

<script>
	import * as newsApi from '@/apis/news.js'
	
	export default {
		data() {
			return {
				id: '',
				newsDetail: {
					
				},
			}
		},
		onLoad(op) {
			this.id =op.code;
			
			this.getNewsInfoDetail();
		},
		computed:{
			newsDetailValue(){
				if(process.car.branchParameter=="youdian"){
					return this.newsDetail.valueUd
				}else{
					return this.newsDetail.value
				}
				
			}
		},
		methods: {
			getNewsInfoDetail() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				
				newsApi.findConfigureByKey({
					key:this.id
				}).then((res) => {
					uni.hideLoading()					
					this.newsDetail = res.data;
					this.$nextTick(()=>{
					    var list =document.getElementsByClassName("news-content")[0].getElementsByTagName("img");
					    for(var i=0;i<list.length;i++){
					        list[i].style='width: 100%;height: 100%;'
					    }
					})
				}).catch(error => {
					uni.showToast({
						title: error,
						icon: "none"
					})
				})
			}
		}
	}	
</script>

<style lang="scss" scoped>
	.main{
		
		margin: 0px 16px ;
		padding-bottom: 34px;
		.new-title{
			color: #101010;
			font-size: 18px;
			height: 48px;
			margin: 16px 0 35px;
		}
		.time{
			display: flex;
			justify-content: space-between;
			color: #888888;
			.num{
				margin-left: 4px;
			}
			
		}
		.news-content{
			margin-top: 13px;
			font-size: 14px;
			line-height: 28px;
			color: #101010;
		}
	}
</style>