<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.browseNumber}}
					</view>
				</view>
			</view>
			<u-line  color="#e6e6e6"/>
			<view class="content news-content"  v-html="newsDetail.content" >
			
			</view>
			
		</view>
		<view  v-if="newsDetail.codeImage" class="codeImage">
			<image  mode="aspectFit"
			
			v-if="newsDetail.codeImage" :src="newsDetail.codeImage" :show-menu-by-longpress="true" ></image>
			<view  class="codeImageView" ><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon> 长按图片<u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon></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.getNewsDetail();
		},
		methods: {
			timestart(){
					console.log("aaa1")
			},
			timeend(){
					console.log("aaa2")
			},
			saveImg(){
					console.log("aaa3")
			},
			getNewsDetail() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				
				API.newsDetail({
					id:this.id
				}).then((res) => {
					uni.hideLoading()					
					var newsDetail = res.data.newsInfo;
					if(newsDetail.content){
						var reg=new RegExp('alt','gi');
						newsDetail.content=newsDetail.content.replace(reg,'width="100%" height="100%"  /> <p')	
						
					}
					this.newsDetail=newsDetail
				}).catch(error => {
					uni.showToast({icon: 'none',
						title: error,
						icon: "none"
					})
				})
			}
		}
	}
</script>
<style>
	page {
		background: #F0F0F2;
		padding-bottom: 120px;
	}
</style>

<style lang="scss" scoped>
	.codeImage{
		background-color: #fff;
		 text-align: center;
		.codeImageView{
			padding: 20rpx 0px 40rpx;
			font-size: 32rpx;
			 
		}
		image{
			 border: 1px dashed;
			width: 600rpx;
			
		}
	}
	.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>
