Slider.vue 12 KB

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