<template>
	<view class="notice_content">
		<block v-if="showLoading">
			<view class="loading_view tc mt100">
				<icon class="weui-loading f14"></icon>
				<text class="pl10">加载中...</text>
			</view>
		</block>
		<block v-else>
			<view class="notcie_title fw8 tc">{{article.title}}</view>
			<view class="push_time f12 grey tr">{{article.create_time}}</view>
			<view class="mt10">
				<uParse :content="article.describe" noData="加载中..."></uParse>
			</view>
		</block>
	</view>
</template>
<script>
	import uParse from '@/components/gaoyia-parse/parse.vue'
	export default {
		data() {
			return {
				article: {},
				showLoading: true,
			}
		},
		components: {
			uParse
		},
		onLoad(option) {
			var id = option.id;
			if (!id) {
				uni.showToast({
					icon: 'none',
					title: '缺少必有参数',
					success() {
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 1500)
					}
				})
			}
			this.getAdetail(id);
		},
		onShareAppMessage(res) {
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: this.$config.appShareTitle
			}
		},
		methods: {
			getAdetail(id) {
				var that = this;
				that.$api.getAction(id, res => {
					if (res.code == 0) {
						that.showLoading = false;
						that.article = res.data;
						console.log(that.article)
					}
				})
			},
			//预览图片
			preview(src, e) {
				uni.previewImage({
					urls: src,
				})
			},
			navigate(href, e) {}
		}
	}
</script>

<style scoped>
	.notice_content {
		padding: 10rpx 20rpx;
	}

	@import url("@/components/u-parse/u-parse.css");

	.tc {
		text-align: center;
	}

	.mt100 {
		margin-top: 100rpx;
	}

	.fw8 {
		font-weight: 800;
	}

	.tr {
		text-align: right;
	}
</style>
