BigSwiper.vue 6.6 KB

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