<template>
    <div class="scrollTextSectorBox">
        <div class="scrollTextSectorLeft">
            <el-carousel :interval="3333" height="405px" indicator-position="none" arrow="always" @change="change_fun">
                <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <span class="swiper_dot1 dot1">
                            {{ item.title }}
                        </span>
                    </NuxtLink>
                </el-carousel-item>
                <div class="roll_num_box">
                    <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>/{{ roll_num_lang }}
                </div>
            </el-carousel>
        </div>
        <div class="scrollTextSectorRight">
            <div class="listNewsTitle_skin3">
                <span>
                    <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                        {{ titleLink.alias }}
                    </NuxtLink>
                </span>
            </div>
            <!--样式1-->
            <div class="scrollTextSectorList" v-if="componentStyle == 100">
                <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>
            <!--样式2-->
            <div class="scrollTextSectorList" v-if="componentStyle == 2">
                <div v-for="(item, index) in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>[{{ titleLink.alias }}]</span>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <!--样式3-->
            <div class="scrollTextSectorList scrollTextSectorStyle3" v-if="componentStyle == 1">
                <div v-for="(item, index) in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>[{{ titleLink.alias }}]</span>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <!--样式4-->
            <div class="scrollTextSectorList scrollTextSectorStyle4" v-if="componentStyle == 4">
                <div v-for="(item, index) in component_style1_News2Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>[{{ titleLink.alias }}]</span>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </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 - 1);
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, 9);
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.scrollTextSectorBox {
    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_skin3 {
            font-size: 22px;
            font-weight: bold;
            height: 40px;
            line-height: 40px;
            background-color: #fdf8f7;
            margin-bottom: 20px;
            box-sizing: border-box;

            span {
                display: inline-block;
                width: 112px;
                height: 40px;
                line-height: 40px;
                background: #c82200;
                color: #fff;
                text-align: center;

                a {
                    color: #fff;
                    background-color: #c82200;
                }
            }
        }

        .scrollTextSectorList {
            div {
                font-size: 18px;
                height: 24px;
                line-height: 24px;
                margin-bottom: 16px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;

                span {
                    margin-right: 5px;
                    color: #c82200;
                }

                a {
                    color: #333333;
                }

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

                &:first-child {
                    a {
                        color: #333;
                    }
                }
            }
        }
    }
}

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

    .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;
    padding: 0 144px;
    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) {
        position: absolute;
        width: 35px;
        height: 57px;
        color: #fff;
        background: rgba(0, 0, 0, 0);
        left: 9px;
        border: none;
        border-radius: 0;
        top: 100%;
        margin-top: -36px;
    }

    :deep(.el-carousel__arrow--right) {
        width: 35px;
        height: 57px;
        color: #fff;
        background: rgba(0, 0, 0, 0);
        position: absolute;
        right: 9;
        border: none;
        border-radius: 0;
        top: 100%;
        margin-top: -36px;
    }

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

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

    :deep(.is-active .el-carousel__button) {
        // 指示器激活按钮
        background: #255590;
        width: 25px;
        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: #DD7D18;
    width: 58px;
    opacity: 1;
}

//基本样式 start ---------------------------------------->
//样式3 start ---------------------------------------->
.scrollTextSectorBox {
    .scrollTextSectorRight {
        .scrollTextSectorStyle3 {
            div:first-child {
                font-weight: bold;
                color: #333333;

                span {
                    color: #333333;
                }

                a {
                    color: #333333;
                }
            }
        }
    }
}
//样式3 end ---------------------------------------->
//样式4 start ---------------------------------------->
.scrollTextSectorBox {
    .scrollTextSectorRight {
        .scrollTextSectorStyle4 {
            div:first-child {
                font-weight: bold;
                color: #c82200;

                span {
                    color: #c82200;
                }

                a {
                    color: #c82200;
                }
            }
        }
    }
}

//样式4 end ----------------------------------------></style>