<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="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent style2" v-if="componentStyle == 2">
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent style3" v-if="componentStyle == 3">
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent style4" v-if="componentStyle == 4">
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent style5" v-if="componentStyle == 5">
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式6-->
        <div class="listNewsContent style6" v-if="componentStyle == 6">
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式7-->
        <div class="listNewsContent style7" v-if="componentStyle == 7">
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式8-->
        <div class="listNewsContent style8" v-if="componentStyle == 8">
            <div class="text">
                <div v-for="item in component_style1_News1Array_text">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="photo">
                <div v-for="item in component_style1_News1Array_img">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" :alt="item.title">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </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 = ref([]);
const component_style1_News1Array_text = ref([]);
//真实数据
component_style1_News1Array_img.value = props.templateData.imgnum.slice(0, 2);
component_style1_News1Array_text.value = props.templateData.textnum.slice(0, 3);

//样式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%;
        box-sizing: border-box;

        .photo {
            width: 378px;
            height: 130px;
            display: flex;
            justify-content: space-between;
            margin-bottom: 26px;

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

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

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

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

                a {
                    color: #666666;
                }
            }
        }
    }

    // 样式2
    .style2 {
        .text {
            margin-bottom: 24px;
        }

        .photo {
            margin-bottom: 0;
        }
    }

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

    // 样式4
    .style4 {
        .text {
            margin-bottom: 24px;

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

        .photo {
            margin-bottom: 0;
        }
    }

    // 样式5
    .style5 {
        .text {
            div {
                &:first-child {
                    font-weight: bold;
                }
            }
        }
    }

    // 样式6
    .style6 {
        .text {
            margin-bottom: 24px;

            div {
                &:first-child {
                    font-weight: bold;
                }
            }
        }

        .photo {
            margin-bottom: 0;
        }
    }

    // 样式7
    .style7 {
        .text {
            div {
                padding-left: 8px;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;

                &:first-child {
                    font-weight: bold;
                }
            }
        }
    }

    // 样式8
    .style8 {
        .text {
            margin-bottom: 24px;

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

                &:first-child {
                    font-weight: bold;
                }
            }
        }

        .photo {
            margin-bottom: 0;
        }
    }
}

//基本样式 end ----------------------------------------></style>