// pages/my/postJob/index.js const App = getApp() var util = require("../../utils/util.js") Page({ /** * 页面的初始数据 */ data: { nodata: util.nodata(), tabs: [{ i: '01', label: '进行中' }, { i: '02', label: '已完成' } ], currentTab: 0, queryParams: { page: 1, limit: 10 }, type: '01', list: [], total: 0, currPage: null, totalPage: null, user: wx.getStorageSync('USER'), cityInfo: wx.getStorageSync('CHOOSECITY'), }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.getlist() }, getlist() { if (this.data.total > 0) { if (this.data.currPage == this.data.totalPage) { wx.showToast({ title: '没有更多了哦~', icon: 'none' }) return false } } wx.showLoading({ title: '努力加载中...', }) // 全部 '' App._post_form('work/myReleaseListNew', '', { ...this.data.queryParams, type: this.data.type, sid: this.data.user.id, city: this.data.cityInfo.cityId, }, res => { if (res.code === 0) { this.setData({ list: [...this.data.list, ...res.data.list], total: res.data.totalCount, currPage: res.data.currPage, totalPage: res.data.totalPage }) console.log(this.data.list, 111) } }, err => {}, complete => { setTimeout(() => { wx.hideLoading() }) }) }, tabChange(e) { console.log(e) if (this.data.currentTab == e.currentTarget.dataset.index) { return } this.setData({ currentTab: e.currentTarget.dataset.index, type: e.currentTarget.dataset.type }) this.init() }, init() { this.setData({ queryParams: { page: 1, limit: 10 }, total: 0, list: [] }) this.getlist() }, addJob() { wx.navigateTo({ url: '/job/postJob/postJob', }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { this.setData({ queryParams: { page: ++this.data.queryParams.page, limit: 10 } }) this.getlist() }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })