1.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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="listNewsContentTop">
  25. <div class="listNewsContentLeftTop" v-for="item in component_style1_News1Array">
  26. <NuxtLink
  27. :href="getLinkPathDetail(item)"
  28. :title="item.title"
  29. :target="item.islink == 1 ? '_blank' : '_self'"
  30. >
  31. <img :src="item.imgurl" />
  32. <div class="listNewsContentLeftTopTitle">{{ item.title }}</div>
  33. </NuxtLink>
  34. </div>
  35. </div>
  36. <div class="listNewsContentBottom">
  37. <div v-for="item in component_style1_News2Array">
  38. <NuxtLink
  39. :href="getLinkPathDetail(item)"
  40. :title="item.title"
  41. :target="item.islink == 1 ? '_blank' : '_self'"
  42. >
  43. {{ item.title }}
  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. //样式1与样式2共用 start ---------------------------------------->
  60. const component_style1_News1Array = ref({});
  61. const component_style1_News2Array = ref([]);
  62. component_style1_News1Array.value = props.templateData.img.slice(0,2);
  63. component_style1_News2Array.value = props.templateData.text;
  64. //样式1与样式2共用 end ---------------------------------------->
  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. color:#004564;
  76. margin-bottom: 20px;
  77. box-sizing: border-box;
  78. a {
  79. color:#004564;
  80. display: block;
  81. height: 25px;
  82. line-height: 25px;
  83. }
  84. }
  85. .listNewsTitle_skin2 {
  86. font-size:22px;
  87. font-weight:bold;
  88. height: 40px;
  89. line-height: 40px;
  90. border-bottom: 2px solid #A91B33;
  91. color:#A91B33;
  92. margin-bottom: 20px;
  93. box-sizing: border-box;
  94. a {
  95. color:#A91B33;
  96. display: block;
  97. height: 25px;
  98. line-height: 25px;
  99. }
  100. span {
  101. color:#A91B33;
  102. height: 25px;
  103. line-height: 25px;
  104. border-left: 3px solid #A91B33;
  105. padding-left: 12px;
  106. display: block;
  107. }
  108. }
  109. .listNewsContent {
  110. .listNewsContentTop {
  111. width: 720px;
  112. height: 245px;
  113. display: flex;
  114. align-items: center;
  115. justify-content: space-between;
  116. margin-bottom: 20px;
  117. .listNewsContentLeftTop {
  118. position: relative;
  119. img {
  120. width: 350px;
  121. height: 245px;
  122. display: block;
  123. }
  124. .listNewsContentLeftTopTitle {
  125. position: absolute;
  126. bottom: 0;
  127. z-index: 1;
  128. width: 100%;
  129. color: #fff;
  130. height: 44px;
  131. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  132. box-sizing: border-box;
  133. padding: 0 10px;
  134. overflow: hidden;
  135. text-overflow: ellipsis;
  136. white-space: nowrap;
  137. line-height: 44px;
  138. font-size: 18px;
  139. }
  140. }
  141. }
  142. .listNewsContentBottom {
  143. display: flex;
  144. flex-wrap: wrap;
  145. justify-content: space-between;
  146. div {
  147. color:#333333;
  148. font-size:18px;
  149. line-height: 24px;
  150. height: 24px;
  151. margin-bottom: 20px;
  152. overflow: hidden;
  153. text-overflow: ellipsis;
  154. white-space: nowrap;
  155. width: 345px;
  156. &:last-child {
  157. margin-bottom: 0;
  158. }
  159. &:nth-child(1),&:nth-child(2),&:nth-child(7),&:nth-child(8){
  160. font-weight: bold;
  161. }
  162. a {
  163. color:#333333;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. </style>