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. component_style1_News1Array.value = props.templateData.img.slice(0,1);
  77. component_style1_News1Array_2.value = props.templateData.img.slice(1,3);
  78. component_style1_News2Array.value = props.templateData.text;
  79. //样式1与样式2共用 end ---------------------------------------->
  80. </script>
  81. <style lang="less" scoped>
  82. // 样式1 start ---------------------------------------->
  83. .listNewsBox {
  84. position: relative;
  85. .listNewsTitle {
  86. font-size:22px;
  87. font-weight:bold;
  88. height: 40px;
  89. line-height: 40px;
  90. border-bottom: 2px solid #004564;
  91. color:#004564;
  92. margin-bottom: 20px;
  93. box-sizing: border-box;
  94. a {
  95. color:#004564;
  96. display: block;
  97. height: 25px;
  98. line-height: 25px;
  99. }
  100. }
  101. // 样式2 start ---------------------------------------->
  102. .listNewsTitle_skin2 {
  103. font-size:22px;
  104. font-weight:bold;
  105. height: 40px;
  106. line-height: 40px;
  107. border-bottom: 2px solid #A91B33;
  108. color:#A91B33;
  109. margin-bottom: 20px;
  110. box-sizing: border-box;
  111. a {
  112. color:#A91B33;
  113. display: block;
  114. height: 25px;
  115. line-height: 25px;
  116. }
  117. span {
  118. color:#A91B33;
  119. height: 25px;
  120. line-height: 25px;
  121. border-left: 3px solid #A91B33;
  122. padding-left: 12px;
  123. display: block;
  124. }
  125. }
  126. // 样式2 end ---------------------------------------->
  127. .listNewsContent {
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. .listNewsContentLeft {
  132. width: 350px;
  133. height: 380px;
  134. img {
  135. display: block;
  136. }
  137. .listNewsContentLeftTop {
  138. margin-bottom: 20px;
  139. position: relative;
  140. img {
  141. display: block;
  142. width: 350px;
  143. height: 245px;
  144. }
  145. }
  146. .listNewsContentLeftBottom {
  147. display: flex;
  148. align-items: center;
  149. justify-content: space-between;
  150. position: relative;
  151. &>div {
  152. position: relative;
  153. }
  154. img {
  155. width: 170px;
  156. height: 110px;
  157. }
  158. }
  159. .listNewsContentLeftTopTitle {
  160. position: absolute;
  161. bottom:0;
  162. z-index:1;
  163. width: 100%;
  164. color:#fff;
  165. height: 50px;
  166. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. white-space: nowrap;
  170. line-height: 65px;
  171. box-sizing: border-box;
  172. padding:0 8px;
  173. }
  174. }
  175. .listNewsContentRight {
  176. width: 350px;
  177. height: 380px;
  178. div {
  179. padding-left: 16px;
  180. box-sizing: border-box;
  181. background: url('http://img.bjzxtw.org.cn/pre/image/png/20250605/1749100871349444.png') no-repeat left center;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. white-space: nowrap;
  185. margin-bottom: 20px;
  186. height: 24px;
  187. line-height: 24px;
  188. font-size: 18px;
  189. display: block;
  190. &:last-child {
  191. margin-bottom: 0;
  192. }
  193. &:first-child,&:nth-child(4),&:nth-child(7) {
  194. color:#333333;
  195. font-weight: bold;
  196. }
  197. a {
  198. color:#333333;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. // 样式1 end ---------------------------------------->
  205. </style>