<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><rich-text :nodes="item.contents"></rich-text></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;
				this.item.contents = res.data.data.contents.replace(/\<img/gi, '<img class="rich-img"');
			}
		});
	},
	methods: {
		//分享
		share() {}
	}
};
</script>
<style lang="scss">
page {
	background-color: white !important;
}
.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;
}
.contents {
	padding: 20px;
}
</style>
