6.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink v-if="titleLink1.cid" :href="getLinkPath(titleLink1)" :title="titleLink1.alias">
  5. <div :class="{ activeTab: activeTab == 0 }" @mouseenter="activeTab = 0">{{ titleLink1.alias }}</div>
  6. </NuxtLink>
  7. <NuxtLink v-if="titleLink2.cid" :href="getLinkPath(titleLink2)" :title="titleLink2.alias">
  8. <div :class="{ activeTab: activeTab == 1 }" @mouseenter="activeTab = 1">{{ titleLink2.alias }}</div>
  9. </NuxtLink>
  10. </div>
  11. <!--样式1-->
  12. <div class="listNewsContent" v-if="componentStyle == 1">
  13. <div class="box1" v-if="activeTab == 0">
  14. <div class="contentLeft" v-for="item in component_style1_News1Array_img_1">
  15. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  16. :target="item.islink == 1 ? '_blank' : '_self'">
  17. <img :src="item.imgurl" alt="">
  18. <span>{{ item.title }}</span>
  19. </NuxtLink>
  20. </div>
  21. <div class="contentRight">
  22. <div v-for="item in component_style1_News1Array_img_2">
  23. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  24. :target="item.islink == 1 ? '_blank' : '_self'">
  25. <img :src="item.imgurl" alt="">
  26. <span>{{ item.title }}</span>
  27. </NuxtLink>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="box1" v-if="activeTab == 1">
  32. <div class="contentLeft" v-for="item in component_style1_News1Array_img_3">
  33. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  34. :target="item.islink == 1 ? '_blank' : '_self'">
  35. <img :src="item.imgurl" alt="">
  36. <span>{{ item.title }}</span>
  37. </NuxtLink>
  38. </div>
  39. <div class="contentRight">
  40. <div v-for="item in component_style1_News1Array_img_4">
  41. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  42. :target="item.islink == 1 ? '_blank' : '_self'">
  43. <img :src="item.imgurl" alt="">
  44. <span>{{ item.title }}</span>
  45. </NuxtLink>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <!--样式2-->
  51. <div class="listNewsContent style2" v-if="componentStyle == 2">
  52. <div class="box1" v-if="activeTab == 0">
  53. <div class="contentRight">
  54. <div v-for="item in component_style1_News1Array_img_2">
  55. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  56. :target="item.islink == 1 ? '_blank' : '_self'">
  57. <img :src="item.imgurl" alt="">
  58. <span>{{ item.title }}</span>
  59. </NuxtLink>
  60. </div>
  61. </div>
  62. <div class="contentLeft" v-for="item in component_style1_News1Array_img_1">
  63. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  64. :target="item.islink == 1 ? '_blank' : '_self'">
  65. <img :src="item.imgurl" alt="">
  66. <span>{{ item.title }}</span>
  67. </NuxtLink>
  68. </div>
  69. </div>
  70. <div class="box1" v-if="activeTab == 1">
  71. <div class="contentRight">
  72. <div v-for="item in component_style1_News1Array_img_4">
  73. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  74. :target="item.islink == 1 ? '_blank' : '_self'">
  75. <img :src="item.imgurl" alt="">
  76. <span>{{ item.title }}</span>
  77. </NuxtLink>
  78. </div>
  79. </div>
  80. <div class="contentLeft" v-for="item in component_style1_News1Array_img_3">
  81. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  82. :target="item.islink == 1 ? '_blank' : '_self'">
  83. <img :src="item.imgurl" alt="">
  84. <span>{{ item.title }}</span>
  85. </NuxtLink>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </template>
  91. <script setup>
  92. //引入vue
  93. import { ref } from 'vue';
  94. //获得新闻数据
  95. const props = defineProps({
  96. titleLink1: Object,//板块1名称
  97. titleLink2: Object,//板块2名称
  98. templateData: Array,//新闻数据
  99. templateData1: Array,//新闻数据
  100. componentStyle: Number,//样式编号
  101. });
  102. //定义tab切换
  103. const activeTab = ref(0);
  104. // 新闻数据
  105. const component_style1_News1Array_img_1 = ref([]);
  106. const component_style1_News1Array_img_2 = ref([]);
  107. const component_style1_News1Array_img_3 = ref([]);
  108. const component_style1_News1Array_img_4 = ref([]);
  109. component_style1_News1Array_img_1.value = props.templateData.imgnum.slice(0, 1);
  110. component_style1_News1Array_img_2.value = props.templateData.imgnum.slice(1, 5);
  111. component_style1_News1Array_img_3.value = props.templateData1.imgnum.slice(0, 1);
  112. component_style1_News1Array_img_4.value = props.templateData1.imgnum.slice(1, 5);
  113. </script>
  114. <style lang="less" scoped>
  115. //基本样式 start ---------------------------------------->
  116. .listNewsBox {
  117. position: relative;
  118. .listNewsTitle {
  119. display: flex;
  120. align-items: flex-start;
  121. justify-content: flex-start;
  122. height: 38px;
  123. div {
  124. height: 35px;
  125. width: 138px;
  126. line-height: 32px;
  127. font-size: 22px;
  128. font-weight: bold;
  129. color: #333333;
  130. cursor: pointer;
  131. overflow: hidden;
  132. text-overflow: ellipsis;
  133. white-space: nowrap;
  134. padding-bottom: 5px;
  135. &.activeTab {
  136. color: #154079;
  137. background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
  138. }
  139. }
  140. }
  141. .dashed {
  142. border-bottom: 1px dashed #999999;
  143. }
  144. .listNewsContent {
  145. margin-top: 20px;
  146. .box1 {
  147. display: flex;
  148. align-items: flex-start;
  149. justify-content: flex-start;
  150. margin-bottom: 20px;
  151. .contentLeft {
  152. width: 585px;
  153. height: 370px;
  154. margin-right: 30px;
  155. position: relative;
  156. cursor: pointer;
  157. img {
  158. width: 585px;
  159. height: 370px;
  160. }
  161. span {
  162. display: inline-block;
  163. width: 585px;
  164. position: absolute;
  165. bottom: 0;
  166. left: 0;
  167. height: 60px;
  168. line-height: 60px;
  169. font-size: 18px;
  170. color: #fff;
  171. padding-left: 20px;
  172. overflow: hidden;
  173. text-overflow: ellipsis;
  174. white-space: nowrap;
  175. background-color: #ccc;
  176. box-sizing: border-box;
  177. }
  178. }
  179. .contentRight {
  180. width: 585px;
  181. height: 370px;
  182. display: flex;
  183. flex-wrap: wrap;
  184. align-items: flex-start;
  185. justify-content: space-between;
  186. div {
  187. width: 287px;
  188. height: 180px;
  189. margin-bottom: 10px;
  190. position: relative;
  191. cursor: pointer;
  192. img {
  193. width: 287px;
  194. height: 180px;
  195. }
  196. span {
  197. display: inline-block;
  198. width: 287px;
  199. position: absolute;
  200. bottom: 0;
  201. left: 0;
  202. height: 30px;
  203. line-height: 30px;
  204. font-size: 12px;
  205. font-weight: bold;
  206. color: #fff;
  207. padding-left: 10px;
  208. overflow: hidden;
  209. text-overflow: ellipsis;
  210. white-space: nowrap;
  211. background-color: #ccc;
  212. box-sizing: border-box;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. //样式2
  219. .style2 {
  220. .box1 {
  221. .contentLeft {
  222. margin-right: 0px;
  223. }
  224. .contentRight {
  225. margin-right: 30px;
  226. }
  227. }
  228. }
  229. // 样式3
  230. .style3 {
  231. .textLeft {
  232. margin-right: 28px;
  233. .textLeft_2 {
  234. margin-right: 30px;
  235. }
  236. .textLeft_1 {
  237. margin-right: 0px;
  238. }
  239. }
  240. }
  241. // 样式4
  242. .style4 {
  243. .textLeft {
  244. margin-right: 28px;
  245. .textLeft_2 {
  246. margin-right: 30px;
  247. .textleftContent {
  248. div {
  249. padding-left: 8px;
  250. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251203/1764739367233513.png") no-repeat left center;
  251. }
  252. }
  253. }
  254. .textLeft_1 {
  255. margin-right: 0px;
  256. }
  257. }
  258. }
  259. // 样式5
  260. .style5 {
  261. .textLeft {
  262. .textLeft_2 {
  263. .textleftContent {
  264. div {
  265. padding-left: 0px;
  266. background: none;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. // 样式6
  273. .style6 {
  274. .textLeft {
  275. margin-right: 28px;
  276. .textLeft_2 {
  277. margin-right: 30px;
  278. .textleftContent {
  279. div {
  280. padding-left: 0px;
  281. background: none;
  282. }
  283. }
  284. }
  285. .textLeft_1 {
  286. margin-right: 0px;
  287. }
  288. }
  289. }
  290. }
  291. </style>