123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- // 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() {
- }
- })
|