index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view :style="viewColor">
  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.create_time}}</view>
  12. </view>
  13. <view class='num t-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. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  23. </view>
  24. </template>
  25. <script>
  26. // +----------------------------------------------------------------------
  27. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  28. // +----------------------------------------------------------------------
  29. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  30. // +----------------------------------------------------------------------
  31. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  32. // +----------------------------------------------------------------------
  33. // | Author: CRMEB Team <admin@crmeb.com>
  34. // +----------------------------------------------------------------------
  35. import { getSignMonthList } from '@/api/user.js';
  36. import { mapGetters } from "vuex";
  37. import authorize from '@/components/Authorize';
  38. export default {
  39. components: {
  40. authorize
  41. },
  42. data() {
  43. return {
  44. loading:false,
  45. loadend:false,
  46. loadtitle:'加载更多',
  47. page:1,
  48. limit:8,
  49. signList:[],
  50. isAuto: false, //没有授权的不会自动授权
  51. isShowAuth: false //是否隐藏授权
  52. };
  53. },
  54. computed: mapGetters(['isLogin','viewColor']),
  55. onLoad(){
  56. if(this.isLogin){
  57. this.getSignMoneList();
  58. }else{
  59. this.isAuto = true;
  60. this.isShowAuth = true
  61. }
  62. },
  63. onReachBottom: function () {
  64. this.getSignMoneList();
  65. },
  66. methods: {
  67. /**
  68. *
  69. * 授权回调
  70. */
  71. onLoadFun:function(){
  72. this.isShowAuth = false;
  73. this.getSignMoneList();
  74. },
  75. // 授权关闭
  76. authColse:function(e){
  77. this.isShowAuth = e
  78. },
  79. /**
  80. * 获取签到记录列表
  81. */
  82. getSignMoneList:function(){
  83. let that=this;
  84. if(that.loading) return;
  85. if(that.loadend) return;
  86. that.loading = true;
  87. that.loadtitle = "";
  88. getSignMonthList({ page: that.page, limit: that.limit }).then(res=>{
  89. let list = res.data;
  90. let loadend = list.length < that.limit;
  91. that.signList = that.$util.SplitArray(list, that.signList);
  92. that.$set(that,'signList',that.signList);
  93. that.loadend = loadend;
  94. that.loading = false;
  95. that.loadtitle = loadend ? "哼😕~我也是有底线的~" : "加载更多"
  96. }).catch(err=>{
  97. that.loading = false;
  98. that.loadtitle = '加载更多';
  99. });
  100. },
  101. }
  102. }
  103. </script>
  104. <style>
  105. .t-color{color:var(--view-theme)!important;}
  106. </style>