BigSwiper.vue 4.4 KB

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