<template>
    <div class="hotNews">
        <div class="hotNews_title">
            热点精选
        </div>
        <ul class="hotNews_message">
            <li class="hotNews_messageList" v-for="(item, index) in hotNewsList" :key="index">
                <span class="number">{{ index + 1 }}</span>
                <NuxtLink
                    :href="getLinkPathDetail(item)"
                    :title="item.title"
                    :key="item.id"
                    :target="item.islink == 1 ? '_blank' : '_self'"
                >
                    <span class="hotlist_text">{{ item.title }}</span>
                </NuxtLink>
            </li>
        </ul>
    </div>
</template>

<script setup>
const getLinkPathDetail = (item) => {
    if (item.islink == 1) {
        return `${item.linkurl}`;
    } else {
        return `/${item.pinyin}/${item.id}.html`;
    }
}

const hotNewsList = ref([])
async function getPageData() {
    const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
        method: 'GET',
        query: {
            'imgnum': 0,
            'textnum': 8,
            'level': 5,
            'placeid': 0,
            'id': 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>
.hotNews {
    width: 270px;
    height: 597px;
    border-top: 2px solid #dd7d18;
    margin-top: 40px;

    //标题
    .hotNews_title {
        width: 100px;
        height: 40px;
        line-height: 40px;
        font-family: Microsoft YaHei, Microsoft YaHei;
        font-weight: bold;
        margin: 20px 0 15px;
        font-size: 20px;
        color: #333333;
    }

    //新闻列表
    .hotNews_message {
        width: 270px;

        .hotNews_messageList {
            width: 270px;
            height: 64px;
            line-height: 64px;
            border-bottom: 1px solid #E4E4E4;
            font-weight: 400;
            font-size: 18px;
            color: #333333;
            ;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;

            a {
                color: #333333;
            }

            .number {
                color: #999999;
                margin-right: 13px;
                font-family: DingTalk JinBuTi, DingTalk JinBuTi;
            }
        }

        .hotNews_messageList:nth-child(1) {
            .number {
                color: #dd7d18;
            }
        }

        .hotNews_messageList:nth-child(2) {
            .number {
                color: #dd7d18;
            }
        }

        .hotNews_messageList:nth-child(3) {
            .number {
                color: #dd7d18;
            }
        }

        .hotNews_messageList:hover {
            color: #dd7d18;

            a {
                color: #dd7d18;
            }
        }
    }
}
</style>