index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <page title="奖品" ref="pageRef" light nav-color="transparent">
  3. <view class="bg"></view>
  4. <image :src="resource.popularize_bg" class="bg-2" />
  5. <view style="height: 40rpx"></view>
  6. <view v-if="prizeList && prizeList.length > 0">
  7. <view class="flex-wrap flex-align-center">
  8. <view v-for="(item, index) in prizeList" :key="index" class="item flex-align-center" @click="showSpu(item)">
  9. <image :src="item.cover" class="image" mode="aspectFit" />
  10. <image v-if="rank[index + 1]" :src="rank[index + 1]" class="flag" mode="heightFix"/>
  11. <view v-if="item.user" class="user flex-column-align-center">
  12. <image :src="item.user.avatar" :style="{width: '40px', height: '40px', borderRadius: '20px'}" />
  13. <view class="paddingX10 color-white marginT10 font3">{{item.user.nickname}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view v-if="peoples && peoples.length > 0" class="marginT20 paddingX15">
  19. <view v-for="(item, index) in peoples" :key="index" class="cell flex-align" style="margin-bottom: 10px">
  20. <view class="index bold color-1">{{index + 1}}</view>
  21. <image v-if="index === 0" class="rank_flag translateY" :src="resource.prince_rank_1" />
  22. <image v-if="index === 1" class="rank_flag translateY" :src="resource.prince_rank_2" />
  23. <image v-if="index === 2" class="rank_flag translateY" :src="resource.prince_rank_3" />
  24. <image :src="item.avatar" style="width: 52rpx;height:52rpx;border-radius: 26rpx" />
  25. <view class="color-1 font2 marginL12 flex1">{{item.nickname}}</view>
  26. </view>
  27. </view>
  28. <goods-detail ref="goodsDetailRef" />
  29. </page>
  30. </template>
  31. <script>
  32. import resource from '@/utils/resource'
  33. import goodsDetail from './../store/goods_detail'
  34. const RANK_FLAG = {
  35. 1: resource.rank_1,
  36. 2: resource.rank_2,
  37. 3: resource.rank_3,
  38. 4: resource.rank_4,
  39. 5: resource.rank_5,
  40. 6: resource.rank_6,
  41. 7: resource.rank_7,
  42. 8: resource.rank_8,
  43. 9: resource.rank_9,
  44. 10: resource.rank_10,
  45. 11: resource.rank_normal,
  46. }
  47. export default {
  48. components: { goodsDetail },
  49. data() {
  50. return {
  51. resource,
  52. prizeList: [],
  53. rank: RANK_FLAG,
  54. peoples: []
  55. }
  56. },
  57. mounted() {
  58. this.getData()
  59. },
  60. methods: {
  61. async getData() {
  62. const res = await this.$service.weal.rich()
  63. if (res) {
  64. if (res.winnerList) {
  65. res.prizeList.forEach((item, index) => {
  66. if (res.winnerList.length > index) {
  67. item.user = res.winnerList[index]
  68. }
  69. })
  70. }
  71. this.prizeList = res.prizeList
  72. }
  73. },
  74. showSpu(spu) {
  75. this.$refs.goodsDetailRef.show(spu)
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .bg {
  82. position: fixed;
  83. left: 0;
  84. right: 0;
  85. top: 0;
  86. bottom: 0;
  87. background: linear-gradient(180deg, #8332f5 0%, #2f4abd 100%);
  88. z-index: -1;
  89. }
  90. .bg-2 {
  91. position: fixed;
  92. z-index: -1;
  93. left: 0;
  94. top: 0;
  95. width: 100%;
  96. height: 1624rpx;
  97. z-index: 0;
  98. }
  99. .item {
  100. margin: 10rpx 12rpx;
  101. position: relative;
  102. width: 152rpx;
  103. height: 180rpx;
  104. background: #ffffff;
  105. box-shadow: inset 0px 0px 30rpx 0px rgba(125, 84, 255, 0.5);
  106. border-radius: 12rpx;
  107. .image {
  108. width: 132rpx;
  109. height: 150rpx;
  110. }
  111. .flag {
  112. width: 0rpx;
  113. height: 26rpx;
  114. position: absolute;
  115. right: 0;
  116. bottom: 0;
  117. }
  118. .user {
  119. position: absolute;
  120. left: 0;
  121. top: 0;
  122. right: 0;
  123. bottom: 0;
  124. background: rgba($color: #000, $alpha: 0.5);
  125. }
  126. }
  127. .cell {
  128. position: relative;
  129. height: 48px;
  130. background: rgba($color: #8f4bf1, $alpha: 0.1);
  131. border-radius: 4px;
  132. padding-left: 13px;
  133. padding-right: 25px;
  134. .index {
  135. width: 70px;
  136. }
  137. .num {
  138. font-size: 12px;
  139. }
  140. &.my {
  141. background: #8f4bf1;
  142. .num {
  143. color: #fff;
  144. }
  145. }
  146. .rank_flag {
  147. width: 21px;
  148. height: 20px;
  149. position: absolute;
  150. left: 35px;
  151. }
  152. }
  153. </style>