<template>
    <div class="title">
        <h4>
            热点精选
        </h4>
    </div>
    <!-- 列表 -->
    <ul class="rightList">
        <li v-for="item in hotNewsList">
            <NuxtLink :to="item.linkurl" target="_blank" v-show="item.islink == 1">
                <img class="left hotNewsImg" :src="item.imgurl">
                <p class="left">{{ item.title }}</p>
            </NuxtLink>
            <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank" v-if="item.islink == 0">
                <img class="left hotNewsImg" :src="item.imgurl">
                <p class="left">{{ item.title }}</p>
            </NuxtLink>
        </li>
    </ul>
</template>

<script setup>

//获得axios
const nuxtApp = useNuxtApp();
const axios = nuxtApp.$axios;

import { onMounted } from 'vue'

const hotNewsList = ref([])

//获取详情
const getHotNews = async () => {
    const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${5}&level=${4}&placeid=${15}`);
    hotNewsList.value = response.data;
}

onMounted(() => {
    getHotNews()
})
</script>


<style lang="less" scoped>
.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;
        }
    }

}

.rightList {
    height: 540px;
    padding-top: 20px;
    background-color: #fbfbfb;

    >li {
        height: 100px;
        margin-bottom: 10px;
        margin-left: 15px;

        a {
            display: block;
        }

        >img {
            width: 150px;
            height: 100px;
            border-radius: 4px;
        }

        p {
            width: 216px;
            height: 100px;
            padding-left: 12px;
            padding-right: 10px;
            box-sizing: border-box;
            font-family: PingFang SC, PingFang SC;
            font-weight: 400;
            font-size: 16px;
            color: #333333;
            line-height: 22px;
            text-align: left;
            font-style: normal;
            text-transform: none;

        }


    }

    >li:hover {
        p {
            box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
            color: #139602;
        }
    }
}

.hotNewsImg {
    width: 150px;
    height: 100px;
    border-radius: 4px;
}
</style>