<template>
    <div class="scrollTextSectorBox">
        <!-- 样式1 -->
        <div class="scrollTextSector" v-if="componentStyle == 1">
            <div class="scrollTextSectorLeft">
                <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun"
                    trigger="click">
                    <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
                        <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" class="swiper_link"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl">
                            <span class="swiper_dot1">
                                <span class="title dot1">{{ item.title }}</span>
                            </span>
                        </NuxtLink>
                    </el-carousel-item>
                </el-carousel>
            </div>
            <div class="scrollTextSectorRight">
                <div class="listNewsTitle_skin6">
                    <span>
                        <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                            {{ titleLink.alias }}
                        </NuxtLink>
                    </span>
                </div>
                <div class="scrollTextSectorList">
                    <div v-for="(item, index) in component_style1_News2Array">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!-- 样式2 -->
        <div class="scrollTextSector" v-if="componentStyle == 2">
            <div class="scrollTextSectorLeft">
                <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun"
                    trigger="click">
                    <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
                        <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" class="swiper_link"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl">
                            <span class="swiper_dot1">
                                <span class="title dot1">{{ item.title }}</span>
                            </span>
                        </NuxtLink>
                    </el-carousel-item>
                </el-carousel>
            </div>
            <div class="scrollTextSectorRight">
                <div class="listNewsTitle_skin6">
                    <span>
                        <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                            {{ titleLink.alias }}
                        </NuxtLink>
                    </span>
                </div>
                <div class="scrollTextSectorList style2">
                    <div v-for="(item, index) in component_style1_News2Array">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!-- 样式3 -->
        <div class="scrollTextSector" v-if="componentStyle == 3">
            <div class="scrollTextSectorRight">
                <div class="listNewsTitle_skin6">
                    <span>
                        <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                            {{ titleLink.alias }}
                        </NuxtLink>
                    </span>
                </div>
                <div class="scrollTextSectorList">
                    <div v-for="(item, index) in component_style1_News2Array">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="scrollTextSectorLeft">
                <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun"
                    trigger="click">
                    <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
                        <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" class="swiper_link"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl">
                            <span class="swiper_dot1">
                                <span class="title dot1">{{ item.title }}</span>
                            </span>
                        </NuxtLink>
                    </el-carousel-item>
                </el-carousel>
            </div>
        </div>
        <!-- 样式4 -->
        <div class="scrollTextSector" v-if="componentStyle == 4">
            <div class="scrollTextSectorRight">
                <div class="listNewsTitle_skin6">
                    <span>
                        <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                            {{ titleLink.alias }}
                        </NuxtLink>
                    </span>
                </div>
                <div class="scrollTextSectorList style4">
                    <div v-for="(item, index) in component_style1_News2Array">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="scrollTextSectorLeft">
                <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun"
                    trigger="click">
                    <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
                        <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" class="swiper_link"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl">
                            <span class="swiper_dot1">
                                <span class="title dot1">{{ item.title }}</span>
                            </span>
                        </NuxtLink>
                    </el-carousel-item>
                </el-carousel>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
import { ElCarousel, ElCarouselItem } from 'element-plus'

//获得新闻数据
const props = defineProps({
    titleLink: Object,//板块名称
    templateData: Array,//新闻数据
    componentStyle: Number,//样式编号
    templateAdData: Object,//广告
});

