2.vue 5.1 KB

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