index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <view class='sign-record'>
  4. <view class='list' v-for="(item,index) in signList" :key="index">
  5. <view class='item'>
  6. <view class='listn borRadius14'>
  7. <view class='itemn acea-row row-between-wrapper'>
  8. <view>
  9. <view class='name line1'>第 {{item.day}} 天签到积分奖励</view>
  10. <view>{{ formatDate(item.createTime) }}</view>
  11. </view>
  12. <view>
  13. <view class='num font-color' v-if="item.point > 0">
  14. <span class="num-title">积分</span> +{{ item.point }}
  15. </view>
  16. <view class='num font-color' v-if="item.experience > 0">
  17. <span class="num-title">经验</span> +{{ item.experience }}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class='loadingicon acea-row row-center-wrapper'>
  25. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadtitle}}
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { toLogin } from '@/libs/login.js';
  32. import { mapGetters } from "vuex";
  33. import * as SignInApi from '@/api/member/signin';
  34. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  35. export default {
  36. data() {
  37. return {
  38. loading: false,
  39. loadend: false,
  40. loadtitle: '加载更多',
  41. page:1,
  42. limit:8,
  43. signList:[],
  44. };
  45. },
  46. computed: mapGetters(['isLogin']),
  47. watch:{
  48. isLogin: {
  49. handler:function(newV,oldV) {
  50. if(newV){
  51. this.getSignMoneList();
  52. }
  53. },
  54. deep:true
  55. }
  56. },
  57. onLoad(){
  58. if (!this.isLogin) {
  59. toLogin();
  60. return;
  61. }
  62. this.getSignMoneList();
  63. },
  64. onReachBottom: function () {
  65. this.getSignMoneList();
  66. },
  67. methods: {
  68. /**
  69. * 获取签到记录列表
  70. */
  71. getSignMoneList:function(){
  72. if (this.loading || this.loadend) {
  73. return;
  74. }
  75. this.loading = true;
  76. this.loadtitle = "";
  77. SignInApi.getSignRecordPage({
  78. pageNo: this.page,
  79. pageSize: this.limit
  80. }).then(res=>{
  81. const list = res.data.list;
  82. const loadend = list.length < this.limit;
  83. this.signList = this.$util.SplitArray(list, this.signList);
  84. this.$set(this, 'signList', this.signList);
  85. this.loadend = loadend;
  86. this.loading = false;
  87. this.loadtitle = loadend ? "哼😕~我也是有底线的~" : "加载更多"
  88. }).catch(err => {
  89. this.loading = false;
  90. this.loadtitle = '加载更多';
  91. });
  92. },
  93. formatDate: function(date) {
  94. return dayjs(date).format("YYYY-MM-DD");
  95. },
  96. }
  97. }
  98. </script>
  99. <style>
  100. .sign-record .list .item .num-title {
  101. font-size: 10rpx;
  102. margin-right: 8rpx;
  103. }
  104. </style>