<template>
    <div class="hotNews">
        <div class="title">
            <h4> 热点推荐 </h4>
        </div>
        <!-- 列表 -->
        <ul class="rightList">
            <li v-for="item in hotNewsList">
                <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">
                    <img class="hotNewsImg" :src="item.imgurl">
                    <div class="hotNewsText">
                        <div class="textTitle">{{ item.title }}</div>
                        <div class="content dot3">{{ item.introduce }}</div>
                    </div>
                </NuxtLink>
                <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
                    <img class="hotNewsImg" :src="item.imgurl">
                    <div class="hotNewsText">
                        <div class="textTitle dot1">{{ item.title }}</div>
                        <div class="content dot3">{{ item.introduce }}</div>
                    </div>
                </NuxtLink>
            </li>
        </ul>
    </div>
</template>

<script setup>
const hotNewsList = ref([])
async function getPageData() {
    const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
        method: 'GET',
        query: {
            'textnum': 0,
            'imgnum': 6,
            'level': 5,
            'placeid': 0,
            'id': 0
        },
    });
    console.log("获取热点精选", mkdata);

    if (mkdata.code == 200) {
        for (let item of mkdata.data.img) {
            if (item.imgurl) {
                hotNewsList.value.push(item)
                if (hotNewsList.value.length == 6) {
                    break;
                }
            }
        }
    } 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>
@media screen and (min-width: 1401px) {
    .hotNews {
        font-family: "微软雅黑";
        width: 100%;
        height: auto;
        overflow: hidden;
        border: 1PX solid #C6E9FF;
        border-top-left-radius: 5PX;
        border-top-right-radius: 5PX;
        padding-bottom: 10PX;
        margin-bottom: 10PX;
        box-sizing: border-box;

        .title {
            width: 100%;
            height: 37PX;
            line-height: 37PX;
            overflow: hidden;
            padding: 0 10PX;
            box-sizing: border-box;
            background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
            background-size: 100% 100%;

            h4 {
                font-size: 18PX;
                color: #fff;
                font-weight: bold;
            }
        }

        .rightList {
            padding-top: 5PX;

            li {
                width: 99%;
                height: auto;
                overflow: hidden;
                margin-top: 10PX;
                padding: 0 20PX;
                box-sizing: border-box;

                a {
                    display: flex;

                    .hotNewsImg {
                        width: 92PX;
                        height: 94PX;
                        border-radius: 4PX;
                    }

                    .hotNewsText {
                        width: 70%;
                        height: 94PX;
                        padding-left: 10PX;
                        font-size: 14PX;
                        color: #000;
                        line-height: 24PX;

                        .textTitle {
                            width: 98%;
                            line-height: 30PX;
                            font-size: 14PX;
                            color: #0293ff;
                            font-weight: bold;
                            overflow: hidden;
                            white-space: nowrap;
                            text-overflow: ellipsis;
                        }

                        .content {
                            width: 98%;
                            height: 60PX;
                            line-height: 20PX;
                            font-size: 12PX;
                            color: #000;
                        }


                    }
                }
            }
        }
    }

    .dot3 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
    }


    .hotNewsImg {
        float: left;
        width: 150PX;
        height: 100PX;
        border-radius: 4PX;
    }
}

@media screen and (min-width: 801px) and (max-width: 1400px) {
    .hotNews {
        font-family: "微软雅黑";
        width: 100%;
        height: auto;
        overflow: hidden;
        border: 1PX solid #C6E9FF;
        border-top-left-radius: 5PX;
        border-top-right-radius: 5PX;
        padding-bottom: 10PX;
        margin-bottom: 10PX;

        .title {
            width: 100%;
            height: 37PX;
            line-height: 37PX;
            overflow: hidden;
            padding: 0 10PX;
            background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
            background-size: 100% 100%;

            h4 {
                font-size: 18PX;
                color: #fff;
                font-weight: bold;
            }
        }

        .rightList {
            box-sizing: border-box;
            padding-top: 5PX;

            li {
                width: 100%;
                height: auto;
                overflow: hidden;
                margin-top: 10PX;
                padding: 0 20PX;
                box-sizing: border-box;

                a {
                    width: 100%;
                    display: flex;

                    .hotNewsImg {
                        width: 92PX;
                        height: 94PX;
                        border-radius: 4PX;
                    }

                    .hotNewsText {
                        width: calc(100% - 92PX);
                        height: 94PX;
                        padding-left: 10PX;
                        font-size: 14PX;
                        color: #000;
                        line-height: 24PX;
                        box-sizing: border-box;

                        .textTitle {
                            width: 98%;
                            line-height: 30PX;
                            font-size: 14PX;
                            color: #0293ff;
                            font-weight: bold;
                            overflow: hidden;
                            white-space: nowrap;
                            text-overflow: ellipsis;
                        }

                        .content {
                            width: 98%;
                            height: 60PX;
                            line-height: 20PX;
                            font-size: 12PX;
                            color: #000;
                        }
                    }
                }
            }
        }
    }

    .dot3 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
    }


    .hotNewsImg {
        float: left;
        width: 150PX;
        height: 100PX;
        border-radius: 4PX;
    }
}

@media screen and (max-width: 800px) {
    .hotNews {
        font-family: "微软雅黑";
        width: 100%;
        height: auto;
        overflow: hidden;
        border: 2px solid #C6E9FF;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        padding-bottom: 20px;
        margin-bottom: 20px;

        .title {
            width: 100%;
            height: 74px;
            line-height: 74px;
            overflow: hidden;
            padding: 0 20px;
            background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
            background-size: 100% 100%;

            h4 {
                font-size: 36px;
                color: #fff;
                font-weight: bold;
            }
        }

        .rightList {
            padding-top: 10px;

            li {
                width: 100%;
                height: auto;
                overflow: hidden;
                margin-top: 20px;
                padding: 0 40px;
                box-sizing: border-box;
                font-family: "微软雅黑";

                a {
                    display: flex;

                    .hotNewsImg {
                        float: left;
                        width: 224px;
                        height: 180px;
                        border-radius: 4px;
                    }

                    .hotNewsText {
                        width: 70%;
                        height: 180px;
                        padding-left: 20px;
                        font-size: 28px;
                        color: #000;
                        line-height: 48px;

                        .textTitle {
                            width: 98%;
                            line-height: 60px;
                            font-size: 32px;
                            color: #0293ff;
                            font-weight: bold;
                            overflow: hidden;
                            white-space: nowrap;
                            text-overflow: ellipsis;
                        }

                        .content {
                            width: 98%;
                            height: 120px;
                            line-height: 40px;
                            font-size: 26px;
                            color: #000;
                        }
                    }
                }
            }
        }
    }

    .dot1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dot3 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
    }
}
</style>