index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <scroll-view class="rights-container" scroll-y="true" :style="'height:'+windowHeight+'px'" @touchstart="touchStart">
  3. <!-- #ifdef MP -->
  4. <NavBar navTitle="会员权益" :isBackgroundColor="false" iconColor='#fff' ref="navBarRef"></NavBar>
  5. <!-- #endif -->
  6. <view class="header acea-row">
  7. <view v-for="(item, index) in benefitsList" :key="index" class="item acea-row row-column row-middle"
  8. :class="{ on: currentIndex == index }" @click="currentIndex = index">
  9. <view class="image-wrap acea-row row-center row-middle">
  10. <view class="image-wrap-inner acea-row row-center-wrapper">
  11. <image class="image" :src="item.imageUrl"></image>
  12. </view>
  13. </view>
  14. <view>{{ item.value }}</view>
  15. </view>
  16. </view>
  17. <swiper class="swiper" :current="currentIndex" :interval="3000" :duration="1000" previous-margin="58rpx"
  18. next-margin="58rpx" @change="swiperChange">
  19. <swiper-item v-for="(item, index) in benefitsList" :key="index">
  20. <view class="swiper-item acea-row row-column" :class="{ on: currentIndex == index }">
  21. <view class="title acea-row row-center-wrapper h-124 relative">
  22. <image class="h-124 absolute w-100-p111-" :src="`${urlDomain}crmebimage/presets/quanyibj.png`"></image>
  23. <view class="svip-line w-140" :style="{'background-image': `url(${urlDomain}crmebimage/presets/svipzuo.png)`}"></view>
  24. <view class="ml-12 mr-12 relative z-99">{{ item.value }}</view>
  25. <view class="svip-line w-140" :style="{'background-image': `url(${urlDomain}crmebimage/presets/svipyou.png)`}"></view>
  26. </view>
  27. <scroll-view class="scroll-view" scroll-y="true">
  28. <view v-html="item.expand || ''"></view>
  29. </scroll-view>
  30. </view>
  31. </swiper-item>
  32. </swiper>
  33. </scroll-view>
  34. </template>
  35. <script>
  36. import {
  37. svipBenefitsListApi,
  38. } from '@/api/activity.js';
  39. import NavBar from '@/components/navBar.vue';
  40. export default {
  41. components: {
  42. NavBar
  43. },
  44. data() {
  45. return {
  46. urlDomain:this.$Cache.get("imgHost"),
  47. benefitsList: [],
  48. currentIndex: 0,
  49. windowHeight: 0
  50. }
  51. },
  52. created() {
  53. // 获取设备宽度
  54. let that = this
  55. uni.getSystemInfo({
  56. success(e) {
  57. that.windowHeight = e.windowHeight;
  58. }
  59. });
  60. },
  61. onLoad(options) {
  62. this.currentIndex = options.currentIndex || 0
  63. this.getBenefitsList();
  64. },
  65. methods: {
  66. //滚动
  67. touchStart() {
  68. this.$refs.navBarRef.currentPage = false;
  69. },
  70. getBenefitsList() {
  71. uni.showLoading({
  72. title: '正在加载…'
  73. });
  74. svipBenefitsListApi().then(res => {
  75. uni.hideLoading();
  76. this.benefitsList = res.data;
  77. }).catch(err => {
  78. uni.showToast({
  79. title: err,
  80. icon: 'none'
  81. });
  82. });
  83. },
  84. swiperChange(e) {
  85. this.currentIndex = e.detail.current;
  86. },
  87. },
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .svip-line{
  92. height: 2rpx;
  93. background-repeat: no-repeat;
  94. background-size: 100% 100%;
  95. }
  96. .rights-container {
  97. /* #ifndef H5 */
  98. position: absolute;
  99. /* #endif */
  100. top: 0;
  101. right: 0;
  102. bottom: 0;
  103. left: 0;
  104. background: linear-gradient(180deg, #312B23 0%, #19140E 100%);
  105. padding-bottom: calc(40rpx + constant(safe-area-inset-bottom));
  106. padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
  107. .header {
  108. .item {
  109. flex: 1;
  110. padding: 48rpx 0 56rpx;
  111. font-size: 24rpx;
  112. line-height: 34rpx;
  113. color: rgba(255, 255, 255, 0.4);
  114. &.on {
  115. color: rgba(255, 255, 255, 0.8);
  116. .image {
  117. opacity: 1;
  118. }
  119. }
  120. }
  121. .image-wrap {
  122. position: relative;
  123. width: 88rpx;
  124. height: 88rpx;
  125. border-radius: 50%;
  126. margin-bottom: 28rpx;
  127. background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 2%, rgba(255, 255, 255, 0) 100%);
  128. .image-wrap-inner {
  129. width: 42rpx;
  130. height: 37rpx;
  131. }
  132. }
  133. .image {
  134. width: 100%;
  135. height: 100%;
  136. opacity: 0.3;
  137. }
  138. }
  139. .swiper {
  140. height: 76%;
  141. }
  142. .swiper-item {
  143. height: 100%;
  144. transform: scale(0.9);
  145. transition: 0.3s;
  146. &.on {
  147. transform: scale(1);
  148. }
  149. .title {
  150. padding: 42rpx 0 40rpx;
  151. border-radius: 24rpx 24rpx 0 0;
  152. background: linear-gradient(270deg, #FDF4E4 0%, #FEFAE9 100%);;
  153. text-align: center;
  154. font-weight: 700;
  155. font-size: 34rpx;
  156. line-height: 42rpx;
  157. color: #333333;
  158. image{
  159. top: 0;
  160. }
  161. }
  162. }
  163. .scroll-view {
  164. flex: 1;
  165. min-height: 0;
  166. padding: 48rpx;
  167. border-radius: 0 0 24rpx 24rpx;
  168. background-color: #FFFFFF;
  169. box-sizing: border-box;
  170. }
  171. }
  172. </style>