<template>
	<view class="page">
    <view class="noticeTitle" >{{notice.noticeTitle}}</view>
		<view class="flex-row  justify-between" style="margin-bottom: 40rpx">
      <view class="time">
        发布人：<text>{{notice.createBy}}</text>
      </view>
			<view class="time">
				<text>{{this.dateFormat(notice.createTime) }}</text>
			</view>
		</view>
		<scroll-view scroll-y="true" class="scroll-y " :style="{'height':height}">
			<view class="content-box flex-col "  :style="{'height':height}">
				<!--				<web-view  src="http://www.gzqcdj.cn/doc/2.html"></web-view>-->
				<rich-text v-html="notice.noticeContent">
				</rich-text>
			</view>
		</scroll-view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			notice: {},
			height:''
		};
	},
	onLoad(option) {
		// 判断Openid是否为空
		let sysInfo=uni.getSystemInfoSync();
		this.height= sysInfo.windowHeight -50  +'px';
		console.log("获取到的高度",this.height)
		this.getNoticeDetail(option.noticeId);

	},
	methods: {
		getNoticeDetail(id){
			let that = this;
			// 用户绑定门店
			this.$api.getNoticeDetail({noticeId:id}).then((res)=>{
				console.log('++++++++++++++++getNoticeDetail++++++++++++++++++',res)
				const regex = /<img\b[^>]*>/g;
				// const result = res.data.data.noticeContent.replace(regex, (match) => {
				//   const newMatch = match.replace(/http:/, 'https:');
				//   return newMatch.replace(/<img/, '<img class="content-img"');
				// });
				this.notice = res.data.data;
			})
		},
		// 日期格式化
		dateFormat(date){
		  let time = Date.parse(date);
		  return uni.$u.date(time, 'yyyy-mm-dd');
		},
	}
};
</script>

<style lang="scss">
	@import '/common/css/common.css';
	@import './index.rpx.css';
</style>
