feedback.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // pages/mine/wxml/feedback/feedback.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. },
  9. bindFormSubmit: function (e) {
  10. //console.log(e.detail.value.textarea)
  11. this.setData({
  12. textarea: e.detail.value.textarea,
  13. })
  14. },
  15. formSubmit:function(e){
  16. let _this = this;
  17. //console.log(e.detail.value.textarea)
  18. if (e.detail.value.textarea !== ""){
  19. wx.request({
  20. url: app.globalData.prodUrl + 'web-pm/wx/pm/add_feedback_message',
  21. header: {
  22. 'ydw-token': wx.getStorageSync('key').ydw_token
  23. },
  24. data: {
  25. feedback_message: e.detail.value.textarea
  26. },
  27. success: function (data) {
  28. //console.log(data.data)
  29. wx.showToast({
  30. title: data.data.tip.msg,
  31. icon: 'none',
  32. duration: 3000,
  33. success: function () {
  34. setTimeout(function() {
  35. wx.navigateBack({
  36. delta: 1,
  37. success: function () {
  38. var pages = getCurrentPages();
  39. var page = getCurrentPages().pop();
  40. //console.log(pages)
  41. if (page == undefined || page == null) return;
  42. pages[0].onLoad(pages[0].options);
  43. }
  44. })
  45. },2000)
  46. }
  47. });
  48. },
  49. });
  50. }else{
  51. wx.showToast({
  52. title: '请填写反馈内容!',
  53. icon: 'none',
  54. duration: 3000
  55. });
  56. }
  57. },
  58. /**
  59. * 生命周期函数--监听页面加载
  60. */
  61. onLoad: function (options) {
  62. },
  63. /**
  64. * 生命周期函数--监听页面初次渲染完成
  65. */
  66. onReady: function () {
  67. },
  68. /**
  69. * 生命周期函数--监听页面显示
  70. */
  71. onShow: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面隐藏
  75. */
  76. onHide: function () {
  77. },
  78. /**
  79. * 生命周期函数--监听页面卸载
  80. */
  81. onUnload: function () {
  82. },
  83. /**
  84. * 页面相关事件处理函数--监听用户下拉动作
  85. */
  86. onPullDownRefresh: function () {
  87. },
  88. /**
  89. * 页面上拉触底事件的处理函数
  90. */
  91. onReachBottom: function () {
  92. }
  93. })