// pages/jobDetail/zhengceDetail/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { fabuD:false, policy:'' }, shrink(){ wx.navigateBack({ delta: 1, }) }, formSubmit(e) { console.log('form发生了submit事件,携带数据为:', e.detail.value) var that = this; let arr = []; let currData = {}; // new Promise((reslove, reject) => { for(var i in e.detail.value) { console.log(i,":",e.detail.value[i]); arr.push(e.detail.value[i]); } // reslove() // }).then(res => { // console.log(arr) // // arr.forEach((item,index) =>{ // // that.data.policyList[index]["policy"] = item // // }) // }) currData["policyStr"] = JSON.stringify(arr) currData['storeJobId'] = wx.getStorageSync('jobDetail').storeJob.id; wx.request({ url: app.globalData.ip + "/store/job/updatePolicy", data: currData, header: app.globalData.header, method: "POST", success: function(res) { console.log(res) if(res.data.status == 200) { console.log(res); wx.showLoading({ title: '提交中...', }) setTimeout(function(){ wx.hideLoading({ success: (res) => {}, }) wx.navigateBack({ delta: 1, }) },1000) } else { wx.hideLoading() } }, fail: function(res) { console.log("操作失败"); } }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { console.log(wx.getStorageSync('jobDetail')) this.setData({ policy:wx.getStorageSync('jobDetail').policy }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })