You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
2.6 KiB
JavaScript

// pages/opinion/index.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
textVal: "",
loading: false,
subLoad: false,
success: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) { },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () { },
/**
* 生命周期函数--监听页面显示
*/
onShow () { },
/**
* 意见提交事件
*
*
*/
submit () {
const that = this;
if (that.data.subLoad) return
that.data.subLoad = true
console.log(that.data.textVal)
that.setData({
success: true,
loading: false,
subLoad:false
});
// if (that.data.textVal.trim() != '') {
// console.log(312313123);
// that.setData({
// loading: true,
// });
// wx.request({
// url: app.globalData.ip + "/daotian/feedback/add",
// method: 'post',
// header: app.globalData.headers,
// data: {
// content: that.data.textVal
// },
// success: function (res) {
// console.log(res);
// if (res.data.status == 200) {
// that.setData({
// success: true,
// });
// } else {
// wx.showToast({
// title: res.data.msg,
// icon: 'none'
// })
// }
// that.setData({
// loading: false,
// });
// that.data.subLoad = false
// },
// fail: function (res) {
// that.setData({
// loading: false,
// });
// },
// });
// } else {
// wx.showToast({
// title: '请输入内容再提交',
// icon: 'none'
// })
// }
},
getVal (e) {
console.log(e);
this.setData({
textVal: e.detail.value
})
console.log(this.data.textVal);
},
goback () {
wx.navigateBack({
delta: 1,
});
},
goList () {
wx.navigateTo({
url: "/pages/opinionList/index",
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide () { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload () { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () { },
/**
* 用户点击右上角分享
*/
onShareAppMessage () { },
});