<template>
    <div class="listNewsBox">
        <div class="listNewsTitle_skin3">
            <span>
                <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                    {{ titleLink.alias }}
                </NuxtLink>
            </span>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle == 1">
            <div class="listNewsContentTop">
                <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentBottom">
                <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent listNewsStyle2" v-if="componentStyle == 2">
            <div class="listNewsContentBottomBox">
                <div class="listNewsContentBottom">
                    <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentTop">
                <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!-- 样式3 -->
        <div class="listNewsStyle3" v-if="componentStyle == 3">
            <div class="listNewsContent_left">
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContent_right">
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!-- 样式4 -->
        <div class="listNewsStyle3 listNewsStyle4" v-if="componentStyle == 4">
            <div class="listNewsContent_left">
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContent_right">
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!-- 样式5 -->
        <div class="listNewsContent listNewsStyle5" v-if="componentStyle == 5">
            <div class="listNewsContentTop">
                <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentBottom">
                <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!-- 样式6 -->
        <div class="listNewsContent listNewsStyle6" v-if="componentStyle == 6">
            <div class="listNewsContentBottom">
                <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentTop">
                <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!-- 样式7 -->
        <div class="listNewsStyle3 listNewsStyle7" v-if="componentStyle == 7">
            <div class="listNewsContent_left">
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContent_right">
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!-- 样式8 -->
        <div class="listNewsStyle3 listNewsStyle8" v-if="componentStyle == 8">
            <div class="listNewsContent_left">
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContent_right">
                <div class="listNewsContent_leftTop">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            <img :src="item.imgurl" />
                            <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContent_leftBottom">
                    <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
                        <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,//样式编号
});

//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array = ref({});
const component_style1_News1Array_1 = ref({});
const component_style1_News1Array_2 = ref({});
const component_style1_News2Array = ref([]);
const component_style1_News2Array_1 = ref([]);
const component_style1_News2Array_2 = ref([]);
component_style1_News1Array.value = props.templateData.imgnum.slice(0, 2);
component_style1_News1Array_1.value = props.templateData.imgnum.slice(0, 1);
component_style1_News1Array_2.value = props.templateData.imgnum.slice(1, 2);
component_style1_News2Array.value = props.templateData.textnum;
component_style1_News2Array_1.value = props.templateData.textnum.slice(0, 6);
component_style1_News2Array_2.value = props.templateData.textnum.slice(6, 12);
//样式1与样式2共用 end ---------------------------------------->
</script>

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

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

    .listNewsContent {
        .listNewsContentTop {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            height: 110px;

            .listNewsContentTopItem {
                width: 350px;
                height: 110px;

                a {
                    display: block;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                }

                img {
                    display: block;
                    width: 170px;
                    height: 110px;
                }

                .listNewsContentTopItemTitle {
                    font-size: 18px;
                    color: #333333;
                    margin-left: 8px;
                    margin-right: 8px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 3;
                }
            }
        }

        .listNewsContentBottom {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            justify-content: space-between;

            div {
                width: 350px;
                height: 24px;
                line-height: 24px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                margin-bottom: 20px;

                &:nth-last-child(-n+2) {
                    margin-bottom: 0;
                }

                &:nth-child(1),
                &:nth-child(2),
                &:nth-child(7),
                &:nth-child(8) {
                    font-weight: bold;
                }

                a {
                    font-size: 18px;
                    color: #333333;
                }
            }
        }
    }
}

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

//样式2 start ---------------------------------------->
.listNewsStyle2 {
    .listNewsContentTop {
        margin-bottom: 0;
        margin-top: 20px;
    }
}

