<template>
    <div class="listNewsBox">
        <div class="listNewsTitle">
            <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                <div>{{ titleLink.alias }}</div>
            </NuxtLink>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle == 1">
            <div class="textLeft">
                <div class="textLeft_1">
                    <div class="textLeft_1_top" v-for="item in component_style1_News1Array_img_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" alt="">
                            <span>{{ item.title }}</span>
                        </NuxtLink>
                    </div>
                    <div class="textLeft_1_bottom">
                        <div v-for="item in component_style1_News1Array_img_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textLeft_2">
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_1">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                </div>
            </div>
            <div class="textRight">
                <div class="textRightContent">
                    <div class="textRightContent_title">专题报道</div>
                    <div class="textRightContent_content">
                        <div v-for="item in component_style1_News1Array_img_3">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textleftContent">
                    <div v-for="item in component_style1_News2Array_text_3">
                        <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="textLeft">
                <div class="textLeft_1">
                    <div class="textLeft_1_top" v-for="item in component_style1_News1Array_img_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" alt="">
                            <span>{{ item.title }}</span>
                        </NuxtLink>
                    </div>
                    <div class="textLeft_1_bottom">
                        <div v-for="item in component_style1_News1Array_img_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textLeft_2">
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_1">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                </div>
            </div>
            <div class="textRight">
                <div class="textRightContent">
                    <div class="textRightContent_title">专题报道</div>
                    <div class="textRightContent_content">
                        <div v-for="item in component_style1_News1Array_img_3">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textleftContent">
                    <div v-for="item in component_style1_News2Array_text_3">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent style3" v-if="componentStyle == 3">
            <div class="textLeft">
                <div class="textLeft_2">
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_1">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textLeft_1">
                    <div class="textLeft_1_top" v-for="item in component_style1_News1Array_img_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" alt="">
                            <span>{{ item.title }}</span>
                        </NuxtLink>
                    </div>
                    <div class="textLeft_1_bottom">
                        <div v-for="item in component_style1_News1Array_img_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
            </div>
            <div class="textRight">
                <div class="textRightContent">
                    <div class="textRightContent_title">专题报道</div>
                    <div class="textRightContent_content">
                        <div v-for="item in component_style1_News1Array_img_3">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textleftContent">
                    <div v-for="item in component_style1_News2Array_text_3">
                        <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="textLeft">
                <div class="textLeft_2">
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_1">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                    <div class="textleftContent">
                        <div v-for="item in component_style1_News2Array_text_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                {{ item.title }}
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textLeft_1">
                    <div class="textLeft_1_top" v-for="item in component_style1_News1Array_img_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" alt="">
                            <span>{{ item.title }}</span>
                        </NuxtLink>
                    </div>
                    <div class="textLeft_1_bottom">
                        <div v-for="item in component_style1_News1Array_img_2">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
            </div>
            <div class="textRight">
                <div class="textRightContent">
                    <div class="textRightContent_title">专题报道</div>
                    <div class="textRightContent_content">
                        <div v-for="item in component_style1_News1Array_img_3">
                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                                :target="item.islink == 1 ? '_blank' : '_self'">
                                <img :src="item.imgurl" alt="">
                                <span>{{ item.title }}</span>
                            </NuxtLink>
                        </div>
                    </div>
                </div>
                <div class="textleftContent">
                    <div v-for="item in component_style1_News2Array_text_3">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink: Object,//板块名称
    templateData: Array,//新闻数据
    componentStyle: Number,//样式编号
});

// 新闻数据
const component_style1_News1Array_img_1 = ref([]);
const component_style1_News1Array_img_2 = ref([]);
const component_style1_News1Array_img_3 = ref([]);
const component_style1_News2Array_text_1 = ref([]);
const component_style1_News2Array_text_2 = ref([]);
const component_style1_News2Array_text_3 = ref([]);

component_style1_News1Array_img_1.value = props.templateData.imgnum.slice(0, 1);
component_style1_News1Array_img_2.value = props.templateData.imgnum.slice(1, 3);
component_style1_News1Array_img_3.value = props.templateData.imgnum.slice(3, 5);
component_style1_News2Array_text_1.value = props.templateData.textnum.slice(0, 4);
component_style1_News2Array_text_2.value = props.templateData.textnum.slice(4, 8);
component_style1_News2Array_text_3.value = props.templateData.textnum.slice(8, 12);

