<template>
	<view class="cmain">
		<view class="title">{{ item.title }}</view>
		<view class="desc">
			<view>{{ item.source }}<text  class="source" style="margin-left: 10px;" v-if="item.url" @click="toSource(item.url)">原文连接</text></view>
			<view>{{ item.createTime.substring(0,16) }}</view>
			<!-- <view class="read">
				<text class="icon">&#xe639;</text>
				<text>{{ item.readCount }}</text>
			</view> -->
		</view>
		<u-divider :dot="true"></u-divider>
		<view v-html="item.content"></view>
		<!-- <u-parse :content="item.content"></u-parse> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: {createTime:''}
			};
		},
		onLoad(e) {
			if (e.id) {
				this.http.request({
					url: '/level-one-server/app/TbPortNews/getById?id=' + e.id,
					success: res => {
						this.item = res.data.data;
						this.item.content = this.item.content.replace(/\<img/gi,
							'<img style="border-radius: 5px;"');
					}
				});
			}
		},
		methods: {
			toSource(url) {
				// #ifdef APP-PLUS
				plus.runtime.openURL(url) //这里默认使用外部浏览器打开而不是内部web-view组件打开
				// #endif
				// #ifdef H5
				window.open(url)
				// #endif
			}
		}
	};
</script>

<style lang="scss">
	.cmain {
		padding: 20px 16px 15px 16px;

		.title {
			font-weight: bold;
			color: #192b20;
			line-height: 32px;
			font-size: 22px;
		}

		.desc {
			margin-top: 10px;
			overflow: hidden;
			color: #a0a2a6;

			text {
				// float: left;
			}

			.source {
				color: #0081ff;
				margin-right: 10px;
			}

			margin-right: 10px;

			.read {
				float: right;
				margin-top: -2px;

				.icon {
					padding-right: 3px;
					float: left;
					margin-top: 2px;
				}
			}
		}
	}
</style>