// pages/safefeedback/add.js const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { form:{ content: "", isdone:1 }, typeIndex:1, typeArray:['未完成', '已完成'] }, bindcontentInput: function (e) { this.data.form.content = e.detail.value }, bindtypeChange: function (e) { this.setData({ typeIndex: e.detail.value, }) this.data.form.isdone = thhs.data.typeIndex }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var pages = getCurrentPages() var prePage = pages[pages.length-3] var item = prePage.data.selectedItem; this.setData({ item:item }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, Tap1: function (x) { wx.showModal({ title: "系统提示", content: x, showCancel: false, confirmText: "确定" }) }, submit: function(){ var that = this if (that.data.form.content == '') { that.Tap1('请输入反馈描述!') return } that.data.form.safeitem = that.data.item.id api.request('api/safefeedback/?a=add', 'POST', that.data.form).then(res => { wx.navigateBack({ delta: 0, }) } ) } })