You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_uniapp/pages/my/sign_in_list.vue

102 lines
2.2 KiB

10 months ago
<template>
<BaseContainer class="sign-list">
<NavBar title="签到明细" />
<view v-if="signList.length" class="list">
<view
v-for="(item, index) in signList"
class="item flex flex-center-x"
:key="index"
>
<view class="text">
<view class="name">签到</view>
<view class="time">{{ item.add_time }}</view>
</view>
<view class="num">+{{ item.number }}</view>
</view>
</view>
<view v-show="loading" class="loading">
<text class="fa fa-spinner"></text>
</view>
<view v-if="loadend && signList.length" class="loaded">{{ loadTitle }}</view>
<view v-if="!signList.length && !loading">
<image
class="nothing"
:src="getImgPath('/wap/first/zsff/images/no_data_available.png')"
/>
</view>
</BaseContainer>
</template>
<script>
import { getUserSignListPaginiting } from "@/api/auth";
export default {
data() {
return {
signList: [],
limit: 20,
page: 1,
loadend: false,
loading: false,
loadTitle: "",
};
},
onReachBottom() {
this.getSignList();
},
onLoad() {
this.getSignList();
},
methods: {
getSignList() {
if (this.loadend || this.loading) return;
this.loading = true;
getUserSignListPaginiting(this.page, this.limit)
.then((res) => {
let list = res.data;
let signList = this.$util.SplitArray(list, this.signList);
this.loading = false;
this.loadend = list.length < this.limit;
this.loadTitle = this.loadend ? "已全部加载" : "上拉加载更多";
this.page = this.page + 1;
this.$set(this, "signList", signList);
})
.catch(() => {
this.loading = false;
});
},
},
};
</script>
<style>
page {
background: #f5f5f5;
}
</style>
<style scoped lang="scss">
.loading {
font-size: 40rpx;
text-align: center;
color: #999999;
}
.loaded {
font-size: 28rpx;
line-height: 72rpx;
text-align: center;
color: #999999;
}
.nothing {
position: absolute;
top: 30%;
left: 50%;
width: 400rpx;
height: 400rpx;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
</style>