<!-- <template>
    <div class="home">
        <p class="title">{{ title }}</p>
        <p class="time">{{ time }}</p>
        <div v-if="route.query.type === 'BID' && Number(BidType) === 7" class="investment">
            <div class="investment-content">项目编号：{{ code }}</div>
            <div class="investment-content">物业具体位置：{{ position }}</div>
            <div class="investment-content">招租面积（㎡）：{{ area }}</div>
            <div class="investment-content">挂牌价格：{{ price }}</div>
            <div class="investment-content">推荐用途：{{ purpose }}</div>
            <div class="investment-content">项目特点：{{ characteristic }}</div>
            <div class="investment-content">联系人：{{ contact }}</div>
            <div class="investment-content">联系电话：{{ contactPhone }}</div>
        </div>
        <div v-html="url" class="detail-content-text"></div>
        <div v-for="item in pdfUrl" :key="item.originalFilename" style="margin-top: 10px; text-align: center">
            <el-link type="primary" @click="onClickUrl(inductIP+item.url)">{{ inductIP+item.url }}</el-link>
        </div>
    </div>
</template>

<script setup lang="ts">
import { useRoute } from "vue-router";
import { newsDetails } from "@/api/newsManagement";
import { getInformation } from "@/api/informationDisclosure/informationDisclosure";
import { jobDetails } from "@/api/enterpriseRecruitment/index";
import { getPublicKey } from "@/api/login";
import { Encrypt, Decrypt } from "@/utils/AES";

const route = useRoute()
const url = ref('')
const title = ref('')
const time = ref('')
const pdfUrl = ref<any[]>([])
const type = route.query.contentType
// const inductIP = sessionStorage.getItem('minioUrl');
const inductIP = import.meta.env.VITE_APP_BASE_API;
const BidType = ref('');
const position = ref('');
const area = ref('');
const price = ref('');
const characteristic = ref('');
const purpose = ref('');
const contact = ref('');
const contactPhone = ref('');
const code = ref('');
// 获取密钥
// const publicKey = ref();
// const privateKey = ref();
// function getKey() {
//     return new Promise((resolve, reject) => {
//         getPublicKey()
//             .then(res => {
//                 resolve(res);
//             })
//             .catch(error => {
//                 reject(error);
//             });
//     });
// }
function getNewsDetails() {
    if (route.query.type === 'NEWS') {
        newsDetails(route.query.id).then((res: any) => {
            const arr = Decrypt(res.data.content);
            url.value = arr.replaceAll('{{imageUrlPathName}}', inductIP);
            pdfUrl.value = res.data.filePaths;
            title.value = res.data.title;
            time.value = res.data.date;
        });
    }else if (route.query.type === 'BID') {
        getInformation(String(route.query.id)).then((res: any) => {
            const arr = Decrypt(res.data.content);
            url.value = arr.replaceAll('{{imageUrlPathName}}', inductIP);
            pdfUrl.value = res.data.filePaths;
            title.value = res.data.title;
            time.value = res.data.date;
            BidType.value = res.data.type;
            position.value = res.data.position;
            area.value = res.data.area;
            price.value = res.data.price;
            characteristic.value = res.data.characteristic;
            purpose.value = res.data.purpose;
            contact.value = res.data.contact;
            contactPhone.value = res.data.contactPhone;
            code.value = res.data.code;
        });
    }else if (route.query.type === 'JOB') {
        jobDetails(String(route.query.id)).then((res: any) => {
            const arr = Decrypt(res.data.content);
            url.value = arr.replaceAll('{{imageUrlPathName}}', inductIP);
            pdfUrl.value = res.data.filePaths;
            title.value = res.data.title;
            time.value = res.data.date;
        });
    }
}

const  onClickUrl = (row: any) => {
    window.open(row)
}
onMounted(async () => {
    await getNewsDetails()
})
</script>

<style scoped lang="scss">
.home {
    margin: 20px;
    padding: 20px 20%;
    background-color: #fff;
    position: relative;
    overflow: hidden;
    p {
        font-weight: 400;
        // font-size: 18px;
        line-height: 24px;
        // margin-bottom: 10px;
    }
}
.title {
    font-size: 20px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
    padding: 20px;
}
.time {
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
    font-size: 14px;
    color: #666666;
    line-height: 24px;
}
:deep .detail-content-text .bodyContent .honourSection {
    width: 100% !important;
}
.investment-content {
    line-height: 28px;
}
</style> -->
<script setup lang="ts"></script>
<template></template>
<style scoped></style>