Slider.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <div class="slider" v-if="message">
  3. <div class="scienceTitle" v-if="message">
  4. <h5 v-if="message.cid">
  5. <NuxtLink v-if="message.cid" :href="getLinkPath(message)" class="active" :title="message.alias">
  6. {{ message.title }}
  7. </NuxtLink>
  8. </h5>
  9. <NuxtLink v-if="message.cid" :href="getLinkPath(message)" :title="message.alias">
  10. 查看更多
  11. </NuxtLink>
  12. </div>
  13. <!-- 标题下内容列表 -->
  14. <div class="box">
  15. <div class="boxcontent">
  16. <div class="boxcontentleft">
  17. <div class="boxleft" v-if="boxData1.length > 0">
  18. <div class="boxBigImg" v-if="boxData1[0]">
  19. <NuxtLink :href="getLinkPathDetail(boxData1[0])" :title="boxData1[0].title"
  20. :target="boxData1[0].islink == 1 ? '_blank' : '_self'">
  21. <img :src="boxData1[0].imgurl" :alt="boxData1[0].title">
  22. <div>
  23. <p><span>专题</span>{{ boxData1[0].title }}</p>
  24. </div>
  25. </NuxtLink>
  26. </div>
  27. <div class="boxMainImg">
  28. <NuxtLink :href="getLinkPathDetail(boxData1[1])" :title="boxData1[1].title"
  29. :target="boxData1[1].islink == 1 ? '_blank' : '_self'">
  30. <img :src="boxData1[1].imgurl" :alt="boxData1[1].title">
  31. <div>
  32. <p>{{ boxData1[1].title }}</p>
  33. </div>
  34. </NuxtLink>
  35. <NuxtLink :href="getLinkPathDetail(boxData1[2])" :title="boxData1[2].title"
  36. :target="boxData1[2].islink == 1 ? '_blank' : '_self'">
  37. <img :src="boxData1[2].imgurl" :alt="boxData1[2].title">
  38. <div>
  39. <p>{{ boxData1[2].title }}</p>
  40. </div>
  41. </NuxtLink>
  42. </div>
  43. <div class="boxBigImg">
  44. <NuxtLink :href="getLinkPathDetail(boxData1[3])" :title="boxData1[3].title"
  45. :target="boxData1[3].islink == 1 ? '_blank' : '_self'">
  46. <img :src="boxData1[3].imgurl" :alt="boxData1[3].title">
  47. <div>
  48. <p>{{ boxData1[3].title }}</p>
  49. </div>
  50. </NuxtLink>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="boxright">
  55. <ul>
  56. <li v-for="item in boxData2">
  57. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  58. :target="item.islink == 1 ? '_blank' : '_self'">
  59. <p class="title">{{ item.title }}</p>
  60. </NuxtLink>
  61. </li>
  62. </ul>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script setup>
  69. //1.获得传入的数据 start---------------------------------------->
  70. const props = defineProps({
  71. message: Array,
  72. boxData1: Array,
  73. boxData2: Array,
  74. });
  75. //1.获得传入的数据 end---------------------------------------->
  76. //2.获得本页的数据 start---------------------------------------->
  77. //格式化跳转路径 - 标题
  78. const getLinkPath = (item) => {
  79. if (item.children_count == 0) {
  80. return `/${item.aLIas_pinyin}/list-1.html`;
  81. } else {
  82. return `/${item.aLIas_pinyin}/index.html`;
  83. }
  84. }
  85. //格式化跳转路径 - 到详情
  86. const getLinkPathDetail = (item) => {
  87. if (item.islink == 1) {
  88. return `${item.linkurl}`;
  89. } else {
  90. return `/${item.pinyin}/${item.id}.html`;
  91. }
  92. }
  93. //2.获得本页的数据 end---------------------------------------->
  94. </script>
  95. <style lang="less" scoped>
  96. .slider {
  97. width: 720px;
  98. }
  99. // 标题
  100. .scienceTitle {
  101. height: 50px;
  102. line-height: 50px;
  103. border-bottom: 1px solid #D9D9D9;
  104. display: flex;
  105. justify-content: space-between;
  106. h5 {
  107. float: left;
  108. width: 96px;
  109. height: 34px;
  110. font-family: PingFang SC, PingFang SC;
  111. font-weight: 600;
  112. font-size: 24px;
  113. color: #000000;
  114. line-height: 28px;
  115. text-align: left;
  116. font-style: normal;
  117. text-transform: none;
  118. margin-right: 20px;
  119. // border-bottom: 2px solid #139602;
  120. height: 50px;
  121. line-height: 50px;
  122. a {
  123. font-size: 22px;
  124. color: #139602;
  125. border-bottom: 3px solid #139602;
  126. height: 50px;
  127. line-height: 50px;
  128. display: inline-block;
  129. box-sizing: border-box;
  130. width: auto;
  131. font-weight: bold;
  132. }
  133. }
  134. a {
  135. width: 65px;
  136. height: 50px;
  137. line-height: 50px;
  138. font-weight: 400;
  139. font-size: 16px;
  140. color: #333333;
  141. font-style: normal;
  142. text-transform: none;
  143. display: inline-block;
  144. }
  145. >p {
  146. float: left;
  147. height: 37px;
  148. line-height: 30px;
  149. >span {
  150. display: inline-block;
  151. height: 20px;
  152. line-height: 20px;
  153. text-align: center;
  154. margin: 4px 0px 3px;
  155. padding: 0 20px;
  156. border-right: 1px solid #ccc;
  157. >a {
  158. display: inline-block;
  159. padding-bottom: 11px;
  160. font-family: PingFang SC, PingFang SC;
  161. font-weight: 500;
  162. font-size: 20px;
  163. color: #666666;
  164. line-height: 20px;
  165. font-style: normal;
  166. text-transform: none;
  167. box-sizing: border-box;
  168. }
  169. .current {
  170. color: #139602;
  171. border-bottom: 1px solid #139602;
  172. }
  173. }
  174. >span:nth-child(4) {
  175. border-right: none;
  176. }
  177. >span:hover>a {
  178. color: #139602;
  179. border-bottom: 1px solid #139602;
  180. }
  181. }
  182. }
  183. .box {
  184. width: 720px;
  185. height: 662px;
  186. position: relative;
  187. overflow: hidden;
  188. .boxcontent {
  189. display: flex;
  190. justify-content: space-between;
  191. padding-top: 30px;
  192. .boxcontentleft {
  193. width: 349px;
  194. height: 632px;
  195. position: relative;
  196. }
  197. .boxleft {
  198. width: 349px;
  199. height: 632px;
  200. position: relative;
  201. }
  202. }
  203. .boxMainImg {
  204. display: flex;
  205. justify-content: space-between;
  206. margin-bottom: 15px;
  207. a {
  208. position: relative;
  209. width: 170px;
  210. height: 115px;
  211. display: block;
  212. img {
  213. width: 170px;
  214. height: 115px;
  215. border-radius: 4px;
  216. border-radius: 6px;
  217. }
  218. div {
  219. position: absolute;
  220. bottom: 0;
  221. left: 7px;
  222. z-index: 99;
  223. p {
  224. display: -webkit-box;
  225. -webkit-box-orient: vertical;
  226. -webkit-line-clamp: 2;
  227. overflow: hidden;
  228. text-overflow: ellipsis;
  229. word-break: break-all;
  230. width: 158px;
  231. height: 23px;
  232. color: #fff;
  233. }
  234. span {
  235. display: block;
  236. height: 20px;
  237. line-height: 20px;
  238. text-align: left;
  239. color: #fff;
  240. }
  241. }
  242. }
  243. }
  244. .boxBigImg {
  245. margin-bottom: 15px;
  246. a {
  247. position: relative;
  248. width: 349px;
  249. height: 236px;
  250. border-radius: 6px;
  251. display: block;
  252. img {
  253. width: 349px;
  254. height: 236px;
  255. border-radius: 6px;
  256. }
  257. div {
  258. position: absolute;
  259. bottom: 7px;
  260. left: 20px;
  261. z-index: 99;
  262. p {
  263. display: -webkit-box;
  264. -webkit-box-orient: vertical;
  265. -webkit-line-clamp: 2;
  266. overflow: hidden;
  267. text-overflow: ellipsis;
  268. word-break: break-all;
  269. width: 320px;
  270. height: 24px;
  271. color: #fff;
  272. font-size: 16px;
  273. margin-bottom: 5px;
  274. span {
  275. display: inline-block;
  276. background: #9CD26B;
  277. font-size: 14px;
  278. color: #fff;
  279. padding: 0 6px;
  280. border-radius: 4px;
  281. margin-right: 5px;
  282. }
  283. }
  284. span {
  285. display: block;
  286. height: 20px;
  287. line-height: 20px;
  288. text-align: left;
  289. color: #fff;
  290. }
  291. }
  292. }
  293. }
  294. }
  295. .fade-in {
  296. animation: fadeIn 1s ease-in-out;
  297. }
  298. .fade-enter-from,
  299. .fade-leave-to {
  300. opacity: 0;
  301. }
  302. .fade-enter-to,
  303. .fade-leave-from {
  304. opacity: 1;
  305. }
  306. .fade-enter-active,
  307. .fade-leave-active {
  308. transition: opacity 1s ease;
  309. }
  310. .scienceListBox {
  311. width: 3160px;
  312. height: 570px;
  313. position: absolute;
  314. top: 0;
  315. left: 0;
  316. transition: all 3s linear 0;
  317. z-index: 99;
  318. }
  319. // 标题下列表
  320. .scienceList {
  321. width: 790px;
  322. height: 570px;
  323. float: left;
  324. margin-top: 17px;
  325. >li {
  326. width: 250px;
  327. height: 276px;
  328. float: left;
  329. margin-right: 20px;
  330. position: relative;
  331. img {
  332. width: 250px;
  333. height: 220px;
  334. border-radius: 40px 4px 40px 4px;
  335. }
  336. p {
  337. width: 254px;
  338. display: -webkit-box;
  339. -webkit-box-orient: vertical;
  340. -webkit-line-clamp: 2;
  341. overflow: hidden;
  342. text-overflow: ellipsis;
  343. word-break: break-all;
  344. height: 48px;
  345. overflow: hidden;
  346. font-family: PingFang SC, PingFang SC;
  347. font-weight: 600;
  348. font-size: 18px;
  349. color: #333333;
  350. line-height: 24px;
  351. text-align: left;
  352. font-style: normal;
  353. text-transform: none;
  354. }
  355. p:hover {
  356. color: #139602;
  357. }
  358. }
  359. >li:nth-child(3),
  360. >li:nth-child(6) {
  361. margin-right: 0;
  362. }
  363. >li::before {
  364. content: "";
  365. display: inline-block;
  366. width: 40px;
  367. height: 20px;
  368. position: absolute;
  369. z-index: 99;
  370. top: 0;
  371. right: 0;
  372. background-image: url("../../static/images/Component 209.png");
  373. }
  374. }
  375. .boxright {
  376. position: relative;
  377. ul {
  378. li {
  379. width: 349px;
  380. box-sizing: border-box;
  381. border-bottom: 1px solid #E6E6E6;
  382. margin-bottom: 21px;
  383. padding-bottom: 8px;
  384. .title {
  385. display: -webkit-box;
  386. -webkit-box-orient: vertical;
  387. -webkit-line-clamp: 2;
  388. overflow: hidden;
  389. text-overflow: ellipsis;
  390. word-break: break-all;
  391. height: 44px;
  392. width: 100%;
  393. font-size: 16px;
  394. color: #333333;
  395. margin-bottom: 5px;
  396. box-sizing: border-box;
  397. }
  398. .title:hover {
  399. color: #49A769;
  400. }
  401. .time {
  402. font-size: 14px;
  403. color: #999999;
  404. margin-bottom: 10px;
  405. }
  406. }
  407. }
  408. }
  409. .imgbg::after {
  410. content: '';
  411. display: block;
  412. width: 100%;
  413. height: 68px;
  414. z-index: 44;
  415. left: 0px;
  416. bottom: 0;
  417. position: absolute;
  418. background: linear-gradient(to bottom, rgba(0, 0, 0, 0), black);
  419. opacity: .3;
  420. border-radius: 6px;
  421. }
  422. </style>