<template>
    <div class="listNewsBox">
        <div class="listNewsTitle_skin2">
            <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 class="listNewsContentLeftTop" v-for="item in component_style1_News1Array">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentBottom">
                <div v-for="item in component_style1_News2Array">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        {{ item.title }}
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent" v-if="componentStyle==2">
            <div class="listNewsBigContentBottom">
                <div class="listNewsContentBottom">
                    <div v-for="item in component_style1_News2Array">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentTop">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array">
                    <NuxtLink 
                        :href="getLinkPathDetail(item)" 
                        :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'"
                    >
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent_style listNewsStyle3" v-if="componentStyle == 3">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent_style listNewsStyle4" v-if="componentStyle == 4">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent_style listNewsStyle5" v-if="componentStyle == 5">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式6-->
        <div class="listNewsContent_style listNewsStyle6 listNewsStyle5" v-if="componentStyle == 6">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
        </div>
        <!--样式7-->
        <div class="listNewsContent_style listNewsStyle3 listNewsStyle5" v-if="componentStyle == 7">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式8-->
        <div class="listNewsContent_style listNewsStyle4 listNewsStyle5" v-if="componentStyle == 8">
            <div class="listNewsContentLeft">
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </NuxtLink>
                </div>
                <div class="listNewsContentLeftBottom">
                    <div v-for="item in component_style1_News2Array_1">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsContentRightBottom">
                    <div v-for="item in component_style1_News2Array_2">
                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'">
                            {{ item.title }}
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array_2">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" />
                        <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
                    </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 = 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, 7);
component_style1_News2Array_2.value = props.templateData.textnum.slice(7, 14);
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
// 样式1,2基本样式
.listNewsBox {
    position: relative;
    .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;
        }
    }
    .listNewsContent {
        .listNewsContentTop {
            width: 720px;
            height: 245px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            .listNewsContentLeftTop {
                position: relative;
                img {
                    width: 350px;
                    height: 245px;
                    display: block;
                }
                .listNewsContentLeftTopTitle {
                    position: absolute;
                    bottom: 0;
                    z-index: 1;
                    width: 100%;
                    color: #fff;
                    height: 44px;
                    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
                    box-sizing: border-box;
                    padding: 0 10px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    line-height: 44px;
                    font-size: 18px;
                }
            }
        }
        .listNewsBigContentBottom {
            height: 295px;
            margin-bottom: 20px;
        }
        .listNewsContentBottom {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            div {
                color:#333333;
                font-size:18px;
                line-height: 24px;
                height: 24px;
                margin-bottom: 20px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                width: 345px;
                &:last-child {
                    margin-bottom: 0;
                }
                &:nth-child(1),&:nth-child(2),&:nth-child(7),&:nth-child(8){
                    font-weight: bold;
                }
                a {
                    color:#333333;
                }
            }
        }
    }
}
// 样式3至样式8基本样式
.listNewsContent_style {
    display: flex;
    justify-content: space-between;

    .listNewsContentLeft,
    .listNewsContentRight {
        width: 350px;
        height: 560px;

        .listNewsContentLeftTop {
            position: relative;
            margin-bottom: 20px;

            img {
                width: 350px;
                height: 247px;
                display: block;
            }

            .listNewsContentLeftTopTitle {
                position: absolute;
                bottom: 0;
                z-index: 1;
                width: 100%;
                color: #fff;
                height: 44px;
                background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
                box-sizing: border-box;
                padding: 0 10px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                line-height: 44px;
                font-size: 18px;
            }
        }

        .listNewsContentLeftBottom,
        .listNewsContentRightBottom {
            div {
                color: #333333;
                font-size: 18px;
                line-height: 25px;
                height: 25px;
                margin-bottom: 20px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;

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

                &:nth-child(1),
                &:nth-child(4) {
                    font-weight: bold;
                }
                a{
                    color: #333333;
                }
            }
        }
    }
}
//基本样式 end ---------------------------------------->
//样式3
.listNewsStyle3 {
    .listNewsContentLeft {
        .listNewsContentLeftBottom {
            margin-bottom: 20px;
        }
    }
}

//样式4
.listNewsStyle4 {
    .listNewsContentRight {
        .listNewsContentRightBottom {
            margin-bottom: 20px;
        }
    }
}

//样式5
.listNewsBox {
    .listNewsStyle5 {
        .listNewsContentLeft {
            .listNewsContentLeftBottom {
                div {

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

        .listNewsContentRight {
            .listNewsContentRightBottom {
                div {

                    &:nth-child(1),
                    &:nth-child(4) {
                        font-weight: 400;
                    }
                }
            }
        }
    }
}
//样式6
.listNewsStyle6 {
    .listNewsContentLeft,.listNewsContentRight {
        .listNewsContentLeftTop {
            margin-top: 20px;
        }
    }
}
</style>