</script>

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

    .listNewsTitle {
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        // border-bottom: 1px solid #999999;
        height: 40px;

        div {
            height: 35px;
            width: 138px;
            line-height: 32px;
            font-size: 22px;
            font-weight: bold;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: #154079;
            padding-bottom: 5px;
            background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
        }
    }

    .dashed {
        border-bottom: 1px dashed #999999;
    }

    .listNewsContent {
        margin-top: 20px;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        margin-bottom: 20px;

        // .box1 {


        .textLeft {
            width: 788px;
            height: 416px;
            margin-right: 32px;
            display: flex;
            align-items: flex-start;
            justify-content: flex-start;

            .textLeft_1 {
                width: 380px;
                height: 416px;
                margin-right: 20px;

                .textLeft_1_top {
                    position: relative;
                    width: 380px;
                    height: 268px;
                    margin-bottom: 18px;


                    img {
                        width: 380px;
                        height: 268px;
                    }

                    span {
                        display: inline-block;
                        position: absolute;
                        bottom: 0;
                        left: 0;
                        width: 100%;
                        height: 40px;
                        line-height: 40px;
                        font-size: 16px;
                        font-weight: bold;
                        color: #fff;
                        padding-left: 10px;
                        background-color: #ccc;
                        box-sizing: border-box;
                    }
                }

                .textLeft_1_bottom {
                    width: 380px;
                    height: 130px;
                    display: flex;
                    align-items: flex-start;
                    justify-content: flex-start;

                    div {
                        position: relative;
                        width: 185px;
                        height: 130px;

                        &:first-child {
                            margin-right: 10px;
                        }

                        a {
                            img {
                                width: 185px;
                                height: 130px;
                            }

                            span {
                                display: inline-block;
                                position: absolute;
                                bottom: 0px;
                                left: 0;
                                width: 185px;
                                height: 30px;
                                line-height: 30px;
                                font-size: 14px;
                                font-weight: bold;
                                color: #fff;
                                text-align: center;
                                background-color: #ccc;
                                white-space: nowrap;
                                overflow: hidden;
                                text-overflow: ellipsis;
                                padding: 0 5px;
                                box-sizing: border-box;
                            }
                        }


                    }
                }
            }

            .textLeft_2 {
                width: 378px;
                height: 416px;

                .textleftContent {
                    width: 378px;
                    height: 210px;

                    &:first-child {
                        border-bottom: 1px dashed #ccc;
                        margin-bottom: 30px;
                    }

                    div {
                        font-size: 18px;
                        color: #666666;
                        margin-bottom: 17px;
                        padding-left: 8px;
                        background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;

                        &:first-child {
                            height: 48px;
                            line-height: 24px;
                            font-weight: bold;
                            color: #333333;
                            padding-left: 0;
                            background: none;

                            a {
                                color: #333333;
                            }
                        }

                        &:nth-child(2),
                        &:nth-child(3),
                        &:nth-child(4) {
                            color: #666666;
                            white-space: nowrap;
                            overflow: hidden;
                            text-overflow: ellipsis;

                            a {
                                color: #666666;
                            }
                        }

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


                    }
                }
            }
        }

        .textRight {
            width: 380px;
            height: 417px;

            .textRightContent {
                width: 380px;
                height: 210px;

                &:first-child {
                    border-bottom: 1px dashed #ccc;
                    margin-bottom: 30px;
                }

                .textRightContent_title {
                    font-size: 20px;
                    font-weight: bold;
                    color: #154079;
                    margin-bottom: 23px;
                }

                .textRightContent_content {
                    width: 380px;
                    height: 130px;
                    display: flex;
                    align-items: flex-start;
                    justify-content: flex-start;

                    div {
                        width: 185px;
                        height: 130px;
                        position: relative;

                        a {
                            img {
                                width: 185px;
                                height: 130px;
                            }

                            span {
                                position: absolute;
                                bottom: 0;
                                left: 0;
                                display: inline-block;
                                width: 185px;
                                height: 30px;
                                line-height: 30px;
                                font-size: 14px;
                                font-weight: bold;
                                color: #fff;
                                text-align: center;
                                background-color: #ccc;
                                white-space: nowrap;
                                overflow: hidden;
                                text-overflow: ellipsis;
                                padding: 0 5px;
                                box-sizing: border-box;
                            }
                        }

                        &:first-child {
                            margin-right: 10px;
                        }
                    }
                }
            }

            .textleftContent {
                width: 378px;
                height: 210px;

                &:first-child {
                    border-bottom: 1px dashed #ccc;
                    margin-bottom: 30px;
                }

                div {
                    font-size: 18px;
                    color: #666666;
                    margin-bottom: 17px;
                    padding-left: 8px;
                    background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;

                    &:first-child {
                        height: 48px;
                        line-height: 24px;
                        font-weight: bold;
                        color: #333333;
                        padding-left: 0;
                        background: none;

                        a {
                            color: #333333;
                        }
                    }

                    &:nth-child(2),
                    &:nth-child(3),
                    &:nth-child(4) {
                        color: #666666;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;

                        a {
                            color: #666666;
                        }
                    }

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


                }
            }

        }

        // }
    }

    //样式2
    .style2 {
        .textLeft {
            .textLeft_2 {
                .textleftContent {
                    div {
                        padding-left: 8px;
                        background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
                    }
                }
            }
        }

        .textRight {
            .textleftContent {
                div {
                    padding-left: 8px;
                    background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
                }
            }
        }
    }

    // 样式3
    .style3 {
        .textLeft {
            margin-right: 28px;

            .textLeft_2 {
                margin-right: 30px;
            }

            .textLeft_1 {
                margin-right: 0px;
            }
        }
    }

    // 样式4
    .style4 {
        .textLeft {
            margin-right: 28px;

            .textLeft_2 {
                margin-right: 30px;

                .textleftContent {
                    div {
                        padding-left: 8px;
                        background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
                    }
                }
            }

            .textLeft_1 {
                margin-right: 0px;
            }
        }

        .textRight {
            .textleftContent {
                div {
                    padding-left: 8px;
                    background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
                }
            }
        }
    }
}
</style>