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.
 
 
 
 

126 lines
2.4 KiB

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