const util = require('../../../utils/util.js'); const api = require('../../../utils/api.js'); const app = getApp() Page({ /** * 页面的初始数据 */ data: { id: '', info: '', responseVal: '', userInfo: '' }, getInfo: function(e) { const that = this; util.httpRequest(api.getSuggestionDetail, { id: that.data.id }, 'post').then(res => { that.setData({ info: res.data.data.data }) }) }, response: function(e) { this.setData({ responseVal: e.detail.value }) }, apply: function(e) { const that = this; if (that.data.responseVal == '') { wx.showToast({ title: '回复不能为空', icon: 'none' }) } else { util.httpRequest(api.getSuggestionResponse, { loginId: that.data.userInfo.loginId, id: that.data.id, answer: that.data.responseVal }, 'post').then(res => { wx.showToast({ title: '提交成功', }) setTimeout(function() { wx.navigateBack({ }) }, 500) }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { const that = this; let userInfo = wx.getStorageSync('user'); that.setData({ id: options.id, userInfo: userInfo }) that.getInfo(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { } })