punchAppeal.js 1.9 KB
// pages/punchAppeal/punchAppeal.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    current: 0,
    maxlength: 100,
    minlength: 0,
    currentnum: 0
  },
  //tab切换
  tabCharge(e) {
    var index = e.currentTarget.dataset.current
    var current = this.data.current
    if (index == current) {
      return false
    } else {
      this.setData({
        current: index
      })
    }
  },
  //申诉内容获取
  appealContent(e) {
    var textcontent = e.detail.value
    var len = e.detail.cursor
    var maxlength = this.data.maxlength
    var minlength = this.data.minlength
    if (len > maxlength) {
      wx.showToast({
        title: '超出最大限制',
        icon: 'none'
      })
      return
    } else {
      this.setData({
        currentnum: len
      })
    }
  },
  //上传图片
  uploadImg() {
    wx.chooseImage({
      success: function(res) {
        console.log(res)
        const tempFilePaths = res.tempFilePaths
        wx.uploadFile({
          url: '',
          filePath: 'tempFilePaths[0]',
          name: 'file',
        })
      },
    })
  },
//跳转申诉详情页
  listDetail(){
    wx.navigateTo({
      url:'../punchAppealDetail/punchAppealDetail',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})