<template>
	<view>
		<u-navbar back-text="内容详情" back-icon-size="28" back-icon-color="#ffffff"
			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
		<view class="main">
			<view class="title">
				{{newsDetail.title}}
			</view>
			<view class="date-views">
				<view class="date">
					{{newsDetail.createTime}}
				</view>
				<view class="views">
					<view class="icon">
						<img src="@/assets/img/riLine-eye-line Copy@1x.png" alt="">
					</view>
					<view class="number">
						{{newsDetail.readNum}}
					</view>
				</view>
			</view>
			<u-line  color="#e6e6e6"/>
			<view class="content news-content"  v-html="newsDetail.content" >
			
			</view>
		   
		 
		</view>
	</view>
</template>

<script>
	import * as API from '@/apis/pagejs/packages.js'
	export default {
		data() {
			return {
				id: '',
				newsDetail: {},
			}
		},
		onLoad(op) {
			
			
			this.id =op.id;
			//this.getNewsInfoDetail();
		},
		methods: {
			getNewsInfoDetail() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				
				API.newsInfoDetail(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>
	page {
		background: #F0F0F2;
		padding-bottom: 120px;
	}
</style>

<style lang="scss" scoped>
	.main{
		padding: 40rpx 32rpx;
		background-color: #fff;
		.title{
			color: rgba(16, 16, 16, 1);
			font-size: 40rpx;
			text-align: justify;
			line-height: 48rpx;
		}
		.date-views{
			margin-top: 64rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 32rpx;
			.date{
				color: rgba(119, 119, 119, 1);
				font-size: 24rpx;
			}
			.views{
				display: flex;
				align-items: center;
				color: rgba(119, 119, 119, 1);
				font-size: 12px;
				img{
					width: 32rpx;
					height: 32rpx;
					vertical-align: middle;
					margin-right: 8rpx;
				}
			}
		}
	  .content{
		  color: rgba(51, 51, 51, 1);
		  font-size: 32rpx;
		  line-height: 56rpx;
		  margin-top: 40rpx;
	  }
	.news-picture{
		margin-top: 32rpx;
		height: 310rpx;
	    overflow: hidden;
		img{
			width: 100%;
			height: 100%;
		}
	}
	.picture-title{
		color: rgba(119, 119, 119, 1);
		font-size: 24rpx;
		margin-top: 16rpx;
		text-align: center;
	}
	}

</style>
