helpDetails.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // subpages/helpDetails/helpDetails.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. helarcid: '',
  8. mDetails: { content :""}
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad(options) {
  14. if (options.id) {
  15. this.setData({
  16. helarcid:options.id
  17. })
  18. this.getDetails()
  19. }
  20. },
  21. /**
  22. * 生命周期函数--监听页面初次渲染完成
  23. */
  24. onReady() {
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow() {
  30. },
  31. /**
  32. * 生命周期函数--监听页面隐藏
  33. */
  34. onHide() {
  35. },
  36. /**
  37. * 生命周期函数--监听页面卸载
  38. */
  39. onUnload() {
  40. },
  41. /**
  42. * 页面相关事件处理函数--监听用户下拉动作
  43. */
  44. onPullDownRefresh() {
  45. },
  46. /**
  47. * 页面上拉触底事件的处理函数
  48. */
  49. onReachBottom() {
  50. },
  51. /**
  52. * 用户点击右上角分享
  53. */
  54. onShareAppMessage() {
  55. },
  56. getDetails() {
  57. const that = this;
  58. wx.request({
  59. url: 'https://aipush.aidsleep.cn/helarcdetail',
  60. method: 'POST',
  61. data: {
  62. tokens: "aa9ebf8360ec36bd0f6cc950b9e2f45e282ae1f93f5d3c56f2ffa6984cd22c66" || wx.getStorageSync('token'),
  63. udi: wx.getStorageSync('unionid'),
  64. helarcid: that.data.helarcid
  65. },
  66. success: (res) => {
  67. // console.log(res.data);
  68. var data = res.data.length ? res.data[0] : {};
  69. console.log(data);
  70. this.setData({
  71. mDetails: data
  72. })
  73. },
  74. fail: () => {
  75. }
  76. });
  77. },
  78. })