2.vue 5.2 KB

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