//轮播图
const roll_num_this = ref(0)
const roll_num_lang = ref(props.templateData.imgnum.length);
const change_fun = (the_1) => {
    roll_num_this.value = the_1
}
//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array = ref([]);
component_style1_News1Array.value = props.templateData.imgnum.slice(0, 5);
const component_style1_News2Array = ref([]);
component_style1_News2Array.value = props.templateData.textnum.slice(0, 7);
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.scrollTextSectorBox {
    width: 1200px;
    height: 410px;

    .scrollTextSector {
        width: 1200px;
        height: 410px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;

        img {
            width: 720px;
            height: 405px;
            display: block;
        }

        .scrollTextSectorLeft {
            width: 720px;
            height: 405px;
        }

        .scrollTextSectorRight {
            width: 450px;
            height: 405px;

            .listNewsTitle_skin6 {
                font-size: 22px;
                font-weight: bold;
                height: 45px;
                line-height: 43px;
                color: #154079;
                margin-bottom: 17px;
                box-sizing: border-box;

                span {
                    display: inline-block;
                    width: 108px;
                    color: #154079;
                    height: 30px;
                    line-height: 30px;
                    font-weight: bold;
                    background-size: 100% 6px;
                    background-repeat: no-repeat;
                    background-position: bottom;
                    padding-bottom: 6px;
                    background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;

                    a {
                        color: #154079;
                    }
                }
            }

            .scrollTextSectorList {

                div {
                    position: relative;
                    cursor: pointer;
                    color: #333;

                    a {
                        color: #333;
                    }

                    &:nth-child(1),
                    &:nth-child(2) {
                        height: 52px;
                        line-height: 24px;
                        font-size: 20px;
                        font-weight: bold;
                        margin-bottom: 15px;
                    }

                    &:nth-child(2) {
                        margin-bottom: 25px;
                    }

                    &:nth-child(3),
                    &:nth-child(4),
                    &:nth-child(5) {
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                        font-size: 18px;
                        padding-bottom: 20px;
                        border-bottom: 1px dashed #d7daec;
                        margin-bottom: 26px;
                    }

                    &:nth-child(5) {
                        margin-bottom: 0;
                    }
                }
            }

            // 样式2
            .style2,
            .style4 {
                div {

                    &:nth-child(3),
                    &:nth-child(4),
                    &:nth-child(5) {
                        border-bottom: 1px solid #d7daec;
                    }
                }
            }

        }
    }
}

.roll_num_box {
    position: absolute;
    z-index: 2;
    right: 35px;
    bottom: 5px;
    height: 60px;
    line-height: 60px;
    color: #fff;
    font-size: 20px;

    .roll_num_box_new {
        font-size: 20px;
    }
}

.dot1 {
    display: block;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swiper_dot1 {
    display: block;
    width: 100%;
    line-height: 60px;
    height: 60px;
    color: #fff;
    font-size: 18px;
    text-indent: 20px;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
    box-sizing: border-box;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
}

.el-carousel {
    :deep(.el-carousel__arrow i) {
        font-size: 33px !important;
    }

    .roll_1_box {
        position: relative;
    }

    :deep(.el-carousel__arrow--left) {
        left: 20px;
        width: 36px;
        height: 36px;
        color: #eee;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        position: absolute;
        border: none;
        border-radius: 50%;
    }

    :deep(.el-icon-arrow-left:before) {
        font-size: 24px;
        line-height: 56px;
    }

    :deep(.el-carousel__arrow--right) {
        right: 20px;
        width: 36px;
        height: 36px;
        color: #eee;
        background: rgba(0, 0, 0, 0.5);
        position: absolute;
        border: none;
        border-radius: 50%;
    }

    :deep(.el-icon-arrow-right:before) {
        font-size: 24px;
        line-height: 56px;
    }

    :deep(.el-carousel__indicators) {
        // 指示器
        left: unset;
        transform: unset;
        right: 10px;
        bottom: 11px;
    }

    :deep(.el-carousel__button) {
        // 指示器按钮
        width: 26px;
        height: 5px;
        border: none;
        background: #fff;
        opacity: 1;
        border-radius: 4px;
    }

    :deep(.is-active .el-carousel__button) {
        // 指示器激活按钮
        background: #154079;
        width: 26px;
        height: 5px;
        opacity: 1;
    }

    :deep(.el-carousel__container) {
        height: 100%;
    }
}

.custom-indicator button {
    background-color: #fff;
    opacity: 1;
    width: 8px;
    height: 8px;
}

.custom-indicator button.is-active {
    background-color: #c82200;
    width: 58px;
    opacity: 1;
}
</style>