You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
3.4 KiB
178 lines
3.4 KiB
// pages/user/NeedsManage/index.js |
|
const app = getApp(); |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
tabActive: 1, |
|
list: [], |
|
resourceType: 1, |
|
resourceAuditState: null, |
|
}, |
|
toRelease(){ |
|
wx.navigateTo({ |
|
url: '/pages/release/index', |
|
}) |
|
}, |
|
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) |
|
|
|
}, |
|
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.item.id; |
|
let status = e.currentTarget.dataset.item.status; |
|
let that = this; |
|
if(status == 1){ |
|
wx.showModal({ |
|
title: '提示', |
|
content: '是否确定下架需求', |
|
success(res){ |
|
if(res.confirm){ |
|
app.http('GET','Resources/withdrawResource',{id: id}).then((res)=>{ |
|
if(res.data.success){ |
|
wx.showToast({ |
|
title: '操作成功', |
|
}) |
|
setTimeout(()=>{ |
|
that.getList() |
|
},1500) |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
} else{ |
|
wx.showModal({ |
|
title: '提示', |
|
content: '是否确定上架需求', |
|
success(res){ |
|
if(res.confirm){ |
|
app.http('GET','Resources/putOnResource',{id: id}).then((res)=>{ |
|
if(res.data.success){ |
|
wx.showToast({ |
|
title: '操作成功', |
|
}) |
|
setTimeout(()=>{ |
|
that.getList() |
|
},1500) |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
} |
|
}, |
|
// 撤回 |
|
withdrawClick(e){ |
|
let id = e.currentTarget.dataset.id; |
|
}, |
|
// 编辑 |
|
editClick(e){ |
|
let id = e.currentTarget.dataset.id; |
|
wx.navigateTo({ |
|
url: '/pages/user/editNeeds/index?id=' + id, |
|
}) |
|
}, |
|
// 删除 |
|
delClick(e){ |
|
let id = e.currentTarget.dataset.id; |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |