<template>
    <div class="hotList">
        <div class="title">
            最新资讯
            <em></em>
        </div>
        <div class="top111">
            <div class="hotList_photo_text" v-for="(item, index) in hotNewsListImg" :key="index">
                <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">
                    <img :src="item.imgurl" alt="">
                    <span class="jingxuan">精选</span>
                    <div class="hotlist_text">{{ item.title }}</div>
                </NuxtLink>
                <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
                    <img :src="item.imgurl" alt="">
                    <span class="jingxuan">精选</span>
                    <div class="hotlist_text">{{ item.title }}</div>
                </NuxtLink>
            </div>
        </div>

        <ul class="message">
            <li class="messageList" v-for="(item, index) in hotNewsList" :key="index">
                <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">{{ item.title }}</NuxtLink>
                <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
                    {{ item.title }}
                </NuxtLink>
            </li>
        </ul>
    </div>
</template>

<script setup>

const hotNewsList = ref([])
const hotNewsListImg = ref([])
async function getPageData() {
    const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
        method: 'GET',
        query: {
            'imgnum':1,
            'textnum': 5,
            'level': 4,
            'id': 0,
            'placeid': 0,
        },
    });
    if (mkdata.code == 200) {
        hotNewsList.value = mkdata.data.text;
        hotNewsListImg.value = mkdata.data.img;
        console.log("11111111111111111111111111", hotNewsList.value);

    } else {
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取最新资讯")
        console.log("后端错误反馈：", mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getPageData();

</script>

<style lang="less" scoped>
.title {
    width: 100px;
    height: 40px;
    line-height: 40px;
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    margin: 10px 0;
    font-size: 20px;
    color: #333333;
    position: relative;

    em {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 4px;
        background-color: #a01c0e;
        position: absolute;
        top: 6px;
        right: 8px;
    }

}

.top111 {
    width: 350px;
    height: 280px;
    position: relative;

    .hotList_photo_text {
        width: 350px;
        height: 280px;
        position: relative;

        img {
            width: 350px;
            height: 230px;
        }

        .jingxuan {
            display: inline-block;
            width: 50px;
            height: 26px;
            background-color: #a01c0e;
            color: #fff;
            text-align: center;
            line-height: 26px;
            position: absolute;
            top: 0px;
            right: 10px;
        }

        .hotlist_text {
            width: 350px;
            height: 40px;
            line-height: 40px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: bold;
            font-size: 18px;
            color: #333333;
            margin-top: 8px;
        }
    }
}


.message {
    width: 350px;
    margin-top: 30px;

    .messageList {
        width: 350px;
        white-space: nowrap;
        /* 禁止换行 */
        overflow: hidden;
        /* 隐藏超出部分 */
        text-overflow: ellipsis;
        /* 超出部分显示省略号 */
        font-family: Microsoft YaHei, Microsoft YaHei;
        font-weight: 400;
        font-size: 18px;
        color: #333333;
        margin-bottom: 25px;

        a {
            color: #333333;
        }
    }

    .messageList:first-child {
        font-weight: bold;
    }

    >li:hover>a {
        color: #a01c0e;
    }

}
</style>