123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <view class="app-body">
- <!--关键词搜索-->
- <view class="sreach fx-r fx-bc fx-ac">
- <image class="icon" src="/static/img/tb-seach.png"></image>
- <input type="text" v-model="keyword" placeholder="请输入用户昵称/用户ID" placeholder-style="color: #B3B3B3;" />
- <view class="fx-g1"></view>
- <view class="search-btn" @tap="tapSerach">搜索</view>
- </view>
- <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - ' + hFoot + 'px - 60px);'"
- @scrolltolower="loadMoreData">
- <view class="sc-body">
- <view class="item" v-for="item in listAr">
- <view class="info fx-r">
- <image class="avatar" mode="aspectFill" :src="item.avatar || '/static/img/user-avatar1.png' ">
- </image>
- <view class="ir">
- <view class="fx-r fx-bc fx-ac">
- <view class="title">{{ item.nickname }}</view>
- <view class="fx-g1"></view>
- <view class="time" style="color: #787878;font-size: 14px;">{{ item.time }}</view>
- </view>
- <view class="ifoot fx-r">
- <view class="iid">ID:{{ item.fuid }}</view>
- <view class="fx-g1"></view>
- <view class="time" v-if="item.status == 0">审核中</view>
- <view class="time" style="color: #e6a23c;" v-if="item.status == 1">已发放奖励</view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="listAr.length > 0">
- <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
- <image src="/static/img/xloading.png"></image>
- <text>正在载入更多...</text>
- </view>
- <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
- </view>
- <view v-if="listAr.length == 0 && isFirst">
- <uv-empty mode="data" icon="/static/img/no-empty.png"></uv-empty>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- computed: mapState(['user']),
- data() {
- return {
- isFirst: false,
- listAr: [],
- keyword: "",
- hFoot: 0,
- page: {
- isFirst: false,
- isLoad: false,
- isFoot: false,
- page: 1
- },
- }
- },
- onLoad(options) {
- this.initView();
- // #ifdef H5
- this.hFoot = 60;
- // #endif
- },
- methods: {
- ...mapMutations(['checkUserLogin']),
- /**
- * 加载基础配置
- */
- initView: function() {
- this.getData(true);
- },
- /**
- * 获取数据
- */
- getData: function(isPull = false) {
- if (this.page.isLoad) return;
- this.page.isLoad = true;
- if (isPull) {
- this.page.page = 1;
- this.page.isLoad = false;
- this.page.isFoot = false;
- }
- uni.showLoading({
- title: '获取数据中..'
- });
- var post = {};
- post.page = this.page.page;
- this
- .request
- .post("userAwardSqLog", {
- keyword: this.keyword,
- page: this.page.page
- })
- .then(res => {
- uni.hideLoading();
- this.page.isFirst = true;
- this.page.isLoad = false;
- this.isFirst = true;
- if (isPull) {
- this.listAr = res.data.list;
- } else {
- this.listAr = this.listAr.concat(res.data.list);
- }
- //是否到底
- if (res.data.list.length != res.data.pageSize) {
- this.page.isFoot = true;
- }
- })
- .catch((res) => {
- console.log(res);
- uni.hideLoading();
- uni.showModal({
- title: '系统提示',
- content: '加载失败,返回在尝试',
- showCancel: false
- });
- });
- },
- tapSerach: function() {
- this.getData(true);
- },
- loadMoreData: function() {
- if (this.page.isFoot || this.page.isLoad) {
- return;
- }
- this.page.page++;
- this.getData();
- },
- },
- }
- </script>
- <style lang="scss">
- .app-body {
- padding: 0px 20rpx;
- }
- .sreach {
- background: #fff;
- margin: 20rpx 0;
- border-radius: 32rpx;
- padding: 16rpx 32rpx;
- .icon {
- width: 46rpx;
- height: 46rpx;
- }
- input {
- width: calc(100% - 46rpx - 16rpx - 50px);
- font-size: 16px;
- }
- .search-btn {
- font-size: 14px;
- color: #FF4C4C;
- }
- }
- .sc-body {
- .item {
- background: #FFFFFF;
- border-radius: 16rpx;
- margin-bottom: 20rpx;
- padding: 16rpx 40rpx;
- .info {
- .avatar {
- width: 85rpx;
- height: 85rpx;
- border-radius: 50%;
- }
- padding-bottom: 26rpx;
- .ir {
- width: calc(100% - 105rpx);
- margin-left: 20rpx;
- .title {
- font-weight: bold;
- font-size: 32rpx;
- color: #303133;
- }
- }
- .ifoot {
- .iid {
- font-size: 26rpx;
- color: #666666;
- }
- .time {
- font-size: 26rpx;
- color: #666666;
- }
- }
- }
- }
- }
- </style>
|