多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
3.4 KiB

3 years ago
  1. <template>
  2. <div class="shop" :class="'terminal' + terminal">
  3. <swiper class="swiper" :indicator-dots="false" :autoplay="true" @change="swiperChange">
  4. <swiper-item class="shop-item" v-for="(item,index) in imgList" :key="index">
  5. <div class="shop-item-warp">
  6. <img class="img" :src="item.img" mode="widthFix">
  7. <div class="a-link" @click="jumpLink(item.linkObj)">
  8. 进店逛逛<i class="iconfont icon-arrow-right"></i>
  9. </div>
  10. </div>
  11. </swiper-item>
  12. </swiper>
  13. <view class="swiper-dots" v-if="imgList && imgList.length">
  14. <text class="dot" :class="index === swiperCurrent && 'dot-active'" v-for="(dot, index) in imgList.length"
  15. :key="index"></text>
  16. </view>
  17. </div>
  18. </template>
  19. <script>
  20. // import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
  21. // import 'swiper/css/swiper.css'
  22. import {funMixin} from '../config/mixin'
  23. export default {
  24. name: 'shop',
  25. mixins: [funMixin],
  26. data () {
  27. return {
  28. swiperCurrent: 0,
  29. }
  30. },
  31. methods:{
  32. swiperChange(e) {
  33. this.swiperCurrent = e.detail.current;
  34. }
  35. },
  36. props: {
  37. terminal: {
  38. type: Number,
  39. default: 4
  40. },
  41. componentContent: {
  42. type: Object
  43. }
  44. },
  45. // components: {
  46. // Swiper,
  47. // SwiperSlide
  48. // },
  49. // directives: {
  50. // swiper: directive
  51. // },
  52. computed: {
  53. imgList: function () {
  54. console.log(this.componentContent)
  55. return this.componentContent.imgTextData.filter(function (item) {
  56. return item.img
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .shop{
  64. position: relative;
  65. .swiper{
  66. height: 460upx;
  67. }
  68. &-item{
  69. &-warp{
  70. position: relative;
  71. padding: 0 20upx;
  72. .img{
  73. width: 100%;
  74. height: 420upx;
  75. }
  76. .a-link{
  77. width: 220upx;
  78. height: 80upx;
  79. line-height: 80upx;
  80. background: linear-gradient(225deg, #585858 0%, #333333 100%);
  81. box-shadow: 0px 20upx 40upx rgba(0, 0, 0, 0.3);
  82. display: block;
  83. color: #fff;
  84. font-size: 28upx;
  85. text-align: center;
  86. position: absolute;
  87. right: 0;
  88. bottom: 30upx;
  89. .icon{
  90. margin-left: 20upx;
  91. }
  92. }
  93. }
  94. }
  95. //.pagination{
  96. // display: flex;
  97. // justify-content: center;
  98. // padding:20upx 0;
  99. // ::v-deep .swiper-pagination-bullet{
  100. // width: 12upx;
  101. // height: 12upx;
  102. // background: #333333;
  103. // border-radius: 50%;
  104. // opacity: 0.2;
  105. // margin: 0 10upx;
  106. // }
  107. // ::v-deep .swiper-pagination-bullet-active{
  108. // width: 24upx;
  109. // height: 12upx;
  110. // background: #333333;
  111. // opacity: 1;
  112. // border-radius: 8upx;
  113. // }
  114. //}
  115. //::v-deep .uni-swiper-dots{
  116. // display: flex;
  117. // justify-content: center;
  118. // padding: 0upx 0;
  119. // .uni-swiper-dot{
  120. // width: 10upx;
  121. // height: 10upx;
  122. // background: #333333;
  123. // opacity: 0.3;
  124. // border-radius: 5upx;
  125. // margin: 0 5upx;
  126. // &-active{
  127. // width: 20upx;
  128. // height: 10upx;
  129. // opacity: 1;
  130. // }
  131. // }
  132. //}
  133. .swiper-dots {
  134. display: flex;
  135. position: absolute;
  136. left: 50%;
  137. transform: translateX(-50%);
  138. bottom: 15rpx;
  139. z-index: 66;
  140. .dot {
  141. width: 10upx;
  142. height: 10upx;
  143. background: #333333;
  144. opacity: 0.3;
  145. border-radius: 5upx;
  146. margin: 0 10upx;
  147. }
  148. .dot-active {
  149. width: 20upx;
  150. opacity: 1;
  151. }
  152. }
  153. }
  154. </style>