index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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='data'>{{item.month}}</view>
  7. <view class='listn'>
  8. <view class='itemn acea-row row-between-wrapper' v-for="(itemn,indexn) in item.list" :key="indexn">
  9. <view>
  10. <view class='name line1'>{{itemn.title}}</view>
  11. <view>{{itemn.add_time}}</view>
  12. </view>
  13. <view class='num font-color'>+{{itemn.number}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class='loadingicon acea-row row-center-wrapper'>
  19. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadtitle}}
  20. </view>
  21. </view>
  22. <!-- #ifdef MP -->
  23. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  24. <!-- #endif -->
  25. </view>
  26. </template>
  27. <script>
  28. import { getSignMonthList } from '@/api/user.js';
  29. import { toLogin } from '@/libs/login.js';
  30. import { mapGetters } from "vuex";
  31. // #ifdef MP
  32. import authorize from '@/components/Authorize';
  33. // #endif
  34. export default {
  35. components: {
  36. // #ifdef MP
  37. authorize
  38. // #endif
  39. },
  40. data() {
  41. return {
  42. loading:false,
  43. loadend:false,
  44. loadtitle:'加载更多',
  45. page:1,
  46. limit:8,
  47. signList:[],
  48. isAuto: false, //没有授权的不会自动授权
  49. isShowAuth: false //是否隐藏授权
  50. };
  51. },
  52. computed: mapGetters(['isLogin']),
  53. onLoad(){
  54. if(this.isLogin){
  55. this.getSignMoneList();
  56. }else{
  57. // #ifdef H5 || APP-PLUS
  58. toLogin();
  59. // #endif
  60. // #ifdef MP
  61. this.isAuto = true;
  62. this.$set(this,'isShowAuth',true)
  63. // #endif
  64. }
  65. },
  66. onReachBottom: function () {
  67. this.getSignMoneList();
  68. },
  69. methods: {
  70. /**
  71. *
  72. * 授权回调
  73. */
  74. onLoadFun:function(){
  75. this.isShowAuth = false;
  76. this.getSignMoneList();
  77. },
  78. // 授权关闭
  79. authColse:function(e){
  80. this.isShowAuth = e
  81. },
  82. /**
  83. * 获取签到记录列表
  84. */
  85. getSignMoneList:function(){
  86. let that=this;
  87. if(that.loading) return;
  88. if(that.loadend) return;
  89. that.loading = true;
  90. that.loadtitle = "";
  91. getSignMonthList({ page: that.page, limit: that.limit }).then(res=>{
  92. let list = res.data;
  93. let loadend = list.length < that.limit;
  94. that.signList = that.$util.SplitArray(list, that.signList);
  95. that.$set(that,'signList',that.signList);
  96. that.loadend = loadend;
  97. that.loading = false;
  98. that.loadtitle = loadend ? "哼😕~我也是有底线的~" : "加载更多"
  99. }).catch(err=>{
  100. that.loading = false;
  101. that.loadtitle = '加载更多';
  102. });
  103. },
  104. }
  105. }
  106. </script>
  107. <style>
  108. </style>