1.vue 6.9 KB

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