<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="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent" v-if="componentStyle == 2">
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent style3" v-if="componentStyle == 3">
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent style4" v-if="componentStyle == 4">
            <div class="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent style5" v-if="componentStyle == 5">
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式6-->
        <div class="listNewsContent style6" v-if="componentStyle == 6">
            <div class="contentMid">
                <div v-for="item in component_style1_News1Array_text_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="contentRight">
                <div v-for="item in component_style1_News1Array_text_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
                <div v-for="item in component_style1_News1Array_text_3">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <span>{{ titleLink.alias }}</span>
                        <em></em>
                        <div class="title">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="contentLeft" 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="">
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
        </div>
    </div>
</template>

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

//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array_img_1 = ref([]);
const component_style1_News1Array_text_1 = ref([]);
const component_style1_News1Array_text_2 = ref([]);
const component_style1_News1Array_text_3 = ref([]);
//真实数据
// 图文数据
component_style1_News1Array_img_1.value = props.templateData.imgnum.slice(0, 1);
// 文本数据
component_style1_News1Array_text_1.value = props.templateData.textnum.slice(0, 6);
component_style1_News1Array_text_2.value = props.templateData.textnum.slice(6, 7);
component_style1_News1Array_text_3.value = props.templateData.textnum.slice(7, 12);

//样式1与样式2共用 end ---------------------------------------->
</script>

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

    .listNewsTitle {
        height: 38px;
        line-height: 38px;
        margin-bottom: 19px;

        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: #154079;
            padding-bottom: 5px;
            background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
        }
    }

    .listNewsContent {
        width: 100%;
        height: 268px;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;

        .contentLeft {
            position: relative;
            width: 380px;
            height: 268px;
            margin-right: 30px;
            cursor: pointer;

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

                div {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    width: 380px;
                    height: 50px;
                    line-height: 50px;
                    color: #fff;
                    font-size: 16px;
                    font-weight: bold;
                    padding-left: 20px;
                    background-color: #ccc;
                    box-sizing: border-box;
                }
            }


        }

        .contentMid {
            width: 378px;
            height: 268px;
            margin-right: 20px;

            div {
                width: 365px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                font-size: 18px;
                color: #666666;
                margin-bottom: 18px;
                padding-left: 8px;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;

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

                    a {
                        color: #333333;
                    }
                }

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

                a {
                    color: #666666;
                }
            }
        }

        .contentRight {
            width: 380px;
            height: 268px;

            div {
                width: 380px;
                color: #333333;
                font-size: 18px;
                margin-bottom: 16px;
                cursor: pointer;

                span {
                    color: #154079;
                }

                em {
                    display: inline-block;
                    width: 2px;
                    height: 14px;
                    margin: 0 15px;
                    background-color: #d3d5d8;
                }

                &:nth-child(1) {
                    height: 48px;
                    line-height: 24px;
                    font-weight: bold;
                    color: #333333;
                    font-weight: bold;

                    a {
                        color: #333333;
                    }
                }

                .title {
                    display: inline-block;
                    width: 255px;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    vertical-align: -5px;
                }

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

    //样式3
    .style3,
    .style6 {
        .contentLeft {
            margin-right: 0px;
        }

        .contentRight {
            margin-right: 30px;
        }
    }

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