var app = getApp();
Page({
  data: {
    idea: '',
    contentLength: 0
  },
  onReady() {
  },
  // 提交
  submit() {
    console.log('提交')
    console.log(this.data.idea)
    if(this.data.idea==''){
      wx.showModal({
        title: '提示',
        showCancel: false,
        content: '请填写反馈信息！'
      })
      return
    }
    let me = this
    // 请求前加Loading
    wx.showLoading({
      title: '加载中',
      mask: true
    })
    wx.request({
      url: app.globalData.apiUrl + 'users/feedback',
      method: 'POST',
      data: {
        token: wx.getStorageSync('token'),
        content: me.data.idea
      },
      success: function (res) {
        // 请求成功后关闭Loading
        wx.hideLoading();
        if(res.data.errno==200){
          wx.redirectTo({
            url: '/pages/mine/mine'
          })
        }else{
          wx.showModal({
            title: '提示',
            showCancel: false,
            content: res.data.msg
          })
        }
      }
    })
  },
  // 输入
  inputchange(e) {
    this.setData({
      idea: e.detail.value,
      contentLength: e.detail.value.length
    })
  },
})