detail.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // pages/home/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. height: app.globalData.height * 2 + 25,
  9. windowHeight: app.globalData.windowHeight,
  10. navbarData: {
  11. name: '新闻信息'
  12. },
  13. detailInfo: {}
  14. },
  15. // 返回
  16. back: function () {
  17. wx.switchTab({
  18. url: '/pages/news/index',
  19. })
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. console.log(options.id);
  26. wx.request({
  27. url: `${app.globalData.publicUrl}/api/st/system/news/${options.id}`,
  28. method: "get",
  29. header: { 'x-tenant': app.globalData.tenant },
  30. data: {},
  31. success: res => {
  32. this.setData({ detailInfo: res.data.data })
  33. },
  34. error: err => {
  35. wx.showToast({
  36. title: err.msg,
  37. icon: 'error'
  38. })
  39. }
  40. })
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow: function () {
  51. // if (typeof this.getTabBar === 'function' &&
  52. // this.getTabBar()) {
  53. // this.getTabBar().setData({
  54. // selected: 3
  55. // })
  56. // }
  57. },
  58. /**
  59. * 生命周期函数--监听页面隐藏
  60. */
  61. onHide: function () {
  62. },
  63. /**
  64. * 生命周期函数--监听页面卸载
  65. */
  66. onUnload: function () {
  67. },
  68. /**
  69. * 页面相关事件处理函数--监听用户下拉动作
  70. */
  71. onPullDownRefresh: function () {
  72. },
  73. /**
  74. * 页面上拉触底事件的处理函数
  75. */
  76. onReachBottom: function () {
  77. },
  78. /**
  79. * 用户点击右上角分享
  80. */
  81. onShareAppMessage: function () {
  82. }
  83. })