You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.2 KiB

8 months ago
8 months ago
  1. <template>
  2. <view class="winningRecord bx">
  3. <navbar :leftClick="leftClick" :title="$t('page.winningRecord.title')"></navbar>
  4. <view v-if="turntableRecord.length > 0" class="winningRecord-list">
  5. <view v-for="item in turntableRecord" :key="item.id" class="winningRecord-item">
  6. <view class="winningRecord-item-left">
  7. <image src="@/static/winningRecord/gift.png" mode="aspectFit"></image>
  8. <view class="detail">
  9. <view class="title">{{ $t(`page.winningRecord.${getTurntableDetail(item.bigId,'name')}`) }}</view>
  10. <view class="money">{{ $t('page.winningRecord.money') }}:{{ getTurntableDetail(item.bigId,'money') }}</view>
  11. </view>
  12. </view>
  13. <view class="winningRecord-item-right">
  14. {{ item.createTime}}
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 无粉丝 -->
  19. <view v-else class="noFans">{{ $t('page.winningRecord.noPrizesHaveBeenWon') }}</view>
  20. </view>
  21. </template>
  22. <script>
  23. import navbar from '@/components/base/m-navbar.vue'
  24. export default {
  25. components : { navbar },
  26. data(){
  27. return {
  28. winningRecordList : [],
  29. turntableRecord : []
  30. }
  31. },
  32. onShow(){
  33. this.getTurntable()
  34. },
  35. methods: {
  36. leftClick() {
  37. uni.navigateTo({
  38. url: '/pages/home/home'
  39. })
  40. },
  41. //大转盘记录
  42. getTurntableRecord(){
  43. this.request('getTurntableRecord').then(res => {
  44. if (res.code == 200) {
  45. this.turntableRecord = res.result
  46. }
  47. })
  48. },
  49. //获取大转盘列表
  50. getTurntable(){
  51. this.request('getTurntableList').then(res => {
  52. if(res.code == 200){
  53. this.winningRecordList = res.result
  54. this.getTurntableRecord()
  55. }
  56. })
  57. },
  58. //获取中奖详情
  59. getTurntableDetail(id, key) {
  60. const item = this.winningRecordList.find(item => item.id === id);
  61. return item ? item[key] : {}; // 如果没有找到,可以返回一个默认值
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .winningRecord{
  68. width: 750rpx;
  69. min-height: 100vh;
  70. background-color: black;
  71. margin: 0 auto;
  72. background-size: 100%;
  73. background-repeat: no-repeat;
  74. color: white;
  75. .winningRecord-list{
  76. width: 96%;
  77. margin: 0rpx auto;
  78. margin-top: 20rpx;
  79. .winningRecord-item{
  80. background: #333333;
  81. padding: 10rpx 20rpx;
  82. border-radius: 10rpx;
  83. display: flex;
  84. justify-content: space-between;
  85. margin-bottom: 20rpx;
  86. .winningRecord-item-left{
  87. display: flex;
  88. width: 70%;
  89. overflow: hidden;
  90. image{
  91. width: 130rpx;
  92. height: 130rpx;
  93. }
  94. .detail{
  95. width: calc(100% - 130rpx);
  96. display: flex;
  97. flex-direction: column;
  98. justify-content: space-around;
  99. padding: 20rpx 0rpx;
  100. padding-right: 15rpx;
  101. box-sizing: border-box;
  102. .title{
  103. white-space: nowrap;
  104. text-overflow: ellipsis;
  105. overflow: hidden;
  106. font-size: 30rpx;
  107. }
  108. .money{
  109. color: #ccc;
  110. font-size: 26rpx;
  111. }
  112. }
  113. }
  114. .winningRecord-item-right{
  115. display: flex;
  116. align-items: center;
  117. justify-content: flex-end;
  118. font-size: 20rpx;
  119. color: #ccc;
  120. width: 30%;
  121. }
  122. }
  123. }
  124. .noFans{
  125. height: 100vh;
  126. display: flex;
  127. align-items: center;
  128. justify-content: center;
  129. color: #ffffff80;
  130. }
  131. }
  132. </style>