<template>
    <div class="listNewsBox">
        <div class="listNewsTitle">
            <NuxtLink
                v-if="titleLink.cid"
                :href="getLinkPath(titleLink)"
                :title="titleLink.alias"
            >
                {{titleLink.alias}}
            </NuxtLink>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle==1">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsUl">
                    <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent listNewsStyle2" v-if="componentStyle==2">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsUl">
                    <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent listNewsStyle3" v-if="componentStyle==3">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsUl">
                    <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent listNewsStyle4" v-if="componentStyle==4">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsUl">
                   <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent listNewsStyle2 listNewsStyle4" v-if="componentStyle==5">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsUl">
                    <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemContent">
                                <div class="listNewsImgNewsItemTitle">
                                    {{ item.title }}
                                </div>
                            </div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
            </div>
        </div>
        <!--样式6-->
        <div class="listNewsContent listNewsStyle3 listNewsStyle4" v-if="componentStyle==6">
            <div class="listNewsContentLeft">
                <div class="listNewsImgNewsUl">
                    <div class="listNewsImgNewsLi" v-for="item in component_style1_News3">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <div class="listNewsImgNewsMark">
                                <div>重 点</div>
                                <div>关 注</div>
                            </div>
                            <div class="listNewsImgNewsTitle">{{ item.title }}</div>
                        </NuxtLink>
                    </div>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
            <div class="listNewsContentRight">
                <div class="adBox">
                    <!-- 广告模块 -->
                    <a :href="templateAdData.ad_url" v-if="templateAdData.image_url==null" target="_blank" :title="templateAdData.introduce">
                        <img :src="templateAdData.thumb" :alt="templateAdData.introduce" :id="templateAdData.ad_tag"  data-tag="templateAdData.ad_tag">
                    </a>
                    <a :href="templateAdData.image_url" v-else :title="templateAdData.introduce">
                        <img :src="templateAdData.image_src" :alt="templateAdData.introduce" :id="templateAdData.ad_tag" data-tag="templateAdData.ad_tag">
                    </a>
                </div>
                <div class="listNewsImgNewsBox">
                    <div v-for="item in component_style1_News1Array_2" class="listNewsImgNewsItem">
                        <NuxtLink 
                            :href="getLinkPathDetail(item)" 
                            :title="item.title"
                            :target="item.islink == 1 ? '_blank' : '_self'"
                        >
                            <img :src="item.imgurl" />
                            <div class="listNewsImgNewsItemTitle">
                                {{ item.title }}
                            </div>
                        </NuxtLink>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import {ref} from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink:Object,//板块名称
    templateData:Array,//新闻数据
    componentStyle:Number,//样式编号
    templateAdData:Object,//广告
});
//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array = ref({});
component_style1_News1Array.value = props.templateData.imgnum.slice(0,2);
const component_style1_News1Array_2 = ref({});
component_style1_News1Array_2.value = props.templateData.imgnum.slice(2,3);
const component_style1_News3 = ref({});
component_style1_News3.value = props.templateData.textnum.slice(0,4);
//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.listNewsBox {
    width: 1200px;
    height: 480px;
    position: relative;
    .listNewsTitle {
        font-size:22px;
        font-weight:bold;
        height: 40px;
        line-height: 40px;
        border-bottom: 2px solid #004564;
        color:#004564;
        margin-bottom: 20px;
        box-sizing: border-box;
        a {
            color:#004564;
            display: block;
            height: 25px;
            line-height: 25px;
        }
    }
    .listNewsContent {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        .listNewsContentLeft {
            width: 720px;
            height: 420px;
            .listNewsImgNewsBox {
                width: 720px;
                height: 110px;
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                margin-bottom: 20px;   
                .listNewsImgNewsItem {
                    a {
                        display: flex;
                        height: 110px;
                        width: 350px;
                        background: #F9FAFB;
                        align-items: flex-start;
                        justify-content: space-between;      
                    }
                    .listNewsImgNewsItemContent {
                        padding: 30px 8px;
                    }
                    .listNewsImgNewsItemTitle {
                        color: #333333;
                        font-size: 18px;
                        box-sizing: border-box;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box;
                        line-clamp: 2;
                        -webkit-line-clamp: 2;
                        -webkit-box-orient: vertical;
                    }
                    img {
                        display: block;
                        width: 170px;
                        height: 110px;
                    }
                }
            }
            .listNewsImgNewsUl {
                .listNewsImgNewsLi {
                    width: 720px;
                    height: 62px;
                    background: #F9FAFB;
                    display: flex;
                    margin-bottom: 14px;
                    a {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                    }
                    .listNewsImgNewsMark {
                        background: #004564;
                        color: #fff;
                        width: 50px;
                        height: 62px;
                        box-sizing: border-box;
                        padding: 12px 10px;
                        font-size: 12px;
                        font-weight: bold;
                        margin-right: 10px;
                        div {
                            margin-bottom: 5px;
                            &:last-child {
                                margin-bottom: 0;
                            }
                        }
                    }
                    .listNewsImgNewsMark_skin2 {
                        background: #A91B33;
                        color: #fff;
                        width: 50px;
                        height: 62px;
                        box-sizing: border-box;
                        padding: 15px 10px;
                        font-size: 12px;
                        font-weight: bold;
                        margin-right: 10px;
                        div {
                            margin-bottom: 5px;
                            &:last-child {
                                margin-bottom: 0;
                            }
                        }
                    }
                    .listNewsImgNewsTitle {
                        flex:1;
                        color:#333;
                        font-size: 18px;
                        height: 62px;
                        line-height: 62px;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                    }
                    &:first-child {
                        .listNewsImgNewsTitle {
                            font-weight: bold;
                        }
                    }
                    &:last-child {
                        margin-bottom: 0;
                    }
                }
            }
        }
        .listNewsContentRight {
            width: 450px;
            height: 420px;
            .listNewsImgNewsBox {
                margin-bottom: 20px;
                .listNewsImgNewsItem {
                    a {
                        display: flex;
                        height: 110px;
                        width: 450px;
                        background: #F9FAFB;
                        align-items: flex-start;
                        justify-content: space-between;      
                    }
                    .listNewsImgNewsItemContent {
                        padding: 30px 8px;
                    }
                    .listNewsImgNewsItemTitle {
                        color: #333333;
                        font-size: 18px;
                        box-sizing: border-box;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box;
                        line-clamp: 2;
                        -webkit-line-clamp: 2;
                        -webkit-box-orient: vertical;
                    }
                    img {
                        display: block;
                        width: 170px;
                        height: 110px;
                    }
                }
            }
            .adBox {
                box-sizing: border-box;
                position: relative;
                img {
                    display: block;
                    width: 450px;
                    height: 290px;
                }
                .templateEditBtnBox {
                    right: 0;
                }
            }
        }
    }
}
//基本样式 end ---------------------------------------->

//样式2 start ---------------------------------------->
.listNewsBox {
    .listNewsStyle2 {
        .listNewsContentLeft {
            .listNewsImgNewsBox {
                margin-bottom: 0;
                margin-top: 20px;
            }
        }
    }
}
//样式2 end ---------------------------------------->
//样式3 start ---------------------------------------->
.listNewsBox {
    .listNewsStyle3 {
        .listNewsContentLeft {
            .listNewsImgNewsBox {
                margin-bottom: 0;
                margin-top: 20px;
            }
        }
        .listNewsContentRight {
            .adBox {
                margin-bottom: 20px;
                margin-top: 0;
            }
        }
    }
}
//样式3 end ---------------------------------------->
//样式4 start ---------------------------------------->
.listNewsBox {
    .listNewsStyle4 {
        .listNewsContentLeft {
            .listNewsImgNewsUl {
                .listNewsImgNewsLi {

                    &:first-child {
                        .listNewsImgNewsTitle {
                            font-weight: 400;
                        }
                    }
                }
            }
        }
    }
}
//样式4 end ---------------------------------------->
</style>