1.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="NewsHyjjSectorBox">
  3. <!-- 标题样式1-4 -->
  4. <div class="NewsHyjjSectorTitle" v-if="componentStyle <= 4">
  5. <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
  6. <div>{{ titleLink.alias }}</div>
  7. </NuxtLink>
  8. </div>
  9. <!--样式1-->
  10. <div class="NewsHyjjSectorContent" v-if="componentStyle == 1">
  11. <!-- 左 -->
  12. <div class="newsAllPictureSectorLeft">
  13. <div class="leftImg">
  14. <NuxtLink v-for="item in component_style1_News1" :href="getLinkPathDetail(item)" :title="item.title"
  15. :target="item.islink == 1 ? '_blank' : '_self'">
  16. <img :src="item.imgurl" alt="">
  17. <div class="Left_mask"></div>
  18. <div class="Left_title">{{ item.title }}</div>
  19. </NuxtLink>
  20. </div>
  21. <div class="rightImg">
  22. <NuxtLink v-for="item in component_style1_News2" :href="getLinkPathDetail(item)" :title="item.title"
  23. :target="item.islink == 1 ? '_blank' : '_self'">
  24. <img :src="item.imgurl" alt="">
  25. <div class="Left_mask1"></div>
  26. <div class="Left_title1">{{ item.title }}</div>
  27. </NuxtLink>
  28. </div>
  29. </div>
  30. <!-- 中 -->
  31. <div class="newsAllPictureSectorMid">
  32. <NuxtLink v-for="item in component_style1_News3" :href="getLinkPathDetail(item)" :title="item.title"
  33. :target="item.islink == 1 ? '_blank' : '_self'">
  34. <img :src="item.imgurl" alt="">
  35. <div class="mask"></div>
  36. <div class="title">{{ item.title }}</div>
  37. </NuxtLink>
  38. </div>
  39. <!-- 右 -->
  40. <div class="newsAllPictureSectorRight">
  41. <div class="leftImg">
  42. <NuxtLink v-for="item in component_style1_News4" :href="getLinkPathDetail(item)" :title="item.title"
  43. :target="item.islink == 1 ? '_blank' : '_self'">
  44. <img :src="item.imgurl" alt="">
  45. <div class="right_mask"></div>
  46. <div class="right_title">{{ item.title }}</div>
  47. </NuxtLink>
  48. </div>
  49. <div class="rightImg">
  50. <NuxtLink v-for="item in component_style1_News5" :href="getLinkPathDetail(item)" :title="item.title"
  51. :target="item.islink == 1 ? '_blank' : '_self'">
  52. <img :src="item.imgurl" alt="">
  53. <div class="right_mask1"></div>
  54. <div class="right_title1">{{ item.title }}</div>
  55. </NuxtLink>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script setup>
  62. //引入vue
  63. import { ref } from 'vue';
  64. //获得新闻数据
  65. const props = defineProps({
  66. titleLink: Object,//板块名称
  67. templateData: Array,//新闻数据
  68. componentStyle: Number,//样式编号
  69. });
  70. //样式1与样式2共用 start ---------------------------------------->
  71. const component_style1_News = ref({});
  72. // 样式1
  73. const component_style1_News1 = ref({});
  74. const component_style1_News2 = ref({});
  75. const component_style1_News3 = ref({});
  76. const component_style1_News4 = ref({});
  77. const component_style1_News5 = ref({});
  78. // 样式2
  79. const component_style1_News6 = ref({});
  80. const component_style1_News7 = ref({});
  81. const component_style1_News8 = ref({});
  82. const component_style1_News9 = ref({});
  83. const component_style1_News10 = ref({});
  84. // 样式3
  85. const component_style1_News11 = ref({});
  86. const component_style1_News12 = ref({});
  87. const component_style1_News13 = ref({});
  88. const component_style1_News14 = ref({});
  89. const component_style1_News15 = ref({});
  90. component_style1_News.value = props.templateData.imgnum;
  91. // 样式1
  92. component_style1_News1.value = props.templateData.imgnum.slice(0, 2);
  93. component_style1_News2.value = props.templateData.imgnum.slice(2, 3);
  94. component_style1_News3.value = props.templateData.imgnum.slice(3, 4);
  95. component_style1_News4.value = props.templateData.imgnum.slice(4, 6);
  96. component_style1_News5.value = props.templateData.imgnum.slice(6, 7);
  97. // 样式1
  98. component_style1_News6.value = props.templateData.imgnum.slice(0, 2);
  99. component_style1_News7.value = props.templateData.imgnum.slice(2, 3);
  100. component_style1_News8.value = props.templateData.imgnum.slice(3, 4);
  101. component_style1_News9.value = props.templateData.imgnum.slice(4, 6);
  102. component_style1_News10.value = props.templateData.imgnum.slice(6, 7);
  103. // 样式1
  104. component_style1_News11.value = props.templateData.imgnum.slice(0, 2);
  105. component_style1_News12.value = props.templateData.imgnum.slice(2, 3);
  106. component_style1_News13.value = props.templateData.imgnum.slice(3, 4);
  107. component_style1_News14.value = props.templateData.imgnum.slice(4, 6);
  108. component_style1_News15.value = props.templateData.imgnum.slice(6, 7);
  109. //样式1与样式2共用 end ---------------------------------------->
  110. </script>
  111. <style lang="less" scoped>
  112. //基本样式 start ---------------------------------------->
  113. .NewsHyjjSectorBox {
  114. width: 1200px;
  115. height: 430px;
  116. position: relative;
  117. // 标题
  118. .NewsHyjjSectorTitle {
  119. display: flex;
  120. align-items: flex-start;
  121. justify-content: flex-start;
  122. border-bottom: 1px solid #999999;
  123. height: 38px;
  124. margin-bottom: 20px;
  125. a {
  126. color: #3848A0;
  127. }
  128. div {
  129. height: 35px;
  130. width: 138px;
  131. line-height: 32px;
  132. font-size: 22px;
  133. font-weight: bold;
  134. color: #333333;
  135. cursor: pointer;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. color: #3848A0;
  140. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  141. }
  142. }
  143. // 内容
  144. .NewsHyjjSectorContent {
  145. width: 100%;
  146. height: 320px;
  147. display: flex;
  148. align-items: flex-start;
  149. justify-content: flex-start;
  150. .newsAllPictureSectorLeft {
  151. position: relative;
  152. width: 390px;
  153. height: 320px;
  154. margin-right: 13px;
  155. display: flex;
  156. align-items: flex-start;
  157. justify-content: flex-start;
  158. .leftImg {
  159. width: 190px;
  160. height: 320px;
  161. margin-right: 10px;
  162. a {
  163. width: 190px;
  164. height: 150px;
  165. display: block;
  166. position: relative;
  167. margin-bottom: 20px;
  168. div {
  169. font-size: 16px;
  170. font-weight: 400;
  171. height: 32px;
  172. line-height: 32px;
  173. color: transparent;
  174. }
  175. img {
  176. width: 190px;
  177. height: 150px;
  178. border-radius: 4px;
  179. }
  180. &:last-child {
  181. margin-bottom: 0;
  182. }
  183. }
  184. a:hover {
  185. .Left_mask {
  186. position: absolute;
  187. top: 0;
  188. left: 0;
  189. width: 190px;
  190. height: 150px;
  191. background-color: rgba(0, 0, 0, 0.6);
  192. border-radius: 4px;
  193. }
  194. .Left_title {
  195. position: absolute;
  196. bottom: 0;
  197. left: 0;
  198. color: transparent;
  199. color: #fff;
  200. padding-left: 10px;
  201. width: 180px;
  202. white-space: nowrap;
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. }
  206. }
  207. }
  208. .rightImg {
  209. position: relative;
  210. width: 190px;
  211. height: 320px;
  212. border-radius: 4px;
  213. a {
  214. width: 100%;
  215. height: 320px;
  216. img {
  217. width: 190px;
  218. height: 320px;
  219. border-radius: 4px;
  220. }
  221. div {
  222. position: absolute;
  223. bottom: 0;
  224. left: 0;
  225. color: transparent;
  226. height: 50px;
  227. line-height: 50px;
  228. font-size: 18px;
  229. font-weight: 400;
  230. }
  231. }
  232. }
  233. .rightImg:hover {
  234. position: relative;
  235. .Left_mask1 {
  236. position: absolute;
  237. top: 0;
  238. left: 0;
  239. width: 190px;
  240. height: 320px;
  241. background-color: rgba(0, 0, 0, 0.6);
  242. border-radius: 4px;
  243. }
  244. .Left_title1 {
  245. position: absolute;
  246. bottom: 0;
  247. left: 0;
  248. color: transparent;
  249. color: #fff;
  250. padding-left: 10px;
  251. width: 180px;
  252. white-space: nowrap;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. }
  256. }
  257. }
  258. .newsAllPictureSectorMid {
  259. position: relative;
  260. width: 390px;
  261. height: 320px;
  262. margin-right: 13px;
  263. a {
  264. img {
  265. width: 390px;
  266. height: 320px;
  267. border-radius: 4px;
  268. }
  269. div {
  270. position: absolute;
  271. bottom: 0;
  272. left: 0;
  273. width: 585px;
  274. height: 60px;
  275. line-height: 60px;
  276. color: transparent;
  277. font-size: 18px;
  278. font-weight: bold;
  279. }
  280. }
  281. }
  282. .newsAllPictureSectorMid:hover {
  283. .mask {
  284. position: absolute;
  285. top: 0;
  286. left: 0;
  287. width: 390px;
  288. height: 320px;
  289. background-color: rgba(0, 0, 0, 0.6);
  290. border-radius: 4px;
  291. }
  292. .title {
  293. position: absolute;
  294. bottom: 0;
  295. left: 0;
  296. color: #fff;
  297. padding-left: 10px;
  298. width: 380px;
  299. white-space: nowrap;
  300. overflow: hidden;
  301. text-overflow: ellipsis;
  302. }
  303. }
  304. .newsAllPictureSectorRight {
  305. position: relative;
  306. width: 390px;
  307. height: 320px;
  308. display: flex;
  309. align-items: flex-start;
  310. justify-content: flex-start;
  311. .leftImg {
  312. width: 190px;
  313. height: 320px;
  314. margin-right: 10px;
  315. a {
  316. width: 190px;
  317. height: 150px;
  318. display: block;
  319. position: relative;
  320. margin-bottom: 20px;
  321. div {
  322. font-size: 16px;
  323. font-weight: 400;
  324. height: 32px;
  325. line-height: 32px;
  326. color: transparent;
  327. }
  328. img {
  329. width: 190px;
  330. height: 150px;
  331. border-radius: 4px;
  332. }
  333. &:last-child {
  334. margin-bottom: 0;
  335. }
  336. }
  337. a:hover {
  338. .right_mask {
  339. position: absolute;
  340. top: 0;
  341. left: 0;
  342. width: 190px;
  343. height: 150px;
  344. background-color: rgba(0, 0, 0, 0.6);
  345. border-radius: 4px;
  346. }
  347. .right_title {
  348. position: absolute;
  349. bottom: 0;
  350. left: 0;
  351. color: transparent;
  352. color: #fff;
  353. padding-left: 10px;
  354. width: 180px;
  355. white-space: nowrap;
  356. overflow: hidden;
  357. text-overflow: ellipsis;
  358. }
  359. }
  360. }
  361. .rightImg {
  362. position: relative;
  363. width: 190px;
  364. height: 320px;
  365. border-radius: 4px;
  366. a {
  367. width: 100%;
  368. height: 320px;
  369. img {
  370. width: 190px;
  371. height: 320px;
  372. border-radius: 4px;
  373. }
  374. div {
  375. position: absolute;
  376. bottom: 0;
  377. left: 0;
  378. color: transparent;
  379. height: 50px;
  380. line-height: 50px;
  381. font-size: 18px;
  382. font-weight: 400;
  383. }
  384. }
  385. }
  386. .rightImg:hover {
  387. position: relative;
  388. .right_mask1 {
  389. position: absolute;
  390. top: 0;
  391. left: 0;
  392. width: 190px;
  393. height: 320px;
  394. background-color: rgba(0, 0, 0, 0.6);
  395. border-radius: 4px;
  396. }
  397. .right_title1 {
  398. position: absolute;
  399. bottom: 0;
  400. left: 0;
  401. color: transparent;
  402. color: #fff;
  403. padding-left: 10px;
  404. width: 175px;
  405. white-space: nowrap;
  406. overflow: hidden;
  407. text-overflow: ellipsis;
  408. }
  409. }
  410. }
  411. }
  412. // 标题虚线
  413. // .dashed {
  414. // border-bottom: 1px dashed #999999;
  415. // }
  416. }
  417. //基本样式 end ----------------------------------------></style>