<template>
    <div class="listNewsBox">
        <div class="listNewsTitle" v-if="skinId=='1'">
            <NuxtLink
                class="active"
                v-if="titleLink.cid"
                :href="getLinkPath(titleLink)"
                :title="titleLink.alias"
            >
                {{titleLink.alias}}
            </NuxtLink>
        </div>
        <div class="listNewsTitle_skin2" v-if="skinId=='2'">
            <span>
                <NuxtLink
                    class="active"
                    v-if="titleLink.cid"
                    :href="getLinkPath(titleLink)"
                    :title="titleLink.alias"
                >
                    {{titleLink.alias}}
                </NuxtLink>
            </span>
        </div>
        <div class="listNewsContent">
            <div class="listNewsContentBottomBox">
                <div class="listNewsContentBottom">
                    <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentTop">
                <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        <img :src="item.imgurl" />
                        <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import {ref} from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink:Object,//板块名称
    templateData:Array,//新闻数据
    skinId:String,//皮肤id
});

//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array = ref({});
const component_style1_News2Array = ref([]);
component_style1_News1Array.value = props.templateData.img.slice(0,2);
component_style1_News2Array.value = props.templateData.text;
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
.listNewsBox {
    position: relative;
    .listNewsTitle {
        font-size:22px;
        font-weight:bold;
        height: 40px;
        line-height: 40px;
        border-bottom: 2px solid #004564;
        color:#004564;
        margin-bottom: 20px;
        box-sizing: border-box;
        a {
            color:#004564;
            display: block;
            height: 25px;
            line-height: 25px;
        }
    }
    .listNewsTitle_skin2 {
        font-size:22px;
        font-weight:bold;
        height: 40px;
        line-height: 40px;
        border-bottom: 2px solid #A91B33;
        color:#A91B33;
        margin-bottom: 20px;
        box-sizing: border-box;
        a {
            color:#A91B33;
            display: block;
            height: 25px;
            line-height: 25px;
        }
        span {
            color:#A91B33;
            height: 25px;
            line-height: 25px;
            border-left: 3px solid #A91B33;
            padding-left: 12px;
            display: block;
        }
    }
    .listNewsContent {
        height: 374px;
        .listNewsContentTop {
            display: flex;
            align-items: center;
            justify-content: space-between;
            .listNewsContentTopItem {
                width: 350px;
                height: 110px;
                a{
                    display: block;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                }
                img {
                    display: block;
                    width: 170px;
                    height: 110px;
                }
                .listNewsContentTopItemTitle {
                    font-size: 18px;
                    color: #333333;
                    margin-left: 8px;
                    margin-right: 8px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 3;
                }
            }
        }
        .listNewsContentBottomBox {
            height: 244px;
            margin-bottom: 20px;
        }
        .listNewsContentBottom {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            justify-content: space-between;
            margin-bottom: 20px;
            div {
                width: 350px;
                height: 24px;
                line-height: 24px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                margin-bottom: 20px;
                &:nth-last-child(-n+2) {
                    margin-bottom: 0;
                }
                &:nth-child(1),
                &:nth-child(2),
                &:nth-child(7),
                &:nth-child(8) {
                    font-weight: bold;
                }
                a {
                    font-size: 18px;
                    color: #333333;
                }
            }
        }
    }
}
</style>