successCases.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="successCases">
  3. <slot name="supplier-title"></slot>
  4. <scroll-view scroll-x="true" class="scroll-view" @scroll="scrollX" :scroll-into-view="activeMenu" scroll-with-animation="true">
  5. <view
  6. class="swiper-item"
  7. v-for="item in successList"
  8. :key="item.id"
  9. :id="`item${index}`"
  10. :style="{ margin: item.id === 2 ? '40rpx' : '' }"
  11. >
  12. <view class="swiper-item-title">{{ item.title }}</view>
  13. <view class="swiper-item-contant" v-html="item.content"></view>
  14. <image :src="item.headAppBanner" mode="" class="swiper-item-img"></image>
  15. </view>
  16. </scroll-view>
  17. <view class="scroll-dots">
  18. <page-dots :pageAll="successList.length" :isActive="isSuccess" @hanlder-click="hanlderClick" />
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import PageDots from './swiper-dots.vue'
  24. export default {
  25. props: {
  26. successList: {
  27. type: Array,
  28. default: () => []
  29. }
  30. },
  31. components: {
  32. PageDots
  33. },
  34. data() {
  35. return {
  36. isSuccess: 0,
  37. activeMenu: 'item0'
  38. }
  39. },
  40. methods: {
  41. scrollX($event) {
  42. const data = Math.floor($event.detail.scrollLeft / 192)
  43. this.isSuccess = data
  44. },
  45. hanlderClick($event) {
  46. this.isSuccess = $event
  47. this.activeMenu = `item${$event}`
  48. },
  49. }
  50. }
  51. </script>
  52. <style scoped lang="scss">
  53. .successCases {
  54. padding: 1px;
  55. box-sizing: border-box;
  56. background-color: #fff;
  57. position: relative;
  58. }
  59. .scroll-view {
  60. height: 1400rpx;
  61. padding-left: 32rpx;
  62. width: 100%;
  63. box-sizing: border-box;
  64. white-space: nowrap;
  65. position: relative;
  66. background-color: #fff;
  67. }
  68. .swiper-item {
  69. width: 566rpx;
  70. height: 1124rpx;
  71. box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(102, 102, 102, 0.3);
  72. background: #ffffff;
  73. margin: 40rpx 0 40rpx 40rpx;
  74. box-sizing: border-box;
  75. padding: 50rpx;
  76. overflow-wrap: break-word;
  77. white-space: normal;
  78. display: inline-flex;
  79. flex-direction: column;
  80. position: relative;
  81. align-items: center;
  82. }
  83. .swiper-item-title {
  84. color: #333333;
  85. font-size: 32rpx;
  86. font-weight: 600;
  87. }
  88. .swiper-item-contant {
  89. font-size: 24rpx;
  90. color: #666666;
  91. line-height: 48rpx;
  92. overflow-wrap: break-word;
  93. white-space: normal;
  94. margin-top: 40rpx;
  95. }
  96. .swiper-item-img {
  97. width: 468rpx;
  98. height: 274rpx;
  99. position: absolute;
  100. left: 48rpx;
  101. bottom: 40rpx;
  102. }
  103. .scroll-dots {
  104. position: absolute;
  105. left: 50%;
  106. bottom: 140rpx;
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. transform: translateX(-50%);
  111. .scroll-dot {
  112. width: 12rpx;
  113. height: 12rpx;
  114. border-radius: 50%;
  115. background-color: #FFBD99;
  116. margin-right: 16rpx;
  117. }
  118. }
  119. .isActive {
  120. background: #ff5b00 !important;
  121. }
  122. </style>