<template>
	<AppLayout :show-bg-image="false">
		<view class="main-list" >
		    <view class="title">
		      {{ dataInfo.title }}
			</view>
			<view class="publishTime">
			  发布日期：{{ dataInfo.publishTime }}
			</view>
		    <view >
		      <view class="gk-l-i-bottom" v-html="dataInfo.content"></view>
		    </view>
		</view>
	</AppLayout>
</template>

<script setup>
import { inject, ref, reactive, onMounted } from "vue";
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, navTo, navBack, vacanciesTo } = inject("globalFunction");
import config from "@/config.js";
import AppLayout from "@/components/AppLayout/AppLayout.vue";
const baseUrl = config.imgBaseUrl;
const dataInfo = ref([]);
const id = ref('');
const getBackgroundStyle = (imageName) => ({
  backgroundImage: `url(${baseUrl}/${imageName})`,
  backgroundSize: "cover", // 覆盖整个容器
  backgroundPosition: "center", // 居中
  backgroundRepeat: "no-repeat",
});
onLoad((options) => {
	id.value=options.id
	getData();
});

function getData() {

	let params={
		id:id.value
	}
	$api.myRequest('/train/public/announcement/selectById', params).then((resData) => {
		if(resData.code==200){
			var td = new RegExp("<td", "g")
			var table = new RegExp('<table style="width: auto;', "g")
			resData.data.content  = (resData.data.content + "").replace(td, '<td style = "border:1px solid #cecece;font-size:0.8rem;" ')
			resData.data.content  = (resData.data.content + "").replace(table, '<table style="width: auto; border-collapse: collapse;" ')
			dataInfo.value=resData.data
		}
		
	});
}

</script>

<style lang="scss" scoped>
.main-list {
  background-color: #ffffff;
  padding: 20rpx 25rpx 28rpx 25rpx;
  margin: 30rpx 30rpx;
  box-shadow: 0px 3px 20px 0px rgba(0, 105, 234, 0.1);
  border-radius: 12px;
}
.title {
	font-size: 32rpx;
	font-weight: bold;
	color: #282828;
	margin-bottom: 16rpx;
	display: flex;
	justify-content: center;
}
.publishTime{
	text-align: center;
	font-size: 24rpx;
	color: #a2a2a2;
	margin-top: 12rpx;
	margin-bottom: 20rpx;
}
</style>