1.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <!--样式1-->
  3. <div class="swiperStyle1" v-if="skinId==1">
  4. <el-carousel :interval="3000" height="405px" indicator-position="none" arrow="always" @change="change_fun">
  5. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id">
  6. <NuxtLink
  7. :to="`/${item.pinyin}/${item.id}.html`"
  8. class="swiper_link"
  9. :target="item.islink == 1 ? '_blank' : '_self'"
  10. >
  11. <img :src="item.imgurl">
  12. <span class="swiper_dot1 dot1">
  13. {{ item.title }}
  14. </span>
  15. </NuxtLink>
  16. </el-carousel-item>
  17. </el-carousel>
  18. <div class="roll_num_box">
  19. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>
  20. /
  21. {{ roll_num_lang }}
  22. </div>
  23. </div>
  24. <!--样式2-->
  25. <div class="swiperStyle2" v-if="skinId==2">
  26. <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun" trigger="click">
  27. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id">
  28. <NuxtLink
  29. :to="`/${item.pinyin}/${item.id}.html`"
  30. class="swiper_link"
  31. :target="item.islink == 1 ? '_blank' : '_self'"
  32. >
  33. <img :src="item.imgurl">
  34. <span class="swiper_dot1 dot1">
  35. {{ item.title }}
  36. </span>
  37. </NuxtLink>
  38. </el-carousel-item>
  39. </el-carousel>
  40. </div>
  41. <!--样式3-->
  42. <div class="swiperStyle3" v-if="skinId==3">
  43. <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun" trigger="click">
  44. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id">
  45. <NuxtLink
  46. :to="`/${item.pinyin}/${item.id}.html`"
  47. class="swiper_link"
  48. :target="item.islink == 1 ? '_blank' : '_self'"
  49. >
  50. <img :src="item.imgurl">
  51. <span class="swiper_dot1 dot1">
  52. {{ item.title }}
  53. </span>
  54. </NuxtLink>
  55. </el-carousel-item>
  56. </el-carousel>
  57. </div>
  58. <!--样式4-->
  59. <div class="swiperStyle4" v-if="skinId==4">
  60. <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun" trigger="click">
  61. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id">
  62. <NuxtLink
  63. :to="`/${item.pinyin}/${item.id}.html`"
  64. class="swiper_link"
  65. :target="item.islink == 1 ? '_blank' : '_self'"
  66. >
  67. <img :src="item.imgurl">
  68. <span class="swiper_dot1 dot1">
  69. {{ item.title }}
  70. </span>
  71. </NuxtLink>
  72. </el-carousel-item>
  73. </el-carousel>
  74. </div>
  75. <!-- 样式5 -->
  76. <div class="swiperStyle5" v-if="skinId==5">
  77. <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun" trigger="click">
  78. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id" >
  79. <NuxtLink
  80. :to="`/${item.pinyin}/${item.id}.html`"
  81. class="swiper_link"
  82. :target="item.islink == 1 ? '_blank' : '_self'"
  83. >
  84. <img :src="item.imgurl">
  85. <span class="swiper_dot1 dot1">
  86. {{ item.title }}
  87. </span>
  88. </NuxtLink>
  89. </el-carousel-item>
  90. <div class="roll_num_box">
  91. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>/{{ total_num }}
  92. </div>
  93. </el-carousel>
  94. </div>
  95. <!-- 样式6 -->
  96. <div class="swiperStyle6" v-if="skinId==6">
  97. <el-carousel :interval="3333" height="405px" indicator-class="custom-indicator" @change="change_fun" trigger="click">
  98. <el-carousel-item v-for="(item, index) in imagelist" :key="item.id" >
  99. <NuxtLink
  100. :to="`/${item.pinyin}/${item.id}.html`"
  101. class="swiper_link"
  102. :target="item.islink == 1 ? '_blank' : '_self'"
  103. >
  104. <img :src="item.imgurl">
  105. <span class="swiper_dot1">
  106. <span class="title dot1">{{ item.title }}</span>
  107. </span>
  108. </NuxtLink>
  109. </el-carousel-item>
  110. </el-carousel>
  111. </div>
  112. </template>
  113. <script setup>
  114. //引入vue
  115. import { ref } from 'vue'
  116. import { ElCarousel, ElCarouselItem } from 'element-plus'
  117. //获得新闻数据
  118. const props = defineProps({
  119. skinId:String,//皮肤编号
  120. templateData:Array,//新闻数据
  121. });
  122. //焦点图效果 start---------------------------------------->
  123. const roll_num_lang = ref(5);
  124. const roll_num_this = ref(0);
  125. const total_num = ref(5);
  126. const change_fun = (the_1) => {
  127. roll_num_this.value = the_1
  128. }
  129. const imagelist = ref("")
  130. imagelist.value = props.templateData.slice(0, 5);
  131. roll_num_lang.value = props.templateData.length - 1;
  132. total_num.value = props.templateData.length;
  133. //焦点图效果 end---------------------------------------->
  134. </script>
  135. <style lang="less" scoped>
  136. //样式1 start---------------------------------------->
  137. .swiperStyle1 {
  138. width: 100%;
  139. height: 405px;
  140. position: relative;
  141. .roll_num_box {
  142. position: absolute;
  143. z-index: 100;
  144. left: 60px;
  145. bottom: 0px;
  146. height: 60px;
  147. line-height: 60px;
  148. color: #fff;
  149. font-size: 16px;
  150. .roll_num_box_new {
  151. font-size: 20px;
  152. }
  153. }
  154. .dot1 {
  155. display: block;
  156. word-break: keep-all;
  157. white-space: nowrap;
  158. overflow: hidden;
  159. text-overflow: ellipsis;
  160. }
  161. img {
  162. width: 100%;
  163. height: 405px;
  164. }
  165. .swiper_dot1 {
  166. display: block;
  167. width: 100%;
  168. line-height: 60px;
  169. height: 60px;
  170. color: #fff;
  171. font-size: 18px;
  172. text-indent: 20px;
  173. position: absolute;
  174. bottom: 0;
  175. left: 0;
  176. z-index: 10;
  177. box-sizing: border-box;
  178. padding: 0 144px;
  179. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  180. }
  181. .el-carousel {
  182. :deep(.el-carousel__arrow i) {
  183. font-size: 33px !important;
  184. }
  185. .roll_1_box {
  186. position: relative;
  187. }
  188. :deep(.el-carousel__arrow--left) {
  189. position: absolute;
  190. width: 35px;
  191. height: 57px;
  192. color: #fff;
  193. background: rgba(0, 0, 0, 0);
  194. left: 9px;
  195. border: none;
  196. border-radius: 0;
  197. top: 100%;
  198. margin-top: -28px;
  199. }
  200. :deep(.el-carousel__arrow--right) {
  201. width: 35px;
  202. height: 57px;
  203. color: #fff;
  204. background: rgba(0, 0, 0, 0);
  205. position: absolute;
  206. right: 9;
  207. border: none;
  208. border-radius: 0;
  209. top: 100%;
  210. margin-top: -28px;
  211. }
  212. :deep(.el-carousel__indicators) {
  213. // 指示器
  214. left: unset;
  215. transform: unset;
  216. right: 10px;
  217. bottom: 11px;
  218. }
  219. :deep(.el-carousel__button) {
  220. // 指示器按钮
  221. width: 10px;
  222. height: 10px;
  223. border: none;
  224. border-radius: 5px;
  225. background: #fff;
  226. opacity: 1;
  227. }
  228. :deep(.is-active .el-carousel__button) {
  229. // 指示器激活按钮
  230. background: #255590;
  231. width: 25px;
  232. opacity: 1;
  233. }
  234. :deep(.el-carousel__container) {
  235. height: 100%;
  236. }
  237. }
  238. .custom-indicator button {
  239. background-color: #fff;
  240. opacity: 1;
  241. width: 8px;
  242. height: 8px;
  243. }
  244. .custom-indicator button.is-active {
  245. background-color: #DD7D18;
  246. width: 58px;
  247. opacity: 1;
  248. }
  249. }
  250. //样式1 end---------------------------------------->
  251. //样式2 start---------------------------------------->
  252. .swiperStyle2 {
  253. width: 100%;
  254. height: 405px;
  255. position: relative;
  256. img {
  257. width: 100%;
  258. height: 405px;
  259. }
  260. .swiper_dot1 {
  261. display: block;
  262. width: 100%;
  263. line-height: 60px;
  264. height: 60px;
  265. color: #fff;
  266. font-size: 24px;
  267. text-indent: 20px;
  268. position: absolute;
  269. bottom: 0;
  270. left: 0;
  271. z-index: 10;
  272. box-sizing: border-box;
  273. padding-right: 244px;
  274. background:linear-gradient(0deg,rgba(0,0,0,0.5) 33%,rgba(0,0,0,0) 100%);
  275. }
  276. .el-carousel {
  277. /deep/.el-carousel__arrow i {
  278. font-size: 16px !important;
  279. }
  280. /deep/.el-carousel__arrow--left {
  281. left: 20px;
  282. width: 36px;
  283. height: 36px;
  284. color: #eee;
  285. background: rgba(0,0,0,0.5);
  286. border-radius: 50%;
  287. position: absolute;
  288. border: none;
  289. border-radius: 50%;
  290. }
  291. /deep/.el-carousel__arrow--right {
  292. right: 20px;
  293. width: 36px;
  294. height: 36px;
  295. color: #eee;
  296. background: rgba(0,0,0,0.5);
  297. position: absolute;
  298. border: none;
  299. border-radius: 50%;
  300. }
  301. /deep/ .el-carousel__indicators {
  302. // 指示器
  303. left: unset;
  304. transform: unset;
  305. right: 10px;
  306. bottom: 11px;
  307. }
  308. /deep/ .el-carousel__button {
  309. // 指示器按钮
  310. width: 10px;
  311. height: 10px;
  312. border: none;
  313. background: #fff;
  314. opacity: 1;
  315. }
  316. /deep/ .is-active .el-carousel__button {
  317. // 指示器激活按钮
  318. background: #A91B33;
  319. width: 10px;
  320. height: 10px;
  321. opacity: 1;
  322. }
  323. /deep/ .el-carousel__container {
  324. height: 100%;
  325. }
  326. }
  327. .custom-indicator button {
  328. background-color: #fff;
  329. opacity: 1;
  330. width: 8px;
  331. height: 8px;
  332. }
  333. .custom-indicator button.is-active {
  334. background-color: #DD7D18;
  335. width: 58px;
  336. opacity: 1;
  337. }
  338. }
  339. //样式2 end---------------------------------------->
  340. //样式3 start---------------------------------------->
  341. .swiperStyle3 {
  342. width: 100%;
  343. height: 405px;
  344. position: relative;
  345. img {
  346. width: 100%;
  347. height: 405px;
  348. }
  349. .swiper_dot1 {
  350. display: block;
  351. width: 100%;
  352. line-height: 60px;
  353. height: 60px;
  354. color: #fff;
  355. font-size: 24px;
  356. text-indent: 20px;
  357. position: absolute;
  358. bottom: 0;
  359. left: 0;
  360. z-index: 10;
  361. box-sizing: border-box;
  362. padding-right: 244px;
  363. background:linear-gradient(0deg,rgba(0,0,0,0.5) 33%,rgba(0,0,0,0) 100%);
  364. }
  365. .el-carousel {
  366. /deep/.el-carousel__arrow i {
  367. font-size: 16px !important;
  368. }
  369. /deep/.el-carousel__arrow--left {
  370. left: 20px;
  371. width: 36px;
  372. height: 36px;
  373. color: #eee;
  374. background: rgba(0,0,0,0.5);
  375. border-radius: 50%;
  376. position: absolute;
  377. border: none;
  378. border-radius: 50%;
  379. }
  380. /deep/.el-carousel__arrow--right {
  381. right: 20px;
  382. width: 36px;
  383. height: 36px;
  384. color: #eee;
  385. background: rgba(0,0,0,0.5);
  386. position: absolute;
  387. border: none;
  388. border-radius: 50%;
  389. }
  390. /deep/ .el-carousel__indicators {
  391. // 指示器
  392. left: unset;
  393. transform: unset;
  394. right: 10px;
  395. bottom: 11px;
  396. }
  397. /deep/ .el-carousel__button {
  398. // 指示器按钮
  399. width: 10px;
  400. height: 10px;
  401. border: none;
  402. background: #fff;
  403. opacity: 1;
  404. }
  405. /deep/ .is-active .el-carousel__button {
  406. // 指示器激活按钮
  407. background: #c82200;
  408. width: 10px;
  409. height: 10px;
  410. opacity: 1;
  411. }
  412. /deep/ .el-carousel__container {
  413. height: 100%;
  414. }
  415. }
  416. .custom-indicator button {
  417. background-color: #fff;
  418. opacity: 1;
  419. width: 8px;
  420. height: 8px;
  421. }
  422. .custom-indicator button.is-active {
  423. background-color: #c82200;
  424. width: 58px;
  425. opacity: 1;
  426. }
  427. }
  428. //样式3 end---------------------------------------->
  429. //样式4 start ---------------------------------------->
  430. .swiperStyle4 {
  431. width: 100%;
  432. height: 405px;
  433. position: relative;
  434. img {
  435. width: 100%;
  436. height: 405px;
  437. }
  438. .swiper_dot1 {
  439. display: block;
  440. width: 100%;
  441. line-height: 60px;
  442. height: 60px;
  443. color: #fff;
  444. font-size: 24px;
  445. text-indent: 20px;
  446. position: absolute;
  447. bottom: 0;
  448. left: 0;
  449. z-index: 10;
  450. box-sizing: border-box;
  451. padding-right: 244px;
  452. background:linear-gradient(0deg,rgba(0,0,0,0.5) 33%,rgba(0,0,0,0) 100%);
  453. }
  454. .el-carousel {
  455. /deep/.el-carousel__arrow i {
  456. font-size: 16px !important;
  457. }
  458. /deep/.el-carousel__arrow--left {
  459. left: 20px;
  460. width: 36px;
  461. height: 36px;
  462. color: #eee;
  463. background: rgba(0,0,0,0.5);
  464. border-radius: 50%;
  465. position: absolute;
  466. border: none;
  467. border-radius: 50%;
  468. }
  469. /deep/.el-carousel__arrow--right {
  470. right: 20px;
  471. width: 36px;
  472. height: 36px;
  473. color: #eee;
  474. background: rgba(0,0,0,0.5);
  475. position: absolute;
  476. border: none;
  477. border-radius: 50%;
  478. }
  479. /deep/ .el-carousel__indicators {
  480. // 指示器
  481. left: unset;
  482. transform: unset;
  483. right: 10px;
  484. bottom: 11px;
  485. }
  486. /deep/ .el-carousel__button {
  487. // 指示器按钮
  488. width: 10px;
  489. height: 10px;
  490. border: none;
  491. background: #fff;
  492. opacity: 1;
  493. }
  494. /deep/ .is-active .el-carousel__button {
  495. // 指示器激活按钮
  496. background: #fe8f00;
  497. width: 10px;
  498. height: 10px;
  499. opacity: 1;
  500. }
  501. /deep/ .el-carousel__container {
  502. height: 100%;
  503. }
  504. }
  505. .custom-indicator button {
  506. background-color: #fff;
  507. opacity: 1;
  508. width: 8px;
  509. height: 8px;
  510. }
  511. .custom-indicator button.is-active {
  512. background-color: #fe8f00;
  513. width: 58px;
  514. opacity: 1;
  515. }
  516. }
  517. //样式4 end ---------------------------------------->
  518. //样式5 start ------------------------------------->
  519. .swiperStyle5 {
  520. position: relative;
  521. .roll_num_box {
  522. position: absolute;
  523. z-index: 2;
  524. right: 35px;
  525. bottom: 5px;
  526. height: 60px;
  527. line-height: 60px;
  528. color: #fff;
  529. font-size: 20px;
  530. .roll_num_box_new {
  531. font-size: 20px;
  532. }
  533. }
  534. .dot1 {
  535. display: block;
  536. word-break: keep-all;
  537. white-space: nowrap;
  538. overflow: hidden;
  539. text-overflow: ellipsis;
  540. }
  541. .swiper_dot1 {
  542. display: block;
  543. width: 100%;
  544. line-height: 60px;
  545. height: 60px;
  546. color: #fff;
  547. font-size: 18px;
  548. text-indent: 20px;
  549. position: absolute;
  550. bottom: 0;
  551. left: 0;
  552. z-index: 10;
  553. box-sizing: border-box;
  554. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  555. }
  556. .el-carousel {
  557. :deep(.el-carousel__arrow i) {
  558. font-size: 33px !important;
  559. }
  560. .roll_1_box {
  561. position: relative;
  562. }
  563. :deep(.el-carousel__arrow--left) {
  564. left: 20px;
  565. width: 30px;
  566. height: 56px;
  567. color: #eee;
  568. background: rgba(0,0,0,0.5);
  569. border-radius: 50%;
  570. position: absolute;
  571. border: none;
  572. border-radius: 4px;
  573. }
  574. :deep(.el-icon-arrow-left:before) {
  575. font-size: 24px;
  576. line-height: 56px;
  577. }
  578. :deep(.el-carousel__arrow--right) {
  579. right: 20px;
  580. width: 30px;
  581. height: 56px;
  582. color: #eee;
  583. background: #00000080;
  584. position: absolute;
  585. border: none;
  586. border-radius: 4px;
  587. }
  588. :deep(.el-icon-arrow-right:before) {
  589. font-size: 24px;
  590. line-height: 56px;
  591. }
  592. :deep(.el-carousel__indicators) {
  593. display: none;
  594. }
  595. }
  596. .custom-indicator button {
  597. background-color: #fff;
  598. opacity: 1;
  599. width: 8px;
  600. height: 8px;
  601. }
  602. .custom-indicator button.is-active {
  603. background-color: #c82200;
  604. width: 58px;
  605. opacity: 1;
  606. }
  607. }
  608. //样式5 end ------------------------------------->
  609. //样式6 start ------------------------------------->
  610. .swiperStyle6 {
  611. position: relative;
  612. .roll_num_box {
  613. position: absolute;
  614. z-index: 2;
  615. right: 35px;
  616. bottom: 5px;
  617. height: 60px;
  618. line-height: 60px;
  619. color: #fff;
  620. font-size: 20px;
  621. .roll_num_box_new {
  622. font-size: 20px;
  623. }
  624. }
  625. .dot1 {
  626. display: block;
  627. word-break: keep-all;
  628. white-space: nowrap;
  629. overflow: hidden;
  630. text-overflow: ellipsis;
  631. }
  632. .swiper_dot1 {
  633. display: block;
  634. width: 100%;
  635. line-height: 60px;
  636. height: 60px;
  637. color: #fff;
  638. font-size: 18px;
  639. text-indent: 10px;
  640. position: absolute;
  641. bottom: 0;
  642. left: 0;
  643. z-index: 10;
  644. box-sizing: border-box;
  645. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  646. .title{
  647. display: inline-block;
  648. width: 490px;
  649. }
  650. }
  651. .el-carousel {
  652. :deep(.el-carousel__arrow i) {
  653. font-size: 33px !important;
  654. }
  655. .roll_1_box {
  656. position: relative;
  657. }
  658. :deep(.el-carousel__arrow--left) {
  659. left: 20px;
  660. width: 36px;
  661. height: 36px;
  662. color: #eee;
  663. background: rgba(0,0,0,0.5);
  664. border-radius: 50%;
  665. position: absolute;
  666. border: none;
  667. border-radius: 50%;
  668. }
  669. :deep(.el-icon-arrow-left:before) {
  670. font-size: 24px;
  671. line-height: 56px;
  672. }
  673. :deep(.el-carousel__arrow--right) {
  674. right: 20px;
  675. width: 36px;
  676. height: 36px;
  677. color: #eee;
  678. background: rgba(0,0,0,0.5);
  679. position: absolute;
  680. border: none;
  681. border-radius: 50%;
  682. }
  683. :deep(.el-icon-arrow-right:before) {
  684. font-size: 24px;
  685. line-height: 56px;
  686. }
  687. :deep(.el-carousel__indicators) {
  688. // 指示器
  689. left: unset;
  690. transform: unset;
  691. right: 10px;
  692. bottom: 11px;
  693. }
  694. :deep(.el-carousel__button) {
  695. // 指示器按钮
  696. width: 26px;
  697. height: 5px;
  698. border: none;
  699. background: #fff;
  700. opacity: 1;
  701. border-radius: 4px;
  702. }
  703. :deep(.is-active .el-carousel__button) {
  704. // 指示器激活按钮
  705. background: #154079;
  706. width: 26px;
  707. height: 5px;
  708. opacity: 1;
  709. }
  710. :deep(.el-carousel__container) {
  711. height: 100%;
  712. }
  713. }
  714. .custom-indicator button {
  715. background-color: #fff;
  716. opacity: 1;
  717. width: 8px;
  718. height: 8px;
  719. }
  720. .custom-indicator button.is-active {
  721. background-color: #154079;
  722. width: 58px;
  723. opacity: 1;
  724. }
  725. }
  726. //样式6 end ------------------------------------->
  727. </style>