// pages/myAgentNew/desp/index.js let app = getApp(); Page({ /** * 页面的初始数据 */ data: { agencyId:'' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options.agencyId); this.setData({ agencyId: options.agencyId }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.getDetail(); }, // updateDesp getDetail() { var that = this; wx.request({ url: app.globalData.ip + "/agency/getDetailById?id=" + that.data.agencyId, header: app.globalData.header, method: "GET", success: function (res) { console.log(res.data); that.setData({ record: res.data.data, }); // debugger; }, fail: function (res) { console.log(res); }, }); wx.hideLoading({ success: (res) => {}, }) }, formSubmit(e) { console.log('form发生了submit事件,携带数据为:', e.detail.value) var that = this; let currData = {}; currData["agencyId"] = that.data.agencyId; currData["desp"] = e.detail.value.desp; wx.request({ url: app.globalData.ip + "/agency/updateDesp", header: app.globalData.header, data:currData, method: "post", success: function (res) { console.log(res.data); wx.showToast({ title: '修改成功', icon:'success', duration:1000 }) setTimeout(function(){ wx.navigateBack({ delta: 1, }) },1000) // console.log(that.convertHtmlToText(res.data.data.articleContent)); // that.setData({ // agencyStatistics: res.data.data.record, // }); }, fail: function (res) { console.log(res); }, }); }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })