SwiperSnsc.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="swiper">
  3. <el-carousel :interval="3111" height="405px" indicator-class="custom-indicator" @change="handleIndicatorChange">
  4. <el-carousel-item v-for="item in imagelist" :key="item">
  5. <NuxtLink
  6. :to="`/${item.pinyin}/${item.id}.html`"
  7. :title="item.title">
  8. <img :src="item.imgurl" :alt="item.title">
  9. <span class="swiper_dot1 dot1">{{ item.title }}</span>
  10. </NuxtLink>
  11. </el-carousel-item>
  12. </el-carousel>
  13. </div>
  14. </template>
  15. <script setup>
  16. import { ElCarousel, ElCarouselItem } from 'element-plus'
  17. //获取焦点图数据 start---------------------------------------->
  18. const imagelist = ref("")
  19. async function getModelData1() {
  20. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  21. method: 'GET',
  22. query: {
  23. 'imgnum': 5,
  24. 'textnum': 0,
  25. 'level': 2,
  26. 'placeid': 0,
  27. 'id':''
  28. },
  29. });
  30. if(mkdata.code == 200){
  31. imagelist.value = mkdata.data.img;
  32. }else{
  33. console.log("错误位置错误:获取首页轮播图",mkdata.message)
  34. }
  35. }
  36. getModelData1()
  37. let currentIndex = ref(0)
  38. let handleIndicatorChange = (val) => {
  39. currentIndex.value = val
  40. }
  41. //获取焦点图数据 end---------------------------------------->
  42. </script>
  43. <style lang="less" scoped>
  44. .dot1 {
  45. display: block;
  46. word-break: keep-all;
  47. white-space: nowrap;
  48. overflow: hidden;
  49. text-overflow: ellipsis;
  50. }
  51. .swiper {
  52. width: 100%;
  53. height: 405px;
  54. position: relative;
  55. img {
  56. width: 100%;
  57. height: 405px;
  58. }
  59. .swiper_dot1 {
  60. display: block;
  61. width: 100%;
  62. line-height: 60px;
  63. height: 60px;
  64. color: #fff;
  65. font-size: 24px;
  66. text-indent: 20px;
  67. position: absolute;
  68. bottom: 0;
  69. left: 0;
  70. z-index: 10;
  71. box-sizing: border-box;
  72. padding-right: 244px;
  73. background:linear-gradient(0deg,rgba(0,0,0,0.5) 33%,rgba(0,0,0,0) 100%);
  74. }
  75. }
  76. .el-carousel {
  77. /deep/.el-carousel__arrow i {
  78. font-size: 30px !important;
  79. }
  80. /deep/.el-carousel__arrow--left {
  81. left: 16px;
  82. width: 35px;
  83. height: 57px;
  84. color: #616358;
  85. background: #dcdedc;
  86. position: absolute;
  87. left: 0px;
  88. border: none;
  89. border-radius: 0;
  90. }
  91. /deep/.el-carousel__arrow--right {
  92. right: 16px;
  93. width: 35px;
  94. height: 57px;
  95. color: #616358;
  96. background: #dcdedc;
  97. position: absolute;
  98. right: 0;
  99. border: none;
  100. border-radius: 0;
  101. }
  102. /deep/ .el-carousel__indicators {
  103. // 指示器
  104. left: unset;
  105. transform: unset;
  106. right: 10px;
  107. bottom: 11px;
  108. }
  109. /deep/ .el-carousel__button {
  110. // 指示器按钮
  111. width: 10px;
  112. height: 10px;
  113. border: none;
  114. border-radius: 5px;
  115. background: #fff;
  116. opacity: 1;
  117. }
  118. /deep/ .is-active .el-carousel__button {
  119. // 指示器激活按钮
  120. background: #255590;
  121. width: 25px;
  122. opacity: 1;
  123. }
  124. /deep/ .el-carousel__container {
  125. height: 100%;
  126. }
  127. }
  128. .custom-indicator button {
  129. background-color: #fff;
  130. opacity: 1;
  131. width: 8px;
  132. height: 8px;
  133. }
  134. .custom-indicator button.is-active {
  135. background-color: #DD7D18;
  136. width: 58px;
  137. opacity: 1;
  138. }
  139. </style>
  140. <style lang="less" scoped>
  141. @media screen and (min-width:801px){/*pc*/
  142. .pc_none{display:none;}
  143. }
  144. @media screen and (max-width:800px){/*ipad_phone*/
  145. .swiper{display:block;width:100%;height:100%;}
  146. /deep/.el-carousel--horizontal{width:100%!important;height:100%!important;}
  147. /deep/.el-carousel__container{height:100%!important;}
  148. /deep/.el-carousel__item a{height:100%;width:100%;display:block;}
  149. .swiper img {width:100%;height:100%;}
  150. .swiper .text{width:100%!important;padding-left:0px;top:0px;bottom:auto;height:54px!important;
  151. background: linear-gradient(to bottom, #000000, rgba(0, 0, 0, 0));
  152. }
  153. .swiper .text:after {
  154. display: none;
  155. }
  156. .swiper .swiper_dot1{
  157. padding:10px 3% 0;
  158. bottom:auto;top:0px;font-weight:bold;
  159. height:54px;line-height:22px;text-indent:0px;
  160. font-size:16px;box-sizing:border-box;
  161. white-space: normal;overflow:hidden;text-overflow:unset;
  162. display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  163. word-break: break-word;
  164. background: linear-gradient(to bottom, #000000, rgba(0, 0, 0, 0));
  165. }
  166. /deep/ .el-carousel .el-carousel__indicators{
  167. right:0px;width:100%;text-align:center;bottom:0px;
  168. }
  169. /deep/.el-carousel__button{opacity:1;}
  170. /deep/.el-carousel__indicator--horizontal{margin:0px 4px;}
  171. /deep/.el-carousel .el-carousel__button{width:8px!important;height:8px!important;}
  172. .phone_none{display:none;}
  173. }
  174. </style>