<template>
    <div class="noticeDetail">
        <div v-if="state">
            <div class="info_mes">
                <p>项目名称：{{ projectdetail.projectName }}</p>
                <p>项目编号：{{ projectdetail.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!==undefined &&detail.accessoryVOList.length>0 ">
                        <li v-for="item in detail.accessoryVOList" :key="item.id">
                            <a  target="_blank" :href="item.accessoryUrl">{{ item.fileName }}</a>
                        </li>
                    </ul>
                    <ul v-else>
                        无附件
                    </ul>
                </div>
            </div>
            <slot></slot>
        </div>
        <div v-else class="no-notice">{{msg}}</div>
    </div>
</template>

<script>
import { biddingProjectId, projectDetail } from '@api/common/list';
export default {
    data() {
        return {
            msg: '',
            projectdetail: '',
            detail: '',
            state: true
        };
    },
    methods: {
        // 获取详情
        async getbiddingProjectId() {
            let projectId = localStorage.getItem('projectId');
		const { data, code,msg } = await biddingProjectId(projectId);
            if (code == 200) {
                this.detail = data;
            } else if (code == 500) {
                this.state = false;
                this.msg = msg;
            }
        },
        async getprojectDetail() {
            let projectId = localStorage.getItem('projectId');
            const { data, code } = await projectDetail(projectId);
            if (code == 200) {
                this.projectdetail = data;
            }
        }
    },
    created() {
        this.getbiddingProjectId();
        this.getprojectDetail();
    }
};
</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>
