noticeDetail.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // pages/noticeDetail/noticeDetail.js
  2. const utils = require('../../utils/util.js')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. result: '', //总信息
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function (options) {
  14. this.getDetail(options.msgId)
  15. },
  16. //公告详情
  17. getDetail(msgId) {
  18. let params = {
  19. msgId
  20. }
  21. utils.axios({
  22. method: 'get',
  23. url: '/auth/user/msg/findMsgDetail',
  24. data: params,
  25. sendBefore() {
  26. wx.showLoading({
  27. title: '加载中...'
  28. })
  29. },
  30. complete() {
  31. wx.hideLoading()
  32. },
  33. success: res => {
  34. let result = res.data
  35. wx.setNavigationBarTitle({
  36. title: result.msgTitle
  37. })
  38. if (result.msgContent) {
  39. result.msgContent = result.msgContent.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  40. }
  41. this.setData({
  42. result
  43. })
  44. }
  45. })
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面显示
  54. */
  55. onShow: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面隐藏
  59. */
  60. onHide: function () {
  61. },
  62. /**
  63. * 生命周期函数--监听页面卸载
  64. */
  65. onUnload: function () {
  66. },
  67. /**
  68. * 页面相关事件处理函数--监听用户下拉动作
  69. */
  70. onPullDownRefresh: function () {
  71. },
  72. /**
  73. * 页面上拉触底事件的处理函数
  74. */
  75. onReachBottom: function () {
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage: function () {
  81. return {
  82. title: '诺信云',
  83. path: '/pages/index/index'
  84. }
  85. }
  86. })