myWinningRecord.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <u-navbar title="获奖记录" >
  4. </u-navbar>
  5. <view class="main">
  6. <view class="winning-box" v-for="(item,i) in list" :key="i" >
  7. <view class="item">
  8. <view class="title">
  9. 活动:
  10. </view>
  11. <view class="value">
  12. {{item.name}}
  13. </view>
  14. </view>
  15. <view class="item">
  16. <view class="title">
  17. 奖励:
  18. </view>
  19. <view class="value highlight">
  20. {{item.prize}}
  21. </view>
  22. </view>
  23. <view class="else">
  24. <view class="state">
  25. {{item.status}}
  26. </view>
  27. <view class="date">
  28. {{item.date}}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <u-divider v-if="list.length==recordsTotal"
  34. :isnone="!list.length" nonetext="获奖记录为空" bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider>
  35. </view>
  36. </template>
  37. <script>
  38. import * as API from '@/apis/pagejs/activity.js'
  39. export default {
  40. data() {
  41. return {
  42. list:[],
  43. listForm:{
  44. pageIndex:1,
  45. pageSize:20,
  46. },
  47. recordsTotal:0,
  48. }
  49. },
  50. onLoad(op){
  51. this.getList()
  52. },
  53. onReachBottom() {
  54. if (this.list.length < this.recordsTotal) {
  55. this.myLoadmore();
  56. }
  57. },
  58. methods: {
  59. myLoadmore(){
  60. this.listForm.pageIndex += 1;
  61. this.getList();
  62. },
  63. getList(){
  64. uni.showLoading({
  65. title: "加载中",
  66. mask: true,
  67. })
  68. API.myAwards(this.listForm).then((res) => {
  69. uni.hideLoading();
  70. this.list = [
  71. ...this.list,
  72. ...res.data.data
  73. ];
  74. this.recordsTotal = res.data.recordsTotal;
  75. }).catch(error => {
  76. uni.showToast({
  77. title: error,
  78. icon: "none"
  79. })
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .main{
  87. padding: 24rpx 32rpx;
  88. .winning-box{
  89. padding: 24rpx;
  90. border-radius: 8px;
  91. background-color: rgba(255, 255, 255, 1);
  92. margin-bottom: 24rpx;
  93. .item{
  94. display: flex;
  95. margin-bottom: 16rpx;
  96. color: rgba(51, 51, 51, 1);
  97. font-size: 16px;
  98. font-weight: bold;
  99. font-family: 'Medium';
  100. .highlight{
  101. color:#018BB9;
  102. }
  103. }
  104. .else{
  105. display: flex;
  106. color: rgba(119, 119, 119, 1);
  107. font-size: 12px;
  108. justify-content: space-between;
  109. margin-top: 24rpx;
  110. font-family: 'Regular';
  111. }
  112. }
  113. }
  114. </style>