<template>
    <div class="hotList">
        <div class="title">
            <h4>
                最新资讯
            </h4>
        </div>
        <ul class="messageList">
            <li v-for="(item, index) in hotNewsList">
                <span>{{ index + 1 }}</span>
                <NuxtLink :to="item.linkurl" v-show="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([])
async function getPageData() {
    const mkdata =  await requestDataPromise('/web/getWebsiteArticlett', {
        method: 'GET',
        query: {
            'imgnum': 0,
            'textnum': 14,
            'level': 4,
            'id': 0,
            'placeid': 0,
        },
    });
    if(mkdata.code == 200){
        hotNewsList.value = mkdata.data.text;
    }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>
.hotList {
    background: #fff;
}

.title {
    width: 380px;
    height: 40px;
    line-height: 40px;
    // border-top: 1px solid #139602;
    border-bottom: 1px solid #e7e7e7;
    background-color: #fbfbfb;

    >h4 {
        font-family: Microsoft YaHei, Microsoft YaHei;
        font-weight: 400;
        margin-left: 20px;
        font-size: 20px;
        color: #000000;
        text-align: left;
        font-style: normal;
        text-transform: none;

        >span {
            float: right;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: 400;
            font-size: 14px;
            margin-right: 10px;
            color: #999999;
            text-align: left;
            font-style: normal;
            text-transform: none;
        }
    }

}

.messageList {
    height: 563px;
    padding-top: 15px;
    margin-bottom: 30px;
    background-color: #fbfbfb;

    >li {
        height: 24px;
        margin-bottom: 16px;
        white-space: nowrap;
        /* 禁止换行 */
        overflow: hidden;
        /* 隐藏超出部分 */
        text-overflow: ellipsis;
        /* 超出部分显示省略号 */


        >span {
            display: inline-block;
            width: 24px;
            height: 24px;
            margin-left: 22px;
            line-height: 24px;
            vertical-align: middle;
            text-align: center;
            background-color: #cecece;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: 400;
            font-size: 18px;
            color: #FFFFFF;
            text-align: center;
            font-style: normal;
            text-transform: none;
        }

        >a {
            width: 256px;
            height: 21px;
            font-family: Microsoft YaHei, Microsoft YaHei;
            font-weight: 400;
            font-size: 16px;
            color: #333333;
            line-height: 19px;
            text-align: left;
            font-style: normal;
            text-transform: none;
            padding-left: 10px;


        }

    }

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

    >li:nth-child(1)>span {
        background-color: #00c524;
    }

    >li:nth-child(2)>span {
        background-color: #ffdf27;
    }

    >li:nth-child(3)>span {
        background-color: #f3c57f;
    }
}
</style>