|
@@ -56,7 +56,11 @@ Page({
|
|
|
logo: [{ url: '/image/beijing.jpeg' }],
|
|
|
status: '2'
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ total: 0,
|
|
|
+ page: 0,
|
|
|
+ skip: 0,
|
|
|
+ limit: 5,
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
tabPath(e) {
|
|
@@ -75,10 +79,40 @@ Page({
|
|
|
let data = that.data.statusList[e.detail.value];
|
|
|
that.setData({ 'searchInfo.status': data.value });
|
|
|
},
|
|
|
+ // 分页
|
|
|
+ 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) { },
|
|
|
+ onLoad: function (options) {
|
|
|
+ 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' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|