//样式2 end ---------------------------------------->
//样式3
.listNewsBox {
    .listNewsStyle3 {
        display: flex;

        .listNewsContent_left {
            width: 350px;
            height: 440px;
            margin-right: 20px;

            .listNewsContent_leftTop {
                width: 350px;
                height: 110px;
                margin-bottom: 20px;

                .listNewsContentTopItem {
                    width: 350px;
                    height: 110px;
                    background-color: #f9fafb;

                    a {
                        display: flex;
                        align-items: center;
                        justify-content: space-between;

                        img {
                            display: block;
                            width: 170px;
                            height: 110px;
                        }

                        .listNewsContentTopItemTitle {
                            font-size: 18px;
                            color: #333333;
                            margin-left: 8px;
                            margin-right: 8px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: -webkit-box;
                            -webkit-box-orient: vertical;
                            -webkit-line-clamp: 3;
                        }
                    }
                }
            }

            .listNewsContent_leftBottom {
                width: 350px;

                div {
                    width: 350px;
                    height: 24px;
                    line-height: 24px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    font-size: 18px;
                    margin-bottom: 20px;
                    color: #333333;

                    a {
                        color: #333333;
                    }

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: bold;
                    }

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

        .listNewsContent_right {
            width: 350px;
            height: 440px;

            .listNewsContent_leftTop {
                width: 350px;
                height: 110px;

                .listNewsContentTopItem {
                    width: 350px;
                    height: 110px;
                    background-color: #f9fafb;

                    a {
                        display: flex;
                        align-items: center;
                        justify-content: space-between;

                        img {
                            display: block;
                            width: 170px;
                            height: 110px;
                        }

                        .listNewsContentTopItemTitle {
                            font-size: 18px;
                            color: #333333;
                            margin-left: 8px;
                            margin-right: 8px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: -webkit-box;
                            -webkit-box-orient: vertical;
                            -webkit-line-clamp: 3;
                        }
                    }

                }
            }

            .listNewsContent_leftBottom {
                width: 350px;
                margin-bottom: 20px;

                div {
                    width: 350px;
                    height: 24px;
                    line-height: 24px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    font-size: 18px;
                    margin-bottom: 20px;
                    color: #333333;

                    a {
                        color: #333333;
                    }

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: bold;
                    }

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

//样式4
.listNewsBox {
    .listNewsStyle4 {
        display: flex;

        .listNewsContent_left {
            .listNewsContent_leftBottom {
                margin-bottom: 20px;
            }

            .listNewsContent_leftTop {
                margin-bottom: 0px;
            }
        }

        .listNewsContent_right {
            .listNewsContent_leftBottom {
                margin-bottom: 0px;
            }

            .listNewsContent_leftTop {
                margin-bottom: 20px;
            }
        }
    }
}

// 样式5
.listNewsBox {
    .listNewsStyle5 {
        .listNewsContentBottom {
            div {

                &:nth-child(1),
                &:nth-child(2),
                &:nth-child(7),
                &:nth-child(8) {
                    font-weight: 400;
                }
            }
        }
    }
}

// 样式6
.listNewsBox {
    .listNewsStyle6 {
        .listNewsContentBottom {
            div {

                &:nth-child(1),
                &:nth-child(2),
                &:nth-child(7),
                &:nth-child(8) {
                    font-weight: 400;
                }
            }
        }

        .listNewsContentTop {
            margin-top: 20px;

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

// 样式7
.listNewsBox {
    .listNewsStyle7 {
        .listNewsContent_left {
            .listNewsContent_leftBottom {
                div {

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: 400;
                    }
                }
            }
        }

        .listNewsContent_right {
            .listNewsContent_leftBottom {
                div {

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: 400;
                    }
                }
            }
        }
    }
}

//样式8
.listNewsBox {
    .listNewsStyle8 {
        display: flex;

        .listNewsContent_left {
            .listNewsContent_leftBottom {
                margin-bottom: 20px;

                div {

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: 400;
                    }
                }
            }

            .listNewsContent_leftTop {
                margin-bottom: 0px;
            }
        }

        .listNewsContent_right {
            .listNewsContent_leftBottom {
                margin-bottom: 0px;

                div {

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: 400;
                    }
                }
            }

            .listNewsContent_leftTop {
                margin-bottom: 20px;
            }
        }
    }
}
</style>