<template>
	<view class="contents">
		<view class="time">
			<text>{{ item.createTime }}</text>
			<text class="views" v-if="item.views">{{ item.views }} 人看过</text>
		</view>
		<view class="title">
			<text v-if="item.title">【{{ item.title }}】</text>
		</view>
		<view><u-parse :html="item.contents"></u-parse></view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			item: {}
		};
	},
	onLoad(e) {
		this.$http.request({
			url: this.$http.urls.news_detail + e.id,
			success: res => {
				this.item = res.data.data;
			}
		});
	},
	methods: {},
	onNavigationBarButtonTap() {
		uni.shareWithSystem({
			type: 'text',
			summary: this.item.title,
			href: 'https://www.baidu.com/',
			success() {
				console.log('分享成功');
			},
			fail() {
				console.log('分享失败');
			}
		});
	}
};
</script>
<style lang="scss">
page {
	background-color: white !important;
}
.contents {
	padding: 20px;
	.time {
		color: #818184;
		padding-bottom: 12px;
		font-size: 14px;
		.views {
			padding-left: 20px;
			float: right;
		}
	}
	.title {
		padding-top: 8px;
		font-size: 23px;
		font-weight: 400;
		margin-bottom: 20px;
	}
}
</style>
