index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. <!-- #ifdef MP -->
  25. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  26. <!-- #endif -->
  27. </view>
  28. </template>
  29. <script>
  30. import { getSignMonthList } from '@/api/user.js';
  31. import { toLogin } from '@/libs/login.js';
  32. import { mapGetters } from "vuex";
  33. import emptyPage from '@/components/emptyPage';
  34. export default {
  35. components: {
  36. emptyPage
  37. },
  38. data() {
  39. return {
  40. loading:false,
  41. loadend:false,
  42. loadtitle:'加载更多',
  43. page:1,
  44. limit:8,
  45. signList:[],
  46. isAuto: false, //没有授权的不会自动授权
  47. isShowAuth: false //是否隐藏授权
  48. };
  49. },
  50. computed: mapGetters(['isLogin']),
  51. watch:{
  52. isLogin:{
  53. handler:function(newV,oldV){
  54. if(newV){
  55. this.getSignMoneList();
  56. }
  57. },
  58. deep:true
  59. }
  60. },
  61. onLoad(){
  62. if(this.isLogin){
  63. this.getSignMoneList();
  64. }else{
  65. toLogin()
  66. }
  67. },
  68. onShow() {
  69. uni.removeStorageSync('form_type_cart');
  70. },
  71. onReachBottom: function () {
  72. this.getSignMoneList();
  73. },
  74. methods: {
  75. /**
  76. *
  77. * 授权回调
  78. */
  79. onLoadFun:function(){
  80. this.getSignMoneList();
  81. this.isShowAuth = false;
  82. },
  83. // 授权关闭
  84. authColse:function(e){
  85. this.isShowAuth = e
  86. },
  87. /**
  88. * 获取签到记录列表
  89. */
  90. getSignMoneList:function(){
  91. let that=this;
  92. if(that.loading) return;
  93. if(that.loadend) return;
  94. that.loading = true;
  95. that.loadtitle = "";
  96. getSignMonthList({ page: that.page, limit: that.limit }).then(res=>{
  97. let list = res.data;
  98. let loadend = list.length < that.limit;
  99. that.signList = that.$util.SplitArray(list, that.signList);
  100. that.$set(that,'signList',that.signList);
  101. that.loadend = loadend;
  102. that.loading = false;
  103. that.loadtitle = loadend ? "没有更多内容啦~" : "加载更多"
  104. }).catch(err=>{
  105. that.loading = false;
  106. that.loadtitle = '加载更多';
  107. });
  108. },
  109. }
  110. }
  111. </script>
  112. <style>
  113. </style>