banner.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view>
  3. <view class="swiper-banner-content">
  4. <view class="swiper-banner-box">
  5. <swiper
  6. class="tui-banner-swiper tui-banner tui-skeleton-fillet"
  7. :autoplay="true"
  8. :interval="5000"
  9. :duration="500"
  10. @change="swiperChange"
  11. :circular="true"
  12. >
  13. <swiper-item v-for="(item, index) in list" :key="index" @click.stop="NavToDetailPage(item)">
  14. <image :src="item.image" class="tui-slide-image" mode="scaleToFill" />
  15. </swiper-item>
  16. </swiper>
  17. <view class="swiper__dots-box" v-if="list.length > 1">
  18. <view
  19. v-for="(item, idx) in list"
  20. :key="idx"
  21. :class="[idx === current ? 'swiper__dots-long' : 'none']"
  22. :data-index="current"
  23. class="swiper__dots-item"
  24. >
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import cmsMixins from '@/mixins/cmsMixins.js'
  33. export default {
  34. mixins: [cmsMixins],
  35. name: 'banner',
  36. props: {
  37. list: {
  38. type: Array
  39. }
  40. },
  41. data() {
  42. return {
  43. current: 0
  44. }
  45. },
  46. created() {},
  47. computed: {},
  48. methods: {
  49. swiperChange(e) {
  50. //轮播图切换
  51. const index = e.detail.current
  52. this.current = index
  53. },
  54. NavToDetailPage(floor) {
  55. //跳转
  56. this.cmsSysStatistics(1)
  57. this.$api.FlooryNavigateTo(floor)
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .swiper-banner-content {
  64. width: 100%;
  65. height: auto;
  66. position: relative;
  67. background-size: cover;
  68. }
  69. .swiper-banner-box {
  70. width: 100%;
  71. height: 360rpx;
  72. position: relative;
  73. background-size: cover;
  74. }
  75. .tui-banner-swiper {
  76. width: 700rpx;
  77. margin: 0 auto;
  78. height: 340rpx;
  79. border-radius: 8rpx;
  80. overflow: hidden;
  81. transform: translateY(0);
  82. box-shadow: 0px 3px 6px rgba(225, 86, 22, 0.08);
  83. margin-top: 16rpx;
  84. .banner-item {
  85. border-radius: 8rpx;
  86. }
  87. .tui-slide-image {
  88. width: 100%;
  89. height: 340rpx;
  90. display: block;
  91. }
  92. }
  93. .swiper__dots-box {
  94. position: absolute;
  95. bottom: 40rpx;
  96. left: 0;
  97. right: 0;
  98. /* #ifndef APP-NVUE */
  99. display: flex;
  100. /* #endif */
  101. flex: 1;
  102. flex-direction: row;
  103. justify-content: center;
  104. align-items: center;
  105. .swiper__dots-item {
  106. width: 8rpx;
  107. height: 8rpx;
  108. border-radius: 100%;
  109. margin-left: 6px;
  110. background-color: rgba(255, 255, 255, 0.7);
  111. }
  112. .swiper__dots-long {
  113. width: 35rpx;
  114. height: 8rpx;
  115. border-radius: 4rpx;
  116. background-color: #ffff;
  117. transition: all 0.4s;
  118. }
  119. }
  120. </style>