1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
  5. <div>{{ titleLink.alias }}</div>
  6. </NuxtLink>
  7. </div>
  8. <!--样式1-->
  9. <div class="listNewsContent" v-if="componentStyle == 1">
  10. <div class="contentLeft">
  11. <div class="leftTop">
  12. <div class="photo">
  13. <div v-for="(item, index) in component_style1_News1Array_img_1">
  14. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  15. :target="item.islink == 1 ? '_blank' : '_self'">
  16. <img :src="item.imgurl" v-if="activeIndex == index">
  17. </NuxtLink>
  18. </div>
  19. </div>
  20. <div class="text">
  21. <div v-for="(item, index) in component_style1_News1Array_img_1"
  22. :class="{ 'active': activeIndex == index }">
  23. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  24. @mouseenter="activeIndex = index" :target="item.islink == 1 ? '_blank' : '_self'">
  25. {{ item.title }}
  26. </NuxtLink>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="leftBottom">
  31. <div v-for="item in component_style1_News1Array_text_1">
  32. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  33. :target="item.islink == 1 ? '_blank' : '_self'">
  34. {{ item.title }}
  35. </NuxtLink>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="contentLeft">
  40. <div class="leftTop">
  41. <div class="photo">
  42. <div v-for="(item, index) in component_style1_News1Array_img_2">
  43. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  44. :target="item.islink == 1 ? '_blank' : '_self'">
  45. <img :src="item.imgurl" v-if="activeIndex1 == index">
  46. </NuxtLink>
  47. </div>
  48. </div>
  49. <div class="text">
  50. <div v-for="(item, index) in component_style1_News1Array_img_2"
  51. :class="{ 'active': activeIndex1 == index }">
  52. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  53. @mouseenter="activeIndex1 = index" :target="item.islink == 1 ? '_blank' : '_self'">
  54. {{ item.title }}
  55. </NuxtLink>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="leftBottom">
  60. <div v-for="item in component_style1_News1Array_text_2">
  61. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  62. :target="item.islink == 1 ? '_blank' : '_self'">
  63. {{ item.title }}
  64. </NuxtLink>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <!--样式2-->
  70. <div class="listNewsContent style2" v-if="componentStyle == 2">
  71. <div class="contentLeft">
  72. <div class="leftTop">
  73. <div class="photo">
  74. <div v-for="(item, index) in component_style1_News1Array_img_1">
  75. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  76. :target="item.islink == 1 ? '_blank' : '_self'">
  77. <img :src="item.imgurl" v-if="activeIndex == index">
  78. </NuxtLink>
  79. </div>
  80. </div>
  81. <div class="text">
  82. <div v-for="(item, index) in component_style1_News1Array_img_1"
  83. :class="{ 'active': activeIndex == index }">
  84. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  85. @mouseenter="activeIndex = index" :target="item.islink == 1 ? '_blank' : '_self'">
  86. {{ item.title }}
  87. </NuxtLink>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="leftBottom">
  92. <div v-for="item in component_style1_News1Array_text_1">
  93. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  94. :target="item.islink == 1 ? '_blank' : '_self'">
  95. {{ item.title }}
  96. </NuxtLink>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="contentLeft">
  101. <div class="leftTop">
  102. <div class="photo">
  103. <div v-for="(item, index) in component_style1_News1Array_img_2">
  104. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  105. :target="item.islink == 1 ? '_blank' : '_self'">
  106. <img :src="item.imgurl" v-if="activeIndex1 == index">
  107. </NuxtLink>
  108. </div>
  109. </div>
  110. <div class="text">
  111. <div v-for="(item, index) in component_style1_News1Array_img_2"
  112. :class="{ 'active': activeIndex1 == index }">
  113. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  114. @mouseenter="activeIndex1 = index" :target="item.islink == 1 ? '_blank' : '_self'">
  115. {{ item.title }}
  116. </NuxtLink>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="leftBottom">
  121. <div v-for="item in component_style1_News1Array_text_2">
  122. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  123. :target="item.islink == 1 ? '_blank' : '_self'">
  124. {{ item.title }}
  125. </NuxtLink>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </template>
  132. <script setup>
  133. //引入vue
  134. import { ref } from 'vue';
  135. //获得新闻数据
  136. const props = defineProps({
  137. titleLink: Object,//板块名称
  138. templateData: Array,//新闻数据
  139. componentStyle: Number,//样式编号
  140. });
  141. const activeIndex = ref(0);
  142. const activeIndex1 = ref(0);
  143. //样式1与样式2共用 start ---------------------------------------->
  144. const component_style1_News1Array_img_1 = ref([]);
  145. const component_style1_News1Array_img_2 = ref([]);
  146. const component_style1_News1Array_text_1 = ref([]);
  147. const component_style1_News1Array_text_2 = ref([]);
  148. //真实数据
  149. // 图文数据
  150. component_style1_News1Array_img_1.value = props.templateData.imgnum.slice(0, 2);
  151. component_style1_News1Array_img_2.value = props.templateData.imgnum.slice(2, 4);
  152. // 文本数据
  153. component_style1_News1Array_text_1.value = props.templateData.textnum.slice(0, 3);
  154. component_style1_News1Array_text_2.value = props.templateData.textnum.slice(3, 6);
  155. //样式1与样式2共用 end ---------------------------------------->
  156. </script>
  157. <style lang="less" scoped>
  158. //基本样式 start ---------------------------------------->
  159. .listNewsBox {
  160. position: relative;
  161. .listNewsTitle {
  162. height: 38px;
  163. line-height: 38px;
  164. margin-bottom: 19px;
  165. div {
  166. height: 35px;
  167. width: 138px;
  168. line-height: 32px;
  169. font-size: 22px;
  170. font-weight: bold;
  171. color: #333333;
  172. cursor: pointer;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. white-space: nowrap;
  176. color: #154079;
  177. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  178. }
  179. }
  180. .listNewsContent {
  181. display: flex;
  182. align-items: center;
  183. justify-content: space-between;
  184. .contentLeft {
  185. width: 378px;
  186. height: 292px;
  187. .leftTop {
  188. width: 220px;
  189. height: 160px;
  190. position: relative;
  191. display: flex;
  192. align-items: center;
  193. justify-content: flex-start;
  194. margin-bottom: 20px;
  195. .photo {
  196. width: 220px;
  197. height: 160px;
  198. margin-right: 20px;
  199. position: relative;
  200. div {
  201. a {
  202. img {
  203. width: 220px;
  204. height: 160px;
  205. position: relative;
  206. }
  207. }
  208. }
  209. }
  210. .text {
  211. div {
  212. width: 129px;
  213. height: 72px;
  214. font-size: 18px;
  215. color: #333333;
  216. line-height: 24px;
  217. display: -webkit-box;
  218. -webkit-box-orient: vertical;
  219. -webkit-line-clamp: 3;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. word-break: break-all;
  223. &:first-child {
  224. font-weight: bold;
  225. margin-bottom: 10px;
  226. }
  227. // &.active {
  228. // a {
  229. // color: #154079;
  230. // }
  231. // }
  232. a {
  233. width: 100%;
  234. height: 100%;
  235. color: #333333;
  236. }
  237. }
  238. }
  239. }
  240. .leftBottom {
  241. div {
  242. width: 370px;
  243. white-space: nowrap;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. font-size: 18px;
  247. color: #666666;
  248. margin-bottom: 22px;
  249. padding-left: 8px;
  250. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251203/1764729502583754.png") no-repeat left center;
  251. &:last-child {
  252. margin-bottom: 0px;
  253. }
  254. a {
  255. color: #666666;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. </style>