|
@@ -4,17 +4,11 @@ Page({
|
|
|
frameStyle: { useTop: true, name: '首页', leftArrow: false, useBar: true },
|
|
|
lingdang: '/image/lingdang.png',
|
|
|
user: {},
|
|
|
- list: [
|
|
|
- { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
|
|
|
- { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
|
|
|
- { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
|
|
|
- { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
|
|
|
- { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
|
|
|
-
|
|
|
- ],
|
|
|
+ list: [],
|
|
|
page: 0,
|
|
|
skip: 0,
|
|
|
limit: 5,
|
|
|
+ total: 0,
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
tabPath(e) {
|
|
@@ -47,10 +41,19 @@ Page({
|
|
|
wx.getStorage({
|
|
|
key: 'user',
|
|
|
success: async res => {
|
|
|
- // let info = { skip: that.data.skip, limit: that.data.limit };
|
|
|
- // const arr = await app.$get(`/newCourt/api/match`, { ...info });
|
|
|
- // if (arr.errcode == '0') { that.setData({ list: arr.data }) }
|
|
|
- // else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit };
|
|
|
+ const arr = await app.$get(`/newCourt/api/match`, { ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let arr1 = that.data.list;
|
|
|
+ let arr2 = arr.data;
|
|
|
+ arr1 = arr1.concat(arr2);
|
|
|
+ that.setData({ list: arr1 })
|
|
|
+ }
|
|
|
+ const aee = await app.$get(`/newCourt/api/match`);
|
|
|
+ if (aee.errcode == '0') {
|
|
|
+ that.setData({ total: aee.data.length })
|
|
|
+ }
|
|
|
+ else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
},
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|
|
@@ -62,16 +65,16 @@ Page({
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
const that = this;
|
|
|
- if (that.data.total < that.data.skip) {
|
|
|
+ if (that.data.total > that.data.list.length) {
|
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
|
let page = that.data.page + 1; //获取当前页数并+1
|
|
|
that.setData({ page: page })//更新当前页数
|
|
|
let limit = that.data.limit;
|
|
|
- let skip = (page - 1) * limit;
|
|
|
+ let skip = page * limit;
|
|
|
that.setData({ skip: skip })
|
|
|
- wx.hideLoading();
|
|
|
+ that.watchLogin();
|
|
|
+ wx.hideLoading()
|
|
|
} else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
|
- that.watchLogin();
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|