1.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle" v-if="skinId=='1'">
  4. <NuxtLink
  5. v-if="titleLink.cid"
  6. :href="getLinkPath(titleLink)"
  7. :title="titleLink.alias"
  8. >
  9. {{titleLink.alias}}
  10. </NuxtLink>
  11. </div>
  12. <div class="listNewsTitle_skin2" v-if="skinId=='2'">
  13. <span>
  14. <NuxtLink
  15. v-if="titleLink.cid"
  16. :href="getLinkPath(titleLink)"
  17. :title="titleLink.alias"
  18. >
  19. {{titleLink.alias}}
  20. </NuxtLink>
  21. </span>
  22. </div>
  23. <div class="listNewsContent">
  24. <div class="listNewsContentLeft">
  25. <div class="listNewsContentLeftTop">
  26. <NuxtLink
  27. :href="getLinkPathDetail(item)"
  28. :title="item.title"
  29. :target="item.islink == 1 ? '_blank' : '_self'"
  30. v-for="item in component_style1_News1Array"
  31. >
  32. <img :src="item.imgurl" />
  33. <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
  34. </NuxtLink>
  35. </div>
  36. <div class="listNewsContentLeftBottom">
  37. <div v-for="item in component_style1_News1Array_2">
  38. <NuxtLink
  39. :href="getLinkPathDetail(item)"
  40. :title="item.title"
  41. :target="item.islink == 1 ? '_blank' : '_self'"
  42. >
  43. <img :src="item.imgurl" />
  44. <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
  45. </NuxtLink>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="listNewsContentRight">
  50. <div v-for="item in component_style1_News2Array">
  51. <NuxtLink
  52. :href="getLinkPathDetail(item)"
  53. :title="item.title"
  54. :target="item.islink == 1 ? '_blank' : '_self'"
  55. >
  56. {{ item.title }}
  57. </NuxtLink>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script setup>
  64. //引入vue
  65. import {ref} from 'vue';
  66. //获得新闻数据
  67. const props = defineProps({
  68. titleLink:Object,//板块名称
  69. templateData:Array,//新闻数据
  70. skinId:String,//皮肤id
  71. });
  72. //样式1与样式2共用 start ---------------------------------------->
  73. const component_style1_News1Array = ref({});
  74. const component_style1_News1Array_2 = ref({});
  75. const component_style1_News2Array = ref([]);
  76. //真实数据
  77. component_style1_News1Array.value = props.templateData.imgnum.slice(0,1);
  78. component_style1_News1Array_2.value = props.templateData.imgnum.slice(1,3);
  79. component_style1_News2Array.value = props.templateData.textnum;
  80. //样式1与样式2共用 end ---------------------------------------->
  81. </script>
  82. <style lang="less" scoped>
  83. // 样式1 start ---------------------------------------->
  84. .listNewsBox {
  85. position: relative;
  86. .listNewsTitle {
  87. font-size:22px;
  88. font-weight:bold;
  89. height: 40px;
  90. line-height: 40px;
  91. border-bottom: 2px solid #004564;
  92. color:#004564;
  93. margin-bottom: 20px;
  94. box-sizing: border-box;
  95. a {
  96. color:#004564;
  97. display: block;
  98. height: 25px;
  99. line-height: 25px;
  100. }
  101. }
  102. // 样式2 start ---------------------------------------->
  103. .listNewsTitle_skin2 {
  104. font-size:22px;
  105. font-weight:bold;
  106. height: 40px;
  107. line-height: 40px;
  108. border-bottom: 2px solid #A91B33;
  109. color:#A91B33;
  110. margin-bottom: 20px;
  111. box-sizing: border-box;
  112. a {
  113. color:#A91B33;
  114. display: block;
  115. height: 25px;
  116. line-height: 25px;
  117. }
  118. span {
  119. color:#A91B33;
  120. height: 25px;
  121. line-height: 25px;
  122. border-left: 3px solid #A91B33;
  123. padding-left: 12px;
  124. display: block;
  125. }
  126. }
  127. // 样式2 end ---------------------------------------->
  128. .listNewsContent {
  129. display: flex;
  130. align-items: center;
  131. justify-content: space-between;
  132. .listNewsContentLeft {
  133. width: 350px;
  134. height: 380px;
  135. img {
  136. display: block;
  137. }
  138. .listNewsContentLeftTop {
  139. margin-bottom: 20px;
  140. position: relative;
  141. img {
  142. display: block;
  143. width: 350px;
  144. height: 245px;
  145. }
  146. }
  147. .listNewsContentLeftBottom {
  148. display: flex;
  149. align-items: center;
  150. justify-content: space-between;
  151. position: relative;
  152. &>div {
  153. position: relative;
  154. }
  155. img {
  156. width: 170px;
  157. height: 110px;
  158. }
  159. }
  160. .listNewsContentLeftTopTitle {
  161. position: absolute;
  162. bottom:0;
  163. z-index:1;
  164. width: 100%;
  165. color:#fff;
  166. height: 50px;
  167. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  168. overflow: hidden;
  169. text-overflow: ellipsis;
  170. white-space: nowrap;
  171. line-height: 65px;
  172. box-sizing: border-box;
  173. padding:0 8px;
  174. }
  175. }
  176. .listNewsContentRight {
  177. width: 350px;
  178. height: 380px;
  179. div {
  180. padding-left: 16px;
  181. box-sizing: border-box;
  182. background: url('http://img.bjzxtw.org.cn/pre/image/png/20250605/1749100871349444.png') no-repeat left center;
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. white-space: nowrap;
  186. margin-bottom: 20px;
  187. height: 24px;
  188. line-height: 24px;
  189. font-size: 18px;
  190. display: block;
  191. &:last-child {
  192. margin-bottom: 0;
  193. }
  194. &:first-child,&:nth-child(4),&:nth-child(7) {
  195. color:#333333;
  196. font-weight: bold;
  197. }
  198. a {
  199. color:#333333;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. // 样式1 end ---------------------------------------->
  206. </style>