| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <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">
- <div class="leftTop">
- <div class="photo">
- <div v-for="(item, index) in component_style1_News1Array_img_1">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- :target="item.islink == 1 ? '_blank' : '_self'">
- <img :src="item.imgurl" v-if="activeIndex == index">
- </NuxtLink>
- </div>
- </div>
- <div class="text">
- <div v-for="(item, index) in component_style1_News1Array_img_1"
- :class="{ 'active': activeIndex == index }">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- @mouseenter="activeIndex = index" :target="item.islink == 1 ? '_blank' : '_self'">
- {{ item.title }}
- </NuxtLink>
- </div>
- </div>
- </div>
- <div class="leftBottom">
- <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>
- <div class="contentLeft">
- <div class="leftTop">
- <div class="photo">
- <div v-for="(item, index) in component_style1_News1Array_img_2">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- :target="item.islink == 1 ? '_blank' : '_self'">
- <img :src="item.imgurl" v-if="activeIndex1 == index">
- </NuxtLink>
- </div>
- </div>
- <div class="text">
- <div v-for="(item, index) in component_style1_News1Array_img_2"
- :class="{ 'active': activeIndex1 == index }">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- @mouseenter="activeIndex1 = index" :target="item.islink == 1 ? '_blank' : '_self'">
- {{ item.title }}
- </NuxtLink>
- </div>
- </div>
- </div>
- <div class="leftBottom">
- <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>
- </div>
- </div>
- <!--样式2-->
- <div class="listNewsContent style2" v-if="componentStyle == 2">
- <div class="contentLeft">
- <div class="leftTop">
- <div class="photo">
- <div v-for="(item, index) in component_style1_News1Array_img_1">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- :target="item.islink == 1 ? '_blank' : '_self'">
- <img :src="item.imgurl" v-if="activeIndex == index">
- </NuxtLink>
- </div>
- </div>
- <div class="text">
- <div v-for="(item, index) in component_style1_News1Array_img_1"
- :class="{ 'active': activeIndex == index }">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- @mouseenter="activeIndex = index" :target="item.islink == 1 ? '_blank' : '_self'">
- {{ item.title }}
- </NuxtLink>
- </div>
- </div>
- </div>
- <div class="leftBottom">
- <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>
- <div class="contentLeft">
- <div class="leftTop">
- <div class="photo">
- <div v-for="(item, index) in component_style1_News1Array_img_2">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- :target="item.islink == 1 ? '_blank' : '_self'">
- <img :src="item.imgurl" v-if="activeIndex1 == index">
- </NuxtLink>
- </div>
- </div>
- <div class="text">
- <div v-for="(item, index) in component_style1_News1Array_img_2"
- :class="{ 'active': activeIndex1 == index }">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
- @mouseenter="activeIndex1 = index" :target="item.islink == 1 ? '_blank' : '_self'">
- {{ item.title }}
- </NuxtLink>
- </div>
- </div>
- </div>
- <div class="leftBottom">
- <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>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- //引入vue
- import { ref } from 'vue';
- //获得新闻数据
- const props = defineProps({
- titleLink: Object,//板块名称
- templateData: Array,//新闻数据
- componentStyle: Number,//样式编号
- });
- const activeIndex = ref(0);
- const activeIndex1 = ref(0);
- //样式1与样式2共用 start ---------------------------------------->
- const component_style1_News1Array_img_1 = ref([]);
- const component_style1_News1Array_img_2 = ref([]);
- const component_style1_News1Array_text_1 = ref([]);
- const component_style1_News1Array_text_2 = ref([]);
- //真实数据
- // 图文数据
- component_style1_News1Array_img_1.value = props.templateData.imgnum.slice(0, 2);
- component_style1_News1Array_img_2.value = props.templateData.imgnum.slice(2, 4);
- // 文本数据
- component_style1_News1Array_text_1.value = props.templateData.textnum.slice(0, 3);
- component_style1_News1Array_text_2.value = props.templateData.textnum.slice(3, 6);
- //样式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;
- background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
- }
- }
- .listNewsContent {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .contentLeft {
- width: 378px;
- height: 292px;
- .leftTop {
- width: 220px;
- height: 160px;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- margin-bottom: 20px;
- .photo {
- width: 220px;
- height: 160px;
- margin-right: 20px;
- position: relative;
- div {
- a {
- img {
- width: 220px;
- height: 160px;
- position: relative;
- }
- }
- }
- }
- .text {
- div {
- width: 129px;
- height: 72px;
- font-size: 18px;
- color: #333333;
- line-height: 24px;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- &:first-child {
- font-weight: bold;
- margin-bottom: 10px;
- }
- // &.active {
- // a {
- // color: #154079;
- // }
- // }
- a {
- width: 100%;
- height: 100%;
- color: #333333;
- }
- }
- }
- }
- .leftBottom {
- div {
- width: 370px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-size: 18px;
- color: #666666;
- margin-bottom: 22px;
- padding-left: 8px;
- background: url("https://img.bjzxtw.org.cn/pre/image/png/20251203/1764729502583754.png") no-repeat left center;
- &:last-child {
- margin-bottom: 0px;
- }
- a {
- color: #666666;
- }
- }
- }
- }
- }
- }
- </style>
|