file-detail.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // pages/file-detail/file-detail.js
  2. const util = require('../../utils/util.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: function (options) {
  13. let that = this;
  14. util.get({
  15. url: '/api/notice/getById',
  16. header: {
  17. 'content-type': 'application/x-www-form-urlencoded'
  18. },
  19. data: {
  20. id: options.id
  21. },
  22. success: (res) => {
  23. wx.hideLoading();
  24. console.info(res);
  25. if (res.data.code != 200) {
  26. util.toast(res.data.msg);
  27. } else {
  28. that.setData({
  29. title: res.data.data.title,
  30. createTime: util.formatDate(res.data.data.createTime, 'yyyy-MM-dd'),
  31. content: res.data.data.content
  32. });
  33. }
  34. }
  35. });
  36. },
  37. /**
  38. * 生命周期函数--监听页面初次渲染完成
  39. */
  40. onReady: function () {
  41. },
  42. /**
  43. * 生命周期函数--监听页面显示
  44. */
  45. onShow: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面隐藏
  49. */
  50. onHide: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面卸载
  54. */
  55. onUnload: function () {
  56. },
  57. /**
  58. * 页面相关事件处理函数--监听用户下拉动作
  59. */
  60. onPullDownRefresh: function () {
  61. },
  62. /**
  63. * 页面上拉触底事件的处理函数
  64. */
  65. onReachBottom: function () {
  66. },
  67. })