index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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'>
  15. <text class="txt">+{{itemn.number || itemn.exp_num}}</text>
  16. <image v-if="itemn.number" src="../../../static/images/sign-icon-01.png" class="image"></image>
  17. <image v-else src="../../../static/images/sign-icon-02.png" class="image"></image>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class='loadingicon acea-row row-center-wrapper' v-if="signList.length > 0">
  24. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadtitle}}
  25. </view>
  26. <view class="mt-20" v-if="!signList.length">
  27. <emptyPage title="暂无签到记录~" src="/statics/images/noOrder.gif"></emptyPage>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. getSignMonthList
  35. } from '@/api/user.js';
  36. import {
  37. toLogin
  38. } from '@/libs/login.js';
  39. import {
  40. mapGetters
  41. } from "vuex";
  42. import emptyPage from '@/components/emptyPage';
  43. import {
  44. HTTP_REQUEST_URL
  45. } from '@/config/app';
  46. export default {
  47. components: {
  48. emptyPage
  49. },
  50. data() {
  51. return {
  52. imgHost: HTTP_REQUEST_URL,
  53. loading: false,
  54. loadend: false,
  55. loadtitle: '加载更多',
  56. page: 1,
  57. limit: 8,
  58. signList: [],
  59. isAuto: false, //没有授权的不会自动授权
  60. isShowAuth: false //是否隐藏授权
  61. };
  62. },
  63. computed: mapGetters(['isLogin']),
  64. watch: {
  65. isLogin: {
  66. handler: function(newV, oldV) {
  67. if (newV) {
  68. // #ifdef H5 || APP-PLUS
  69. this.getSignMoneList();
  70. // #endif
  71. }
  72. },
  73. deep: true
  74. }
  75. },
  76. onLoad() {
  77. if (this.isLogin) {
  78. this.getSignMoneList();
  79. } else {
  80. toLogin()
  81. }
  82. },
  83. onShow() {
  84. uni.removeStorageSync('form_type_cart');
  85. },
  86. onReachBottom: function() {
  87. this.getSignMoneList();
  88. },
  89. methods: {
  90. /**
  91. *
  92. * 授权回调
  93. */
  94. onLoadFun: function() {
  95. this.getSignMoneList();
  96. this.isShowAuth = false;
  97. },
  98. // 授权关闭
  99. authColse: function(e) {
  100. this.isShowAuth = e
  101. },
  102. /**
  103. * 获取签到记录列表
  104. */
  105. getSignMoneList: function() {
  106. let that = this;
  107. if (that.loading) return;
  108. if (that.loadend) return;
  109. that.loading = true;
  110. that.loadtitle = "";
  111. getSignMonthList({
  112. page: that.page,
  113. limit: that.limit
  114. }).then(res => {
  115. let list = res.data;
  116. let loadend = list.length < that.limit;
  117. that.signList = that.$util.SplitArray(list, that.signList);
  118. that.$set(that, 'signList', that.signList);
  119. that.loadend = loadend;
  120. that.loading = false;
  121. that.loadtitle = loadend ? "没有更多内容啦~" : "加载更多"
  122. }).catch(err => {
  123. that.loading = false;
  124. that.loadtitle = '加载更多';
  125. });
  126. },
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .sign-record {
  132. padding: 0 20rpx;
  133. }
  134. .sign-record .list .item .data {
  135. height: 90rpx;
  136. padding: 0;
  137. }
  138. .sign-record .list .item .listn {
  139. border-radius: 24rpx;
  140. line-height: 34rpx;
  141. }
  142. .sign-record .list .item .listn .itemn {
  143. height: auto;
  144. padding: 32rpx 24rpx;
  145. }
  146. .sign-record .list .item .listn .itemn .name {
  147. margin-bottom: 12rpx;
  148. line-height: 40rpx;
  149. color: #333333;
  150. }
  151. .sign-record .list .item .listn .itemn .num {
  152. align-self: flex-start;
  153. // display: flex;
  154. // align-items: center;
  155. font-family: Regular;
  156. font-size: 36rpx;
  157. height: 40rpx;
  158. line-height: 40rpx;
  159. .txt {
  160. vertical-align: middle;
  161. }
  162. .image {
  163. vertical-align: text-bottom;
  164. width: 36rpx;
  165. height: 36rpx;
  166. margin-left: 8rpx;
  167. }
  168. }
  169. </style>