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