awarLog.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="app-body">
  3. <!--关键词搜索-->
  4. <view class="sreach fx-r fx-bc fx-ac">
  5. <image class="icon" src="/static/img/tb-seach.png"></image>
  6. <input type="text" v-model="keyword" placeholder="请输入用户昵称/用户ID" placeholder-style="color: #B3B3B3;" />
  7. <view class="fx-g1"></view>
  8. <view class="search-btn" @tap="tapSerach">搜索</view>
  9. </view>
  10. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - ' + hFoot + 'px - 60px);'"
  11. @scrolltolower="loadMoreData">
  12. <view class="sc-body">
  13. <view class="item" v-for="item in listAr">
  14. <view class="info fx-r">
  15. <image class="avatar" mode="aspectFill" :src="item.avatar || '/static/img/user-avatar1.png' ">
  16. </image>
  17. <view class="ir">
  18. <view class="fx-r fx-bc fx-ac">
  19. <view class="title">{{ item.nickname }}</view>
  20. <view class="fx-g1"></view>
  21. <view class="time" style="color: #787878;font-size: 14px;">{{ item.time }}</view>
  22. </view>
  23. <view class="ifoot fx-r">
  24. <view class="iid">ID:{{ item.fuid }}</view>
  25. <view class="fx-g1"></view>
  26. <view class="time" v-if="item.status == 0">审核中</view>
  27. <view class="time" style="color: #e6a23c;" v-if="item.status == 1">已发放奖励</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="listAr.length > 0">
  33. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  34. <image src="/static/img/xloading.png"></image>
  35. <text>正在载入更多...</text>
  36. </view>
  37. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  38. </view>
  39. <view v-if="listAr.length == 0 && isFirst">
  40. <uv-empty mode="data" icon="/static/img/no-empty.png"></uv-empty>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapState,
  49. mapMutations
  50. } from 'vuex';
  51. export default {
  52. computed: mapState(['user']),
  53. data() {
  54. return {
  55. isFirst: false,
  56. listAr: [],
  57. keyword: "",
  58. hFoot: 0,
  59. page: {
  60. isFirst: false,
  61. isLoad: false,
  62. isFoot: false,
  63. page: 1
  64. },
  65. }
  66. },
  67. onLoad(options) {
  68. this.initView();
  69. // #ifdef H5
  70. this.hFoot = 60;
  71. // #endif
  72. },
  73. methods: {
  74. ...mapMutations(['checkUserLogin']),
  75. /**
  76. * 加载基础配置
  77. */
  78. initView: function() {
  79. this.getData(true);
  80. },
  81. /**
  82. * 获取数据
  83. */
  84. getData: function(isPull = false) {
  85. if (this.page.isLoad) return;
  86. this.page.isLoad = true;
  87. if (isPull) {
  88. this.page.page = 1;
  89. this.page.isLoad = false;
  90. this.page.isFoot = false;
  91. }
  92. uni.showLoading({
  93. title: '获取数据中..'
  94. });
  95. var post = {};
  96. post.page = this.page.page;
  97. this
  98. .request
  99. .post("userAwardSqLog", {
  100. keyword: this.keyword,
  101. page: this.page.page
  102. })
  103. .then(res => {
  104. uni.hideLoading();
  105. this.page.isFirst = true;
  106. this.page.isLoad = false;
  107. this.isFirst = true;
  108. if (isPull) {
  109. this.listAr = res.data.list;
  110. } else {
  111. this.listAr = this.listAr.concat(res.data.list);
  112. }
  113. //是否到底
  114. if (res.data.list.length != res.data.pageSize) {
  115. this.page.isFoot = true;
  116. }
  117. })
  118. .catch((res) => {
  119. console.log(res);
  120. uni.hideLoading();
  121. uni.showModal({
  122. title: '系统提示',
  123. content: '加载失败,返回在尝试',
  124. showCancel: false
  125. });
  126. });
  127. },
  128. tapSerach: function() {
  129. this.getData(true);
  130. },
  131. loadMoreData: function() {
  132. if (this.page.isFoot || this.page.isLoad) {
  133. return;
  134. }
  135. this.page.page++;
  136. this.getData();
  137. },
  138. },
  139. }
  140. </script>
  141. <style lang="scss">
  142. .app-body {
  143. padding: 0px 20rpx;
  144. }
  145. .sreach {
  146. background: #fff;
  147. margin: 20rpx 0;
  148. border-radius: 32rpx;
  149. padding: 16rpx 32rpx;
  150. .icon {
  151. width: 46rpx;
  152. height: 46rpx;
  153. }
  154. input {
  155. width: calc(100% - 46rpx - 16rpx - 50px);
  156. font-size: 16px;
  157. }
  158. .search-btn {
  159. font-size: 14px;
  160. color: #FF4C4C;
  161. }
  162. }
  163. .sc-body {
  164. .item {
  165. background: #FFFFFF;
  166. border-radius: 16rpx;
  167. margin-bottom: 20rpx;
  168. padding: 16rpx 40rpx;
  169. .info {
  170. .avatar {
  171. width: 85rpx;
  172. height: 85rpx;
  173. border-radius: 50%;
  174. }
  175. padding-bottom: 26rpx;
  176. .ir {
  177. width: calc(100% - 105rpx);
  178. margin-left: 20rpx;
  179. .title {
  180. font-weight: bold;
  181. font-size: 32rpx;
  182. color: #303133;
  183. }
  184. }
  185. .ifoot {
  186. .iid {
  187. font-size: 26rpx;
  188. color: #666666;
  189. }
  190. .time {
  191. font-size: 26rpx;
  192. color: #666666;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>