BigSwiper.vue 4.4 KB

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