|
|
@@ -7,7 +7,7 @@
|
|
|
<swiper-item class="tab-content">
|
|
|
<scroll-view class="list-scroll-content" scroll-y>
|
|
|
<!-- 空白页 -->
|
|
|
- <empty v-if="loadingType === true && list.length === 0"></empty>
|
|
|
+ <empty v-if="loaded && list.length === 0"></empty>
|
|
|
<!-- 订单列表 -->
|
|
|
<view class="order-item" @click="ToDetail(item)" v-for="(item, index) in list" :key="index">
|
|
|
<view class="list-cell">
|
|
|
@@ -66,7 +66,8 @@ export default {
|
|
|
page: 1, //当前页数
|
|
|
limit: 6, //每次信息条数
|
|
|
list: [],
|
|
|
- loadingType: 'more' //加载更多状态
|
|
|
+ loadingType: 'more' ,//加载更多状态
|
|
|
+ loaded: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -75,68 +76,50 @@ export default {
|
|
|
onLoad() {
|
|
|
console.log(22);
|
|
|
this.loadData();
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ this.loadData();
|
|
|
},
|
|
|
methods: {
|
|
|
//获取订单列表
|
|
|
loadData(type) {
|
|
|
- //这里是将订单挂载到tab列表下
|
|
|
let obj = this;
|
|
|
- if (type != 'refresh') {
|
|
|
- console.log(obj.loadingType, '456');
|
|
|
- //没有更多数据直接跳出方法
|
|
|
- if (obj.loadingType === 'nomore') {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- // 设置当前为数据载入中
|
|
|
- obj.loadingType = 'loading';
|
|
|
- }
|
|
|
- } else {
|
|
|
- //当重新加载数据时更新状态为可继续添加数据
|
|
|
- obj.loadingType = 'more';
|
|
|
- }
|
|
|
- training({})
|
|
|
+ if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ obj.loadingType = 'loading'
|
|
|
+ training({
|
|
|
+ page: obj.page,
|
|
|
+ limit: obj.limit,
|
|
|
+ })
|
|
|
.then(data => {
|
|
|
- if (type === 'refresh') {
|
|
|
- obj.list = [];
|
|
|
- }
|
|
|
data.data.forEach(item => {});
|
|
|
let arr = data.data;
|
|
|
- obj.list = obj.list.concat(arr);
|
|
|
- console.log(obj.list, 123456);
|
|
|
- //判断是否还有下一页,有是more 没有是nomore
|
|
|
+ obj.list = obj.list.concat(arr);
|
|
|
+ obj.page++;
|
|
|
if (obj.limit == arr.length) {
|
|
|
- obj.page++;
|
|
|
+
|
|
|
obj.loadingType = 'more';
|
|
|
} else {
|
|
|
- obj.loadingType = 'nomore';
|
|
|
- }
|
|
|
- // 判断是否为刷新数据
|
|
|
- if (type === 'refresh') {
|
|
|
- console.log('refresh');
|
|
|
- // 判断是否为点击搜索按钮跳转加载
|
|
|
- if (obj.loading == 1) {
|
|
|
- uni.hideLoading();
|
|
|
- } else {
|
|
|
- uni.stopPullDownRefresh();
|
|
|
- }
|
|
|
+ obj.loadingType = 'noMore';
|
|
|
}
|
|
|
+ obj.loaded = true
|
|
|
})
|
|
|
.catch(e => {
|
|
|
- obj.loadingType = 'nomore';
|
|
|
- uni.hideLoading();
|
|
|
+ obj.loadingType = 'noMore';
|
|
|
});
|
|
|
},
|
|
|
//跳转到详情
|
|
|
ToDetail(e) {
|
|
|
let type = e.type;
|
|
|
- let id = e.id;
|
|
|
- // console.log(e.)
|
|
|
- if(e.is_create) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '您已报名,无需再次报名'
|
|
|
- })
|
|
|
- return
|
|
|
+ let id = e.id;
|
|
|
+ // console.log(e.)
|
|
|
+ if(e.is_create) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您已报名,无需再次报名'
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/train/sign?id=' + id
|