<template>
	<view class="main">
		<view class="content">
			<view class="title">{{ item.title || '' }}</view>
			<view class="desc">
				<text class="time">发布于：{{ item.createTime || '' }}</text>
				<button class="fx" open-type="share">
					<text class="icon">&#xe637;</text>
					<text>分享</text>
				</button>
			</view>
			<view class="con">
				<u-divider :dot="true"></u-divider>
				<u-parse :content="item.contents || ''"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			item: {}
		};
	},
	onLoad(e) {
		this.http.request({
			url: '/app/news/detail/' + e.id,
			success: (res) => {
				this.item = res.data.data;
				this.item.contents = res.data.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
			}
		});
	},
	methods: {},
	//分享
	onShareAppMessage: function (res) {
		return {
			title: this.item.title,
			path: '/pages/news/detail?id=' + this.item.id,
			success: (res) => {},
			fail: (res) => {}
		};
	}
};
</script>

<style lang="scss">
.main {
	padding: 0px 10px 10px 10px;
}
.content {
	padding: 15px;
	background-color: white;
	border-radius: 8px;
	.title {
		font-size: 18px;
	}
	.desc {
		padding-top: 15px;
		font-size: 13px;
		color: #7c8388;
		.time {
			padding-right: 25px;
		}
		.fx {
			background-color: white;
			float: right;
			font-size: 15px;
			margin-right: -14px;
			margin-top: -13px;
			color: $main-color;
			.icon {
				padding-right: 3px;
			}
		}
	}
	.con {
		font-size: 14px;
		line-height: 23px;
		image {
			border-radius: 5px !important;
		}
	}
}
</style>
