<template>
	<view>
		<view style="padding: 10px;margin: 0 auto;">{{$dateResult(item.createTime, 'datetime')}}</view>
		<view v-if="data.type === 1" style="padding: 10px 15px 0;" v-html="data.noticeContent"></view>
		<view v-if="data.type === 2" style="padding: 10px 15px 0;" v-html="data.link"></view>
		<view style="height: 40rpx;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: uni.getStorageSync("noticeData")
			}
		},
		onShow() {
			console.log(this.data)
			if (this.data.noticeContent) {
				this.data.noticeContent = this.data.noticeContent.replace(/<img/g,
					"<img style='max-width:100%;height:auto;'");
			}
			if (this.data.link) {
				this.data.link = this.data.link.replace(/<img/g,
					"<img style='max-width:100%;height:auto;'");
			}
			if (this.data.noticeTitle) {
				uni.setNavigationBarTitle({
					title: this.data.noticeTitle
				})
			}
			if (this.data.text) {
				uni.setNavigationBarTitle({
					title: this.data.text
				})
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.product-content {
		width: 95%;
		padding: 20rpx 20rpx 0 20px;
	}

	page {
		font-size: 30rpx;
	}
</style>
