BigSwiper.vue 4.3 KB

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