catch_record.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="cu-modal bottom-modal" :class="{ show: visible }">
  3. <view class="mask" @click="close"></view>
  4. <view class="wrapper cu-dialog">
  5. <view :style="{ height: wrapperWidth + 'rpx' }">
  6. <view>
  7. <view class="title">
  8. 中奖记录
  9. <view class="close" @click="close">
  10. <text class="cuIcon-close"></text>
  11. </view>
  12. </view>
  13. </view>
  14. <view v-if="data && data.length > 0">
  15. <scroll-view
  16. :style="{ height: wrapperWidth - 132 + 'rpx' }"
  17. :scroll-y="true"
  18. refresher-enabled
  19. refresher-default-style="white"
  20. @refresherrefresh="refresh"
  21. :refresher-triggered="refreshing"
  22. @scrolltolower="loadMore"
  23. >
  24. <view>
  25. <view
  26. v-for="(item, index) in data"
  27. class="item flex-align"
  28. :key="index"
  29. >
  30. <image :src="item.avatar || resource.defaultAvatar" class="icon" />
  31. <view class="font2 marginL12 flex1">
  32. {{ item.nickname }}
  33. </view>
  34. <view class="font2 marginL12 flex1">获得了</view>
  35. <view
  36. class="marginL20 font2 line-ellipsis"
  37. style="width: 30%;color:#FEC433;"
  38. >
  39. {{ item.name }}
  40. </view>
  41. <image :src="item.cover" class="image marginL20" />
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. <empty v-else :top="150" />
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import resource from '@/utils/resource'
  53. import empty from '@/components/empty'
  54. export default {
  55. components: { empty },
  56. data() {
  57. return {
  58. resource,
  59. visible: false,
  60. data: [],
  61. refreshing: false,
  62. requesting: false,
  63. current: 1,
  64. size: 20
  65. }
  66. },
  67. computed: {
  68. wrapperWidth() {
  69. return (this.$store.state.systemInfo.screenHeight / 3) * 2 * 2
  70. }
  71. },
  72. methods: {
  73. show() {
  74. this.visible = true
  75. this.data = []
  76. this.refresh()
  77. },
  78. refresh() {
  79. if (this.requesting) return
  80. this.current = 1
  81. this.refreshing = true
  82. this.data = []
  83. this.getData()
  84. },
  85. loadMore() {
  86. if (this.requesting) return
  87. if (this.data.length > 0 && this.data.length % this.size === 0) {
  88. this.current += 1
  89. this.getData()
  90. }
  91. },
  92. async getData() {
  93. this.requesting = true
  94. const res = await this.$service.weal.prizeReslut({
  95. current: this.current,
  96. size: this.size
  97. })
  98. this.refreshing = false
  99. if (res.records && res.records.length > 0) {
  100. this.data.push(...res.records)
  101. }
  102. this.requesting = false
  103. },
  104. close() {
  105. this.current = 1
  106. this.visible = false
  107. this.$emit('close', false)
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .mask {
  114. position: absolute;
  115. left: 0;
  116. right: 0;
  117. top: 0;
  118. bottom: 0;
  119. }
  120. .wrapper {
  121. background: #fff;
  122. border-radius: 15px 15px 2px 2px !important;
  123. .title {
  124. text-align: center;
  125. font-size: 32rpx;
  126. font-family: Source Han Sans, Source Han Sans;
  127. font-weight: 700;
  128. color: #000000;
  129. padding: 44rpx 0 48rpx 0;
  130. position: relative;
  131. }
  132. .close {
  133. position: absolute;
  134. right: 0;
  135. width: 48rpx;
  136. height: 48rpx;
  137. background: #ebebeb;
  138. border-radius: 48rpx;
  139. color: #a2a2a2;
  140. top: 30rpx;
  141. line-height: 48rpx;
  142. }
  143. .item {
  144. padding: 0 16rpx 0 40rpx;
  145. margin: 0 28rpx 20rpx 28rpx;
  146. height: 116rpx;
  147. border-radius: 8rpx;
  148. background: #FFF7E3;
  149. .icon {
  150. width: 64rpx;
  151. height: 64rpx;
  152. border-radius: 50%;
  153. }
  154. .image {
  155. width: 48rpx;
  156. height: 48rpx;
  157. border-radius: 24rpx;
  158. background-color: #fff;
  159. }
  160. }
  161. }
  162. </style>