const app = getApp() Page({ data: { frameStyle: { useTop: true, name: '俱乐部', leftArrow: false, useBar: true }, list: [ { name: '宝藏俱乐部', founder: '宝藏', add: '长春市朝阳区前进大街1244号', project: '羽毛球', time: '2000-02-01', tel: '0431-800-800-8800', logo: [{ url: '/image/club.png' }] }, { name: '英语俱乐部', founder: '英语', time: '2000-02-01', add: '长春市朝阳区前进大街1244号', project: '羽毛球', tel: '0431-800-800-8800', logo: [{ url: '/image/club.png' }] }, { name: '宝藏俱乐部', founder: '宝藏', add: '长春市朝阳区前进大街1244号', project: '羽毛球', time: '2000-02-01', tel: '0431-800-800-8800', logo: [{ url: '/image/club.png' }] }, { name: '英语俱乐部', founder: '英语', time: '2000-02-01', add: '长春市朝阳区前进大街1244号', project: '羽毛球', tel: '0431-800-800-8800', logo: [{ url: '/image/club.png' }] }, ], total: 0, page: 0, skip: 0, limit: 5, }, // 跳转菜单 tabPath(e) { let { route } = e.detail.detail; if (route) wx.redirectTo({ url: `/${route}` }) }, // 分页 toPage: function () { const that = this; let list = that.data.list; let limit = that.data.limit; if (that.data.total > list.length) { wx.showLoading({ title: '加载中', mask: true }) let page = that.data.page + 1; that.setData({ page: page }) let skip = page * limit; that.setData({ skip: skip }) that.watchLogin(); wx.hideLoading() } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { const that = this; // 监听用户是否登录 that.watchLogin(); }, // 监听用户是否登录 watchLogin: async function () { const that = this; wx.getStorage({ key: 'user', success: async res => { }, fail: async res => { // wx.redirectTo({ url: '/pages/index/index' }) } }) }, /** * 页面上拉触底事件的处理函数 */ /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })