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.
119 lines
2.2 KiB
119 lines
2.2 KiB
// pages/demandHall/contact/index.js |
|
const app = getApp(); |
|
Page({ |
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
active: null, |
|
needsDetail: {}, |
|
needsList: [], |
|
content: '', |
|
|
|
}, |
|
needItemClick(e){ |
|
let id = e.currentTarget.dataset.id |
|
this.setData({ |
|
active: e.currentTarget.dataset.id |
|
}) |
|
}, |
|
inpChange(e){ |
|
console.log(e) |
|
this.setData({content: e.detail.value}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
// console.log(options) |
|
let data = JSON.parse(decodeURIComponent(options.detail)); |
|
this.setData({ |
|
needsDetail: data |
|
}) |
|
console.log(this.data.needsDetail) |
|
this.getList() |
|
}, |
|
getList(){ |
|
app.http('post','Resources/listMyResourcesPublish',{ |
|
resourceType: 2 |
|
}).then((res)=>{ |
|
if(res.data.success){ |
|
res.data.data.content.length > 0 ? this.setData({active: res.data.data.content[0].id}) : this.setData({active: null}) |
|
this.setData({ |
|
needsList: res.data.data.content, |
|
}) |
|
} |
|
}) |
|
}, |
|
submit(){ |
|
if(this.data.content == '' && this.demandId == null){ |
|
wx.showToast({ |
|
title: '请填写您的申请内容!', |
|
icon: 'none' |
|
}) |
|
return |
|
} |
|
let data = { |
|
resourceId: this.data.active, |
|
demandId: this.data.needsDetail.id, |
|
content: this.data.content |
|
} |
|
|
|
app.http('post','Communicate/create',data).then((res)=>{ |
|
if(res.data.success){ |
|
wx.showToast({ |
|
title: '提交成功!', |
|
duration: 2000 |
|
}) |
|
} |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |