1.vue 6.8 KB

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