index.vue 2.8 KB

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