awarLog.vue 4.6 KB

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