<template>
	<div class="noticeDetail">
		<div v-if="state">
			<div class="info_mes">
				<p>
					项目名称：{{projectName}}
				</p>
				<p>
					项目 项目编号：{{projectCode}}
				</p>
				<p >
					发布日期：{{detail.createTime}}
				</p>
			</div>
			<h1>{{detail.title}}</h1>
			<div v-html="detail.content"></div>
			<div class="content_list">
				<div class="flex-item">
					<div>附件下载：</div>
					<ul v-if="detail.accessoryVOList">
						<li v-for="item in detail.accessoryVOList" :key="item.id">
							<a :href="item.accessoryUrl">{{item.fileName}}</a>
						</li>
					</ul>
					<ul v-else>
						无附件
					</ul>
				</div>
			</div>
			<slot></slot>
		</div>
		<div v-else class="no-notice">
			未找到该公告详情
		</div>
	</div>
</template>

<script>
	import {
		biddingProjectId
	} from '@api/common/list'
	export default {
		data() {
			return {
				projectName: "",
				projectCode: "",
				detail: "",
				state:true
			}
		},
		methods: {
			// 获取详情
			async getbiddingProjectId() {
				let projectId = localStorage.getItem("projectId")
				const {
					data,
					code
				} = await biddingProjectId(projectId)
				if(code==200){
					this.detail = data
				}else if(code==500){
					this.state=false
				}
			},
		},
		created() {
			this.projectName = localStorage.getItem("projectName")
			this.projectCode = localStorage.getItem("projectCode")
			this.getbiddingProjectId()
		}
	}
</script>

<style scoped>
	.no-notice{
		margin-top: 30px;
		text-align: center;
		margin-bottom: 30px;
	}
	.info_mes {
		margin-bottom: 40px;
		display: flex;
		justify-content: space-between;
	}
	.noticeDetail h1 {
		text-align: center;
		margin-bottom: 30px;
	}
	.content_list{
		margin-top:30px
	}
</style>
