// pages/user/NeedsManage/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { tabActive: 1, list: [], resourceType: 2, resourceAuditState: null, }, tabClick(e){ let i = e.currentTarget.dataset.i this.setParams(i) }, setParams(i){ if(i == 1){ this.setData({ tabActive: i, resourceAuditState: [2], }) } else if(i == 2){ this.setData({ tabActive: i, resourceAuditState: [1], }) } else if(i == 3){ this.setData({ tabActive: i, resourceAuditState: [0,3], }) } else if(i == 4){ this.setData({ tabActive: i, resourceAuditState: [], }) } this.getList() }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ tabActive: options.type }) this.setParams(options.type) }, toRelease(){ wx.navigateTo({ url: '/pages/release/index', }) }, getList(){ app.http('post','Resources/listMyResources',{ resourceType: this.data.resourceType, resourceAuditState : this.data.resourceAuditState }).then((res)=>{ if(res.data.success){ this.setData({ list: res.data.data.content }) } }) }, // 下架 xiajiaClick(e){ let id = e.currentTarget.dataset.id; console.log(id) }, // 撤回 withdrawClick(e){ let id = e.currentTarget.dataset.id; console.log(id) }, // 编辑 editClick(e){ let id = e.currentTarget.dataset.id; console.log(id) wx.navigateTo({ url: '/pages/user/editNeeds/index?id=' + id, }) }, // 删除 delClick(e){ let id = e.currentTarget.dataset.id; console.log(id) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })