You've already forked guangan-mp
92 lines
2.0 KiB
Vue
92 lines
2.0 KiB
Vue
<template>
|
|
<view class="flex flex-column flex-1" style="height: 100vh;">
|
|
<i-loading v-if="loading" />
|
|
<view class="flex flex-column flex-1" style="height: 100%;">
|
|
<scroll-view class="flex-1 overflow-hidden" style="height: 100%;" scroll-y :refresher-enabled="true"
|
|
:refresher-triggered="refresh" @refresherrefresh="refreshData" @scrolltolower="loadData">
|
|
<view class="px-2 overflow-scroll">
|
|
<i-user-share-list :resdata="shareList" />
|
|
</view>
|
|
<uni-load-more :status="more_status" @clickLoadMore="loadData"></uni-load-more>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
TaAjax
|
|
} from '@/common/ajax';
|
|
import {
|
|
friendlyDate
|
|
} from '@/common/util';
|
|
export default {
|
|
computed: {
|
|
more_status() {
|
|
if (this.finish) {
|
|
return 'no-more';
|
|
} else if (this.loading) {
|
|
return 'loading';
|
|
} else {
|
|
return 'more';
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
shareList: [],
|
|
curPage: 1,
|
|
loading: true,
|
|
refresh: true,
|
|
finish: false
|
|
}
|
|
},
|
|
methods: {
|
|
loadData() {
|
|
if (this.refresh) {
|
|
this.shareList.length = 0;
|
|
this.finish = false;
|
|
}
|
|
if (this.finish) {
|
|
return;
|
|
}
|
|
TaAjax.get('/ticket/api.auth.UserShare/index', {
|
|
page: this.curPage
|
|
}).then((result) => {
|
|
const data = result.data;
|
|
const data_list = data.data.map((share) => {
|
|
share.create_at = friendlyDate(new Date(share.create_at.replace(/\-/g, '/'))
|
|
.getTime());
|
|
share.imgs = share.imgs_arr;
|
|
return share;
|
|
});
|
|
if (this.refresh) {
|
|
this.shareList.length = 0;
|
|
}
|
|
this.shareList = this.shareList.concat(data_list);
|
|
this.finish = data.total <= this.shareList.length;
|
|
this.curPage++;
|
|
}).catch((e) => {
|
|
console.warn(e)
|
|
if (this.shareList.length == 0) {
|
|
this.finish = true;
|
|
}
|
|
}).finally(() => {
|
|
this.refresh = false;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
refreshData() {
|
|
this.finish = false;
|
|
this.refresh = true;
|
|
this.curPage = 1;
|
|
this.loadData();
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|