<template>
	<view class="container">
		<view class="content">
			<view class="detail">
				<view class="title">{{ info.title }}</view>
				<view class="info">
					<view class="source-date">
						<text class="source">{{ info.source }}</text>
						<text class="date hidden">{{ info.create_time }}</text>
					</view>
					<view class="read">阅读 {{ info.click }}</view>
				</view>
				<view class="desc">
					<u-parse :content="info.content" :tagStyle="style"></u-parse>
				</view>

			</view>
			<view class="float-empty"></view>
		</view>
	</view>
</template>

<script>
	import {
		noticeDetail
	} from "@/api/notice.js"

	export default {
		data() {
			return {
				id: 0,
				info: {},
				style: {
					// 字符串的形式
					p: 'font-size:32rpx;padding-bottom:20rpx',
				}
			}
		},
		onLoad(e) {
			if (e.id > 0) {
				this.id = e.id;
			}
			this.getDetails();
		},
		methods: {
			getDetails() {
				let that = this
				noticeDetail({
					id: this.id
				}).then(res => {
					that.info = res.data
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.u-content {
		padding: 24rpx;
	}

	.detail {
		padding: 40rpx 32rpx;
		background: #fff;

		.title {
			font-size: 40rpx;
			color: #262626;
			line-height: 60rpx;
			font-weight: bold;
		}

		.info {
			margin-top: 32rpx;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;

			.source-date {
				.source {
					color: #666;
				}

				.date {
					color: #999;
					margin-left: 24rpx;
				}
			}

			.read {
				color: #999;
			}
		}

		.desc {
			margin-top: 56rpx;
			overflow: hidden;
			color: #262626;

			.wxParse {
				color: #262626;
			}
		}
	}
</style>