banner_1.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="banner">
  3. <view class="banner_1">
  4. <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
  5. indicator-active-color="#FB1438" :interval="3000" :duration="1000">
  6. <swiper-item class="list" v-for="(item,index) in fileList" :key="index">
  7. <image class="image"
  8. v-if="item.url.indexOf('gif') != -1 || item.url.indexOf('jpg') != -1 || item.url.indexOf('png') != -1 || item.url.indexOf('jpeg') !=-1"
  9. :src="item.url" mode="aspectFit"></image>
  10. <video class="image" :autoplay='false' :show-fullscreen-btn="false" :loop="false" controls v-else
  11. :src="item.url"></video>
  12. </swiper-item>
  13. </swiper>
  14. <!-- 是否关注商品 -->
  15. <view class="goodsColect">
  16. <text @tap="toGoodscolect"
  17. :class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
  18. </view>
  19. <view class="acttags" v-if="acttagsList.length>0">
  20. <text v-for="(i,indexx) in acttagsList" :key="indexx">{{i.label}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. goodsInfo: {
  29. type: Object,
  30. },
  31. goodsColect: {
  32. type: Boolean
  33. }
  34. },
  35. data() {
  36. return {
  37. // 图片
  38. fileList: [],
  39. // 活动
  40. acttagsList: [],
  41. };
  42. },
  43. methods: {
  44. toGoodscolect() {
  45. const that = this;
  46. that.$emit('toGoodscolect')
  47. }
  48. },
  49. watch: {
  50. goodsInfo: {
  51. deep: true,
  52. immediate: true,
  53. handler(val) {
  54. if (val && val.file.length > 0) this.$set(this, `fileList`, val.file)
  55. if (val && val.act_tags.length > 0) this.$set(this, `acttagsList`, val.act_tags)
  56. }
  57. }
  58. },
  59. }
  60. </script>
  61. <style lang="scss">
  62. .banner {
  63. .banner_1 {
  64. border-bottom: 0.5vw solid var(--f9Color);
  65. swiper {
  66. height: 44vh !important;
  67. }
  68. .list {
  69. .image {
  70. width: 100%;
  71. height: 100%;
  72. background-color: #fff;
  73. }
  74. }
  75. .goodsColect {
  76. position: fixed;
  77. top: 2vw;
  78. right: 3vw;
  79. z-index: 99;
  80. background-color: #858585;
  81. border-radius: 90px;
  82. text {
  83. font-size: 30px;
  84. }
  85. }
  86. .acttags {
  87. position: absolute;
  88. top: 1vw;
  89. left: 1vw;
  90. width: 97%;
  91. text {
  92. display: inline-block;
  93. background-color: var(--fFB1Color);
  94. color: #fff;
  95. border-radius: 1vw;
  96. padding: 0.5vw;
  97. font-size: 12px;
  98. margin: 0 1vw 0 0;
  99. }
  100. }
  101. }
  102. }
  103. </style>