Huanyuyuehui/pages/users/user_grade_list/index.vue

83 lines
2.2 KiB
Vue

<template>
<view>
<view class='sign-record'>
<view class='list' v-for="(item,index) in growthList" :key="index">
<view class='item'>
<view class='data'>{{item.month}}</view>
<view class='listn'>
<view class='itemn acea-row row-between-wrapper' v-for="(itemn,indexn) in item.list" :key="indexn">
<view>
<view class='name line1'>{{itemn.title}}</view>
<view>{{itemn.create_time}}</view>
</view>
<view v-if="itemn.pm>0" class='num font-color'>+{{itemn.number}}</view>
<view v-else class='num'>-{{itemn.number}}</view>
</view>
</view>
</view>
</view>
<view class='loadingicon acea-row row-center-wrapper'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadtitle}}
</view>
</view>
</view>
</template>
<script>
import { growthValueRecord } from '@/api/user.js';
import { mapGetters } from "vuex";
import { toLogin } from '@/libs/login.js';
export default {
components: {},
data() {
return {
loading:false,
loadend:false,
loadtitle:'加载更多',
page:1,
limit:8,
growthList:[],
};
},
computed: mapGetters(['isLogin']),
onLoad(){
if(this.isLogin){
this.getGrowthListList();
}else{
toLogin()
}
},
onReachBottom: function () {
this.getGrowthListList();
},
methods: {
/**
* 获取签到记录列表
*/
getGrowthListList:function(){
let that=this;
if(that.loading) return;
if(that.loadend) return;
that.loading = true;
that.loadtitle = "";
growthValueRecord({ page: that.page, limit: that.limit }).then(res=>{
let list = res.data;
let loadend = list.length < that.limit;
that.growthList = that.$util.SplitArray(list, that.growthList);
that.$set(that,'growthList',that.growthList);
that.loadend = loadend;
that.loading = false;
that.loadtitle = loadend ? "??~我也是有底线的~" : "加载更多"
}).catch(err=>{
that.loading = false;
that.loadtitle = '加载更多';
});
},
}
}
</script>
<style>
</style>