Slider.vue 15 KB

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