tzxq.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Page({
  2. /**
  3. * 页面的初始数据
  4. */
  5. data: {
  6. noticeId: null,
  7. noticeDetail: {
  8. id: '',
  9. title: '',
  10. content: '',
  11. date: '',
  12. source: ''
  13. }
  14. },
  15. onLoad: function (options) {
  16. if (options.noticeData) {
  17. try {
  18. // 解析传递过来的通知数据
  19. const noticeData = JSON.parse(decodeURIComponent(options.noticeData));
  20. // 直接设置通知详情数据
  21. this.setData({
  22. noticeId: noticeData.id,
  23. noticeDetail: {
  24. id: noticeData.id,
  25. title: noticeData.title,
  26. content: noticeData.content,
  27. date: noticeData.date,
  28. source: noticeData.source || '智慧水务'
  29. }
  30. });
  31. } catch (error) {
  32. console.error('解析通知数据失败', error);
  33. wx.showToast({
  34. title: '获取通知详情失败',
  35. icon: 'none'
  36. });
  37. }
  38. }
  39. },
  40. /**
  41. * 返回上一页
  42. */
  43. goBack: function() {
  44. wx.navigateBack();
  45. },
  46. })