leave-message.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. var sysT = require('../../../../tool/sys-tool.js')
  2. var businessT = require('../../../../tool/business-tool.js')
  3. var url = require('../../../../constant/url.js')
  4. import Net from '../../../../tool/net.js'
  5. var net = new Net()
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. adapter: {
  12. suffix: '',
  13. textareaHeight: 100
  14. }
  15. },
  16. formSubmit: businessT.action(function (sender) {
  17. businessT.debugLog(sender)
  18. if (sender.detail.value.textarea == '') {
  19. wx.showToast({
  20. title: '填写一点内容吧~',
  21. icon: 'none'
  22. })
  23. return
  24. }
  25. wx.showLoading({
  26. title: '正在保存',
  27. mask: true
  28. })
  29. var data = { leave: sender.detail.value.textarea }
  30. if (sender.detail.value.input != '') {
  31. data = { leave: sender.detail.value.textarea, title: sender.detail.value.input }
  32. }
  33. net.connectNeedLogin({
  34. url: url.app_host + url.addFeedback,
  35. data: data,
  36. success: (err, res) => {
  37. var pages = getCurrentPages()
  38. pages[pages.length - 2].getData()
  39. pages[pages.length - 2].data.needRefresh = true
  40. wx.hideLoading()
  41. wx.showToast({
  42. title: '保存成功',
  43. icon: 'none'
  44. })
  45. setTimeout(function () {
  46. wx.navigateBack({
  47. })
  48. }.bind(this), 1000)
  49. },
  50. fail: (err, res) => {
  51. wx.hideLoading()
  52. businessT.showFailTips(err, '保存失败')
  53. }
  54. })
  55. }),
  56. /**
  57. * 生命周期函数--监听页面加载
  58. */
  59. onLoad: function (options) {
  60. this.data.adapter = {
  61. suffix: sysT.suffixOfClass(),
  62. textareaHeight: sysT.usableHeight(292)
  63. }
  64. this.setData({
  65. adapter: this.data.adapter
  66. })
  67. },
  68. /**
  69. * 生命周期函数--监听页面初次渲染完成
  70. */
  71. onReady: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面显示
  75. */
  76. onShow: function () {
  77. },
  78. /**
  79. * 生命周期函数--监听页面隐藏
  80. */
  81. onHide: function () {
  82. },
  83. /**
  84. * 生命周期函数--监听页面卸载
  85. */
  86. onUnload: function () {
  87. },
  88. /**
  89. * 页面相关事件处理函数--监听用户下拉动作
  90. */
  91. onPullDownRefresh: function () {
  92. },
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom: function () {
  97. },
  98. /**
  99. * 用户点击右上角分享
  100. */
  101. onShareAppMessage: function () {
  102. return {
  103. path: '/page/home/index',
  104. imageUrl: '../../../../icon/public/share_img.png',
  105. title: '自助缴社保公积金,覆盖200多个城市,专业团队操作'
  106. }
  107. }
  108. })