BigSwiper.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div class="swiper" v-if="imagelist">
  3. <!-- 首页大轮播图 -->
  4. <el-carousel
  5. :interval="3333"
  6. class="roll_in"
  7. indicator-class="custom-indicator"
  8. arrow="always"
  9. @change="change_fun">
  10. <el-carousel-item v-for="(item, index) in imagelist" :key="item">
  11. <NuxtLink :href="getLinkPathDetail(item)">
  12. <img :src="item.imgurl" >
  13. <span class="swiper_dot1 dot1 roll_phone_none">
  14. {{ item.title }}
  15. </span>
  16. <span class="roll_dot2 roll_pc_none">
  17. {{ item.title }}
  18. </span>
  19. </NuxtLink>
  20. </el-carousel-item>
  21. <div class="roll_num_box phone_none">
  22. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>
  23. /
  24. {{ roll_num_lang }}
  25. </div>
  26. <template #indicator="{ index }">
  27. <button :class="{ 'active-indicator': currentIndex === index }">{{ index + 1 }}</button>
  28. </template>
  29. </el-carousel>
  30. </div>
  31. </template>
  32. <script setup>
  33. import { ElCarousel, ElCarouselItem } from 'element-plus'
  34. //获取焦点图数据 start---------------------------------------->
  35. import { ref } from 'vue'
  36. const roll_num_lang = ref(4);
  37. const roll_num_this = ref(0);
  38. const change_fun = (the_1) => {
  39. roll_num_this.value = the_1
  40. }
  41. const imagelist = ref("")
  42. async function getModelData1() {
  43. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  44. method: 'GET',
  45. query: {
  46. 'imgnum':4,
  47. 'textnum':0,
  48. 'level': 2,
  49. 'placeid': 0,
  50. 'id': '',
  51. },
  52. });
  53. console.log("获取首页轮播图",mkdata);
  54. if(mkdata.code == 200){
  55. imagelist.value = mkdata.data.img;
  56. }else{
  57. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  58. // console.log("错误位置:获取首页轮播图")
  59. // console.log("后端错误反馈:",mkdata.message)
  60. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  61. }
  62. }
  63. getModelData1()
  64. let currentIndex = ref(0)
  65. let handleIndicatorChange = (val) => {
  66. currentIndex.value = val
  67. }
  68. </script>
  69. <style lang="less" scoped>
  70. .roll_num_box {
  71. position: absolute;
  72. z-index: 2;
  73. left: 60px;
  74. bottom: 0px;
  75. height: 60px;
  76. line-height: 60px;
  77. color: #fff;
  78. font-size: 16px;
  79. .roll_num_box_new {
  80. font-size: 20px;
  81. }
  82. }
  83. .dot1 {
  84. display: block;
  85. word-break: keep-all;
  86. white-space: nowrap;
  87. overflow: hidden;
  88. text-overflow: ellipsis;
  89. }
  90. .swiper {
  91. width: 100%;
  92. height: 405px;
  93. position: relative;
  94. img {
  95. width: 100%;
  96. height: 405px;
  97. }
  98. .swiper_dot1 {
  99. display: block;
  100. width: 100%;
  101. line-height: 60px;
  102. height: 60px;
  103. color: #fff;
  104. font-size: 18px;
  105. text-indent: 20px;
  106. position: absolute;
  107. bottom: 0;
  108. left: 0;
  109. z-index: 10;
  110. box-sizing: border-box;
  111. padding: 0 144px;
  112. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  113. }
  114. }
  115. .el-carousel {
  116. /deep/.el-carousel__arrow i {
  117. font-size: 33px !important;
  118. }
  119. .roll_1_box {
  120. position: relative;
  121. }
  122. /deep/.el-carousel__arrow--left {
  123. position: absolute;
  124. width: 35px;
  125. height: 57px;
  126. color: #fff;
  127. background: rgba(0, 0, 0, 0);
  128. left: 9px;
  129. border: none;
  130. border-radius: 0;
  131. top: 100%;
  132. margin-top: -28px;
  133. }
  134. /deep/.el-carousel__arrow--right {
  135. width: 35px;
  136. height: 57px;
  137. color: #fff;
  138. background: rgba(0, 0, 0, 0);
  139. position: absolute;
  140. right: 9;
  141. border: none;
  142. border-radius: 0;
  143. top: 100%;
  144. margin-top: -28px;
  145. }
  146. /deep/ .el-carousel__indicators {
  147. // 指示器
  148. left: unset;
  149. transform: unset;
  150. right: 10px;
  151. bottom: 11px;
  152. }
  153. /deep/ .el-carousel__button {
  154. // 指示器按钮
  155. width: 10px;
  156. height: 10px;
  157. border: none;
  158. border-radius: 5px;
  159. background: #fff;
  160. opacity: 1;
  161. }
  162. /deep/ .is-active .el-carousel__button {
  163. // 指示器激活按钮
  164. background: #004564;
  165. width: 25px;
  166. opacity: 1;
  167. }
  168. /deep/ .el-carousel__container {
  169. height: 100%;
  170. }
  171. }
  172. .custom-indicator button {
  173. background-color: #fff;
  174. opacity: 1;
  175. width: 8px;
  176. height: 8px;
  177. }
  178. .custom-indicator button.is-active {
  179. background-color: #DD7D18;
  180. width: 58px;
  181. opacity: 1;
  182. }
  183. </style>
  184. <style lang="less" scoped>
  185. @media screen and (min-width:801px){/*pc*/
  186. .roll_in{height:405px;}
  187. .swiper /deep/.el-carousel__indicators{display:none;}
  188. .roll_pc_none{display:none!important;}
  189. .pc_none{display:none;}
  190. }
  191. @media screen and (max-width:800px){/*ipad_phone*/
  192. .swiper{height:100%;}
  193. .roll_in{height:55vw;}
  194. .swiper /deep/ul.el-carousel__indicators{width:100%; right:0px;text-align:center;}
  195. .swiper img{width:100%;height:100%;}
  196. .roll_in{height:55vw;}
  197. .el-carousel /deep/.el-icon svg{width:.4em;display:none;}
  198. .el-carousel /deep/.el-carousel__button{width:10px;height:10px;margin:0px 4px;}
  199. .roll_dot2{
  200. width:100%;line-height:22px; height:54px;font-size:16px;
  201. padding:10px 10px 0;top:0px;
  202. display: inline-block;
  203. box-sizing: border-box;
  204. position: absolute;
  205. left: 0;
  206. font-family: Source Han Sans, Source Han Sans;
  207. font-weight: 800;
  208. color: #FFFFFF;
  209. background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  210. overflow:hidden;display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  211. }
  212. /deep/.el-carousel .el-carousel__button{width:10px!important;}
  213. /deep/.el-carousel .el-carousel__indicators{bottom:0px;}
  214. .roll_phone_none{display:none!important;}
  215. .phone_none{display:none;}
  216. }
  217. </style>