<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" v-if="skinId==1">
                <NuxtLink
                    v-if="titleLink.cid"
                    :href="getLinkPath(titleLink)"
                    :title="titleLink.alias"
                >
                    {{titleLink.alias}}
                </NuxtLink>
            </div>
            <div class="listNewsTitle_skin2" v-if="skinId==2">
                <span>
                    <NuxtLink
                        v-if="titleLink.cid"
                        :href="getLinkPath(titleLink)"
                        :title="titleLink.alias"
                    >
                        {{titleLink.alias}}
                    </NuxtLink>
                </span>
            </div>
            <div class="scrollTextSectorList" v-if="skinId==1">
                <div v-for="(item,index) in component_style1_News2Array">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        <span>[国际贸易]</span>
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="scrollTextSectorList_skin2" v-if="skinId==2">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        <span>[国际贸易]</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,//新闻数据
    skinId:String,//皮肤id
    templateAdData:Object,//广告
});

//轮播图
const roll_num_this = ref(0)
const roll_num_lang = ref(props.templateData.img.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.img.slice(0,5);
const component_style1_News2Array = ref([]);
component_style1_News2Array.value = props.templateData.text.slice(0,9);
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
.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 {
            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;
            }
        }
        .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:#004564;
                }
                a {
                    color:#333333;
                }
                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
        .scrollTextSectorList_skin2 {
            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:#A91B33;
                }
                a {
                    color:#333333;
                }
                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
    }
}

.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;
}
</style>