detail.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. const util = require('../../../utils/util.js');
  2. const api = require('../../../utils/api.js');
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. id: '',
  10. info: '',
  11. responseVal: '',
  12. userInfo: ''
  13. },
  14. getInfo: function(e) {
  15. const that = this;
  16. util.httpRequest(api.getSuggestionDetail, {
  17. id: that.data.id
  18. }, 'post').then(res => {
  19. that.setData({
  20. info: res.data.data.data
  21. })
  22. })
  23. },
  24. response: function(e) {
  25. this.setData({
  26. responseVal: e.detail.value
  27. })
  28. },
  29. apply: function(e) {
  30. const that = this;
  31. if (that.data.responseVal == '') {
  32. wx.showToast({
  33. title: '回复不能为空',
  34. icon: 'none'
  35. })
  36. } else {
  37. util.httpRequest(api.getSuggestionResponse, {
  38. loginId: that.data.userInfo.loginId,
  39. id: that.data.id,
  40. answer: that.data.responseVal
  41. }, 'post').then(res => {
  42. })
  43. }
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad: function(options) {
  49. const that = this;
  50. let userInfo = wx.getStorageSync('user');
  51. that.setData({
  52. id: options.id,
  53. userInfo: userInfo
  54. })
  55. that.getInfo();
  56. },
  57. /**
  58. * 生命周期函数--监听页面初次渲染完成
  59. */
  60. onReady: function() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面显示
  64. */
  65. onShow: function() {
  66. },
  67. /**
  68. * 生命周期函数--监听页面隐藏
  69. */
  70. onHide: function() {
  71. },
  72. /**
  73. * 生命周期函数--监听页面卸载
  74. */
  75. onUnload: function() {
  76. },
  77. /**
  78. * 页面相关事件处理函数--监听用户下拉动作
  79. */
  80. onPullDownRefresh: function() {
  81. },
  82. /**
  83. * 页面上拉触底事件的处理函数
  84. */
  85. onReachBottom: function() {
  86. }
  87. })