<template>
    <div class="listNewsBox">
        <div class="listNewsTitle_skin5">
            <span>
                <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                    <div>{{ titleLink.alias }}</div>
                </NuxtLink>
            </span>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle == 1">
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemBottom">
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
                <div class="contentBottomRIght">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent style2" v-if="componentStyle == 2">
            <div class="listNewsContentItemBottom">
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
                <div class="contentBottomRIght">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent" v-if="componentStyle == 3">
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemBottom">
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
                <div class="contentBottomRIght bg_blue">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent style4" v-if="componentStyle == 4">
            <div class="listNewsContentItemBottom">
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
                <div class="contentBottomRIght bg_blue">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent style5" v-if="componentStyle == 5">
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemBottom">
                <div class="contentBottomRIght">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式6-->
        <div class="listNewsContent style6" v-if="componentStyle == 6">
            <div class="listNewsContentItemBottom">
                <div class="contentBottomRIght">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式7-->
        <div class="listNewsContent style7" v-if="componentStyle == 7">
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemBottom">
                <div class="contentBottomRIght bg_blue">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式8-->
        <div class="listNewsContent style8" v-if="componentStyle == 8">
            <div class="listNewsContentItemBottom">
                <div class="contentBottomRIght bg_blue">
                    <div v-for="(item, index) in component_style1_News1Array" :key="item.id"
                        @mouseenter="active = index">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="contenBottomLeft" v-if="component_style1_News1Array.length > 0">
                    <NuxtLink :href="getLinkPathDetail(component_style1_News1Array[active])"
                        :title="component_style1_News1Array[active].title"
                        :target="component_style1_News1Array[active].islink == 1 ? '_blank' : '_self'">
                        <img :src="component_style1_News1Array[active].imgurl" alt="">
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentItemTop">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>精选</span>
                        <em></em>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>

    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink: Object,//板块名称
    templateData: Array,//新闻数据
    componentStyle: Number,//样式编号
});
//定义变量并赋值 start ---------------------------------------->
const active = ref(0);
const component_style1_News1Array = ref({});
const component_style1_News2Array = ref([]);
component_style1_News1Array.value = props.templateData.imgnum.slice(0, 5);
component_style1_News2Array.value = props.templateData.textnum.slice(0, 5);
//定义变量并赋值 end ---------------------------------------->

</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.listNewsBox {
    position: relative;

    .listNewsTitle_skin5 {
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        border-bottom: 1px solid #999999;
        height: 38px;
        margin-bottom: 20px;

        div {
            height: 35px;
            width: 138px;
            line-height: 32px;
            font-size: 22px;
            font-weight: bold;
            color: #333333;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: #3848A0;
            background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
        }
    }

}

//基本样式 end ---------------------------------------->

//样式1 start ---------------------------------------->
.listNewsBox {
    .listNewsContent {
        margin-bottom: 20px;

        .listNewsContentItemTop {
            width: 100%;
            height: 220px;
            margin-bottom: 25px;

            div {
                width: 580px;
                color: #333333;
                font-size: 18px;
                margin-bottom: 23px;
                cursor: pointer;
                overflow: hidden;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;

                span {
                    display: inline-block;
                    width: 36px;
                    height: 24px;
                    line-height: 24px;
                    font-size: 18px;
                    font-weight: bold;
                    color: #3848A0;
                    padding-right: 15px;
                }

                em {
                    display: inline-block;
                    width: 1px;
                    height: 15px;
                    background-color: #b3b3b3;
                    margin-right: 15px;
                }

                &:last-child {
                    margin-bottom: 0;
                }

                a {
                    color: #333333;
                }
            }
        }

        .listNewsContentItemBottom {
            width: 100%;
            height: 190px;
            background-color: #f9fafb;
            display: flex;

            .contenBottomLeft {
                width: 285px;
                height: 190px;
                position: relative;

                a {
                    img {
                        position: absolute;
                        top: 0;
                        left: 0;
                        width: 285px;
                        height: 190px;
                    }
                }

            }

            .contentBottomRIght {
                height: 190px;
                padding-left: 20px;
                padding: 5px 0 5px 16px;

                div {
                    width: 260px;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    height: 24px;
                    line-height: 24px;
                    font-size: 18px;
                    color: #333333;
                    margin-bottom: 15px;
                    padding-left: 16px;
                    background: url("https://img.bjzxtw.org.cn/pre/image/png/20251111/1762854924444085.png") no-repeat left center;

                    &:last-child {
                        margin-bottom: 0;
                    }

                    &:hover {
                        font-weight: bold;
                    }

                    a {
                        color: #333333;
                    }
                }
            }

            //文字前缀为主题色蓝色
            .bg_blue {
                div {
                    background: url("https://img.bjzxtw.org.cn/pre/image/png/20251112/1762909332941464.png") no-repeat left center;
                }
            }

        }
    }

    //样式2
    .style2,
    .style4 {
        .listNewsContentItemBottom {
            margin-bottom: 25px;
        }

        .listNewsContentItemTop {
            margin-bottom: 0px;
        }
    }

    // 样式5
    .style5,
    .style7 {
        .listNewsContentItemBottom {
            .contenBottomLeft {
                margin-right: 0px;
            }

            .contentBottomRIght {
                margin-right: 7px;
            }
        }
    }

    // 样式6
    .style6,
    .style8 {
        .listNewsContentItemBottom {
            margin-bottom: 25px;

            .contenBottomLeft {
                margin-right: 0px;
            }

            .contentBottomRIght {
                margin-right: 7px;
            }
        }

        .listNewsContentItemTop {
            margin-bottom: 0px;
        }
    }
}
</style>