1.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink
  5. v-if="titleLink.cid"
  6. :href="getLinkPath(titleLink)"
  7. :title="titleLink.alias"
  8. >
  9. {{titleLink.alias}}
  10. </NuxtLink>
  11. </div>
  12. <!--样式1-->
  13. <div class="listNewsContent" v-if="componentStyle==1">
  14. <div class="listNewsContentTop">
  15. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  16. <NuxtLink
  17. :href="getLinkPathDetail(item)"
  18. :title="item.title"
  19. :target="item.islink == 1 ? '_blank' : '_self'"
  20. >
  21. <img :src="item.imgurl" />
  22. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. <div class="listNewsContentBottom">
  27. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  28. <NuxtLink
  29. :href="getLinkPathDetail(item)"
  30. :title="item.title"
  31. :target="item.islink == 1 ? '_blank' : '_self'"
  32. >
  33. {{ item.title }}
  34. </NuxtLink>
  35. </div>
  36. </div>
  37. </div>
  38. <!--样式2-->
  39. <div class="listNewsContent listNewsStyle2" v-if="componentStyle==2">
  40. <div class="listNewsContentBottomBox">
  41. <div class="listNewsContentBottom">
  42. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  43. <NuxtLink
  44. :href="getLinkPathDetail(item)"
  45. :title="item.title"
  46. :target="item.islink == 1 ? '_blank' : '_self'"
  47. >
  48. {{ item.title }}
  49. </NuxtLink>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="listNewsContentTop">
  54. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  55. <NuxtLink
  56. :href="getLinkPathDetail(item)"
  57. :title="item.title"
  58. :target="item.islink == 1 ? '_blank' : '_self'"
  59. >
  60. <img :src="item.imgurl" />
  61. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  62. </NuxtLink>
  63. </div>
  64. </div>
  65. </div>
  66. <!-- 样式3 -->
  67. <div class="listNewsStyle3" v-if="componentStyle == 3">
  68. <div class="listNewsContent_left">
  69. <div class="listNewsContent_leftTop">
  70. <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
  71. <NuxtLink
  72. :href="getLinkPathDetail(item)"
  73. :title="item.title"
  74. :target="item.islink == 1 ? '_blank' : '_self'"
  75. >
  76. <img :src="item.imgurl" />
  77. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  78. </NuxtLink>
  79. </div>
  80. </div>
  81. <div class="listNewsContent_leftBottom">
  82. <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
  83. <NuxtLink
  84. :href="getLinkPathDetail(item)"
  85. :title="item.title"
  86. :target="item.islink == 1 ? '_blank' : '_self'"
  87. >
  88. {{ item.title }}
  89. </NuxtLink>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="listNewsContent_right">
  94. <div class="listNewsContent_leftBottom">
  95. <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
  96. <NuxtLink
  97. :href="getLinkPathDetail(item)"
  98. :title="item.title"
  99. :target="item.islink == 1 ? '_blank' : '_self'"
  100. >
  101. {{ item.title }}
  102. </NuxtLink>
  103. </div>
  104. </div>
  105. <div class="listNewsContent_leftTop">
  106. <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
  107. <NuxtLink
  108. :href="getLinkPathDetail(item)"
  109. :title="item.title"
  110. :target="item.islink == 1 ? '_blank' : '_self'"
  111. >
  112. <img :src="item.imgurl" />
  113. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  114. </NuxtLink>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <!-- 样式4 -->
  120. <div class="listNewsStyle3 listNewsStyle4" v-if="componentStyle == 4">
  121. <div class="listNewsContent_left">
  122. <div class="listNewsContent_leftBottom">
  123. <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
  124. <NuxtLink
  125. :href="getLinkPathDetail(item)"
  126. :title="item.title"
  127. :target="item.islink == 1 ? '_blank' : '_self'"
  128. >
  129. {{ item.title }}
  130. </NuxtLink>
  131. </div>
  132. </div>
  133. <div class="listNewsContent_leftTop">
  134. <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
  135. <NuxtLink
  136. :href="getLinkPathDetail(item)"
  137. :title="item.title"
  138. :target="item.islink == 1 ? '_blank' : '_self'"
  139. >
  140. <img :src="item.imgurl" />
  141. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  142. </NuxtLink>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="listNewsContent_right">
  147. <div class="listNewsContent_leftTop">
  148. <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
  149. <NuxtLink
  150. :href="getLinkPathDetail(item)"
  151. :title="item.title"
  152. :target="item.islink == 1 ? '_blank' : '_self'"
  153. >
  154. <img :src="item.imgurl" />
  155. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  156. </NuxtLink>
  157. </div>
  158. </div>
  159. <div class="listNewsContent_leftBottom">
  160. <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
  161. <NuxtLink
  162. :href="getLinkPathDetail(item)"
  163. :title="item.title"
  164. :target="item.islink == 1 ? '_blank' : '_self'"
  165. >
  166. {{ item.title }}
  167. </NuxtLink>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <!-- 样式5 -->
  173. <div class="listNewsContent listNewsStyle5" v-if="componentStyle == 5">
  174. <div class="listNewsContentTop">
  175. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  176. <NuxtLink
  177. :href="getLinkPathDetail(item)"
  178. :title="item.title"
  179. :target="item.islink == 1 ? '_blank' : '_self'"
  180. >
  181. <img :src="item.imgurl" />
  182. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  183. </NuxtLink>
  184. </div>
  185. </div>
  186. <div class="listNewsContentBottom">
  187. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  188. <NuxtLink
  189. :href="getLinkPathDetail(item)"
  190. :title="item.title"
  191. :target="item.islink == 1 ? '_blank' : '_self'"
  192. >
  193. {{ item.title }}
  194. </NuxtLink>
  195. </div>
  196. </div>
  197. </div>
  198. <!-- 样式6 -->
  199. <div class="listNewsContent listNewsStyle6" v-if="componentStyle == 6">
  200. <div class="listNewsContentBottom">
  201. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  202. <NuxtLink
  203. :href="getLinkPathDetail(item)"
  204. :title="item.title"
  205. :target="item.islink == 1 ? '_blank' : '_self'"
  206. >
  207. {{ item.title }}
  208. </NuxtLink>
  209. </div>
  210. </div>
  211. <div class="listNewsContentTop">
  212. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  213. <NuxtLink
  214. :href="getLinkPathDetail(item)"
  215. :title="item.title"
  216. :target="item.islink == 1 ? '_blank' : '_self'"
  217. >
  218. <img :src="item.imgurl" />
  219. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  220. </NuxtLink>
  221. </div>
  222. </div>
  223. </div>
  224. <!-- 样式7 -->
  225. <div class="listNewsStyle3 listNewsStyle7" v-if="componentStyle == 7">
  226. <div class="listNewsContent_left">
  227. <div class="listNewsContent_leftTop">
  228. <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
  229. <NuxtLink
  230. :href="getLinkPathDetail(item)"
  231. :title="item.title"
  232. :target="item.islink == 1 ? '_blank' : '_self'"
  233. >
  234. <img :src="item.imgurl" />
  235. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  236. </NuxtLink>
  237. </div>
  238. </div>
  239. <div class="listNewsContent_leftBottom">
  240. <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
  241. <NuxtLink
  242. :href="getLinkPathDetail(item)"
  243. :title="item.title"
  244. :target="item.islink == 1 ? '_blank' : '_self'"
  245. >
  246. {{ item.title }}
  247. </NuxtLink>
  248. </div>
  249. </div>
  250. </div>
  251. <div class="listNewsContent_right">
  252. <div class="listNewsContent_leftBottom">
  253. <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
  254. <NuxtLink
  255. :href="getLinkPathDetail(item)"
  256. :title="item.title"
  257. :target="item.islink == 1 ? '_blank' : '_self'"
  258. >
  259. {{ item.title }}
  260. </NuxtLink>
  261. </div>
  262. </div>
  263. <div class="listNewsContent_leftTop">
  264. <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
  265. <NuxtLink
  266. :href="getLinkPathDetail(item)"
  267. :title="item.title"
  268. :target="item.islink == 1 ? '_blank' : '_self'"
  269. >
  270. <img :src="item.imgurl" />
  271. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  272. </NuxtLink>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. <!-- 样式8 -->
  278. <div class="listNewsStyle3 listNewsStyle8" v-if="componentStyle == 8">
  279. <div class="listNewsContent_left">
  280. <div class="listNewsContent_leftBottom">
  281. <div v-for="item in component_style1_News2Array_1" class="listNewsContentTopItem">
  282. <NuxtLink
  283. :href="getLinkPathDetail(item)"
  284. :title="item.title"
  285. :target="item.islink == 1 ? '_blank' : '_self'"
  286. >
  287. {{ item.title }}
  288. </NuxtLink>
  289. </div>
  290. </div>
  291. <div class="listNewsContent_leftTop">
  292. <div v-for="item in component_style1_News1Array_1" class="listNewsContentTopItem">
  293. <NuxtLink
  294. :href="getLinkPathDetail(item)"
  295. :title="item.title"
  296. :target="item.islink == 1 ? '_blank' : '_self'"
  297. >
  298. <img :src="item.imgurl" />
  299. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  300. </NuxtLink>
  301. </div>
  302. </div>
  303. </div>
  304. <div class="listNewsContent_right">
  305. <div class="listNewsContent_leftTop">
  306. <div v-for="item in component_style1_News1Array_2" class="listNewsContentTopItem">
  307. <NuxtLink
  308. :href="getLinkPathDetail(item)"
  309. :title="item.title"
  310. :target="item.islink == 1 ? '_blank' : '_self'"
  311. >
  312. <img :src="item.imgurl" />
  313. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  314. </NuxtLink>
  315. </div>
  316. </div>
  317. <div class="listNewsContent_leftBottom">
  318. <div v-for="item in component_style1_News2Array_2" class="listNewsContentTopItem">
  319. <NuxtLink
  320. :href="getLinkPathDetail(item)"
  321. :title="item.title"
  322. :target="item.islink == 1 ? '_blank' : '_self'"
  323. >
  324. {{ item.title }}
  325. </NuxtLink>
  326. </div>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. </template>
  332. <script setup>
  333. //引入vue
  334. import {ref} from 'vue';
  335. //获得新闻数据
  336. const props = defineProps({
  337. titleLink:Object,//板块名称
  338. templateData:Array,//新闻数据
  339. componentStyle:Number,//样式编号
  340. });
  341. //样式1与样式2共用 start ---------------------------------------->
  342. const component_style1_News1Array = ref({});
  343. const component_style1_News1Array_1 = ref({});
  344. const component_style1_News1Array_2 = ref({});
  345. const component_style1_News2Array = ref([]);
  346. const component_style1_News2Array_1 = ref([]);
  347. const component_style1_News2Array_2 = ref([]);
  348. component_style1_News1Array.value = props.templateData.imgnum.slice(0,2);
  349. component_style1_News1Array_1.value = props.templateData.imgnum.slice(0,1);
  350. component_style1_News1Array_2.value = props.templateData.imgnum.slice(1,2);
  351. component_style1_News2Array.value = props.templateData.textnum;
  352. component_style1_News2Array_1.value = props.templateData.textnum.slice(0,6);
  353. component_style1_News2Array_2.value = props.templateData.textnum.slice(6,12);
  354. //样式1与样式2共用 end ---------------------------------------->
  355. </script>
  356. <style lang="less" scoped>
  357. //基本样式 start ---------------------------------------->
  358. .listNewsBox {
  359. position: relative;
  360. .listNewsTitle {
  361. font-size:22px;
  362. font-weight:bold;
  363. height: 40px;
  364. line-height: 40px;
  365. border-bottom: 2px solid #004564;
  366. color:#004564;
  367. margin-bottom: 20px;
  368. box-sizing: border-box;
  369. a {
  370. color:#004564;
  371. display: block;
  372. height: 25px;
  373. line-height: 25px;
  374. }
  375. }
  376. .listNewsContent {
  377. .listNewsContentTop {
  378. display: flex;
  379. align-items: center;
  380. justify-content: space-between;
  381. margin-bottom: 20px;
  382. height: 110px;
  383. .listNewsContentTopItem {
  384. width: 350px;
  385. height: 110px;
  386. a{
  387. display: block;
  388. display: flex;
  389. align-items: center;
  390. justify-content: space-between;
  391. }
  392. img {
  393. display: block;
  394. width: 170px;
  395. height: 110px;
  396. }
  397. .listNewsContentTopItemTitle {
  398. font-size: 18px;
  399. color: #333333;
  400. margin-left: 8px;
  401. margin-right: 8px;
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. display: -webkit-box;
  405. -webkit-box-orient: vertical;
  406. -webkit-line-clamp: 3;
  407. }
  408. }
  409. }
  410. .listNewsContentBottom {
  411. display: flex;
  412. flex-wrap: wrap;
  413. align-items: flex-start;
  414. justify-content: space-between;
  415. div {
  416. width: 350px;
  417. height: 24px;
  418. line-height: 24px;
  419. overflow: hidden;
  420. text-overflow: ellipsis;
  421. white-space: nowrap;
  422. margin-bottom: 20px;
  423. &:nth-last-child(-n+2) {
  424. margin-bottom: 0;
  425. }
  426. &:nth-child(1),
  427. &:nth-child(2),
  428. &:nth-child(7),
  429. &:nth-child(8) {
  430. font-weight: bold;
  431. }
  432. a {
  433. font-size: 18px;
  434. color: #333333;
  435. }
  436. }
  437. }
  438. }
  439. }
  440. //基本样式 end ---------------------------------------->
  441. //样式2 start ---------------------------------------->
  442. .listNewsStyle2 {
  443. .listNewsContentTop {
  444. margin-bottom: 0;
  445. margin-top: 20px;
  446. }
  447. }
  448. //样式2 end ---------------------------------------->
  449. //样式3
  450. .listNewsBox {
  451. .listNewsStyle3 {
  452. display: flex;
  453. .listNewsContent_left {
  454. width: 350px;
  455. height: 440px;
  456. margin-right: 20px;
  457. .listNewsContent_leftTop {
  458. width: 350px;
  459. height: 110px;
  460. margin-bottom: 20px;
  461. .listNewsContentTopItem {
  462. width: 350px;
  463. height: 110px;
  464. background-color: #f9fafb;
  465. a{
  466. display: flex;
  467. align-items: center;
  468. justify-content: space-between;
  469. img {
  470. display: block;
  471. width: 170px;
  472. height: 110px;
  473. }
  474. .listNewsContentTopItemTitle {
  475. font-size: 18px;
  476. color: #333333;
  477. margin-left: 8px;
  478. margin-right: 8px;
  479. overflow: hidden;
  480. text-overflow: ellipsis;
  481. display: -webkit-box;
  482. -webkit-box-orient: vertical;
  483. -webkit-line-clamp: 3;
  484. }
  485. }
  486. }
  487. }
  488. .listNewsContent_leftBottom {
  489. width: 350px;
  490. div {
  491. width: 350px;
  492. height: 24px;
  493. line-height: 24px;
  494. overflow: hidden;
  495. text-overflow: ellipsis;
  496. white-space: nowrap;
  497. font-size: 18px;
  498. margin-bottom: 20px;
  499. color: #333333;
  500. a{
  501. color: #333333;
  502. }
  503. &:nth-child(1),
  504. &:nth-child(4) {
  505. font-weight: bold;
  506. }
  507. &:last-child {
  508. margin-bottom: 0;
  509. }
  510. }
  511. }
  512. }
  513. .listNewsContent_right {
  514. width: 350px;
  515. height: 440px;
  516. .listNewsContent_leftTop {
  517. width: 350px;
  518. height: 110px;
  519. .listNewsContentTopItem {
  520. width: 350px;
  521. height: 110px;
  522. background-color: #f9fafb;
  523. a{
  524. display: flex;
  525. align-items: center;
  526. justify-content: space-between;
  527. img {
  528. display: block;
  529. width: 170px;
  530. height: 110px;
  531. }
  532. .listNewsContentTopItemTitle {
  533. font-size: 18px;
  534. color: #333333;
  535. margin-left: 8px;
  536. margin-right: 8px;
  537. overflow: hidden;
  538. text-overflow: ellipsis;
  539. display: -webkit-box;
  540. -webkit-box-orient: vertical;
  541. -webkit-line-clamp: 3;
  542. }
  543. }
  544. }
  545. }
  546. .listNewsContent_leftBottom {
  547. width: 350px;
  548. margin-bottom: 20px;
  549. div {
  550. width: 350px;
  551. height: 24px;
  552. line-height: 24px;
  553. overflow: hidden;
  554. text-overflow: ellipsis;
  555. white-space: nowrap;
  556. font-size: 18px;
  557. margin-bottom: 20px;
  558. color: #333333;
  559. a{
  560. color: #333333;
  561. }
  562. &:nth-child(1),
  563. &:nth-child(4) {
  564. font-weight: bold;
  565. }
  566. &:last-child {
  567. margin-bottom: 0;
  568. }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. //样式4
  575. .listNewsBox {
  576. .listNewsStyle4 {
  577. display: flex;
  578. .listNewsContent_left {
  579. .listNewsContent_leftBottom {
  580. margin-bottom: 20px;
  581. }
  582. .listNewsContent_leftTop {
  583. margin-bottom: 0px;
  584. }
  585. }
  586. .listNewsContent_right {
  587. .listNewsContent_leftBottom {
  588. margin-bottom: 0px;
  589. }
  590. .listNewsContent_leftTop {
  591. margin-bottom: 20px;
  592. }
  593. }
  594. }
  595. }
  596. // 样式5
  597. .listNewsBox {
  598. .listNewsStyle5 {
  599. .listNewsContentBottom {
  600. div {
  601. &:nth-child(1),
  602. &:nth-child(2),
  603. &:nth-child(7),
  604. &:nth-child(8) {
  605. font-weight: 400;
  606. }
  607. }
  608. }
  609. }
  610. }
  611. // 样式6
  612. .listNewsBox {
  613. .listNewsStyle6 {
  614. .listNewsContentBottom {
  615. div {
  616. &:nth-child(1),
  617. &:nth-child(2),
  618. &:nth-child(7),
  619. &:nth-child(8) {
  620. font-weight: 400;
  621. }
  622. }
  623. }
  624. .listNewsContentTop {
  625. margin-top: 20px;
  626. .listNewsContentTopItem {
  627. margin-bottom: 0;
  628. }
  629. }
  630. }
  631. }
  632. // 样式7
  633. .listNewsBox {
  634. .listNewsStyle7 {
  635. .listNewsContent_left {
  636. .listNewsContent_leftBottom {
  637. div {
  638. &:nth-child(1),
  639. &:nth-child(4) {
  640. font-weight: 400;
  641. }
  642. }
  643. }
  644. }
  645. .listNewsContent_right {
  646. .listNewsContent_leftBottom {
  647. div {
  648. &:nth-child(1),
  649. &:nth-child(4) {
  650. font-weight: 400;
  651. }
  652. }
  653. }
  654. }
  655. }
  656. }
  657. //样式8
  658. .listNewsBox {
  659. .listNewsStyle8 {
  660. display: flex;
  661. .listNewsContent_left {
  662. .listNewsContent_leftBottom {
  663. margin-bottom: 20px;
  664. div {
  665. &:nth-child(1),
  666. &:nth-child(4) {
  667. font-weight: 400;
  668. }
  669. }
  670. }
  671. .listNewsContent_leftTop {
  672. margin-bottom: 0px;
  673. }
  674. }
  675. .listNewsContent_right {
  676. .listNewsContent_leftBottom {
  677. margin-bottom: 0px;
  678. div {
  679. &:nth-child(1),
  680. &:nth-child(4) {
  681. font-weight: 400;
  682. }
  683. }
  684. }
  685. .listNewsContent_leftTop {
  686. margin-bottom: 20px;
  687. }
  688. }
  689. }
  690. }
  691. </style>