sharePage.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // pages/securityCheck/sharePage/sharePage.js
  2. import { postApi } from "../../../apis/api";
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. sharedNoticeInfo: null, // 用于存储分享的海事年检通知信息
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. const noticeId = options.noticeId;
  16. if (noticeId) {
  17. this.getSharedNoticeInfo(noticeId);
  18. } else {
  19. wx.showToast({
  20. title: "无效的分享链接",
  21. icon: "none",
  22. });
  23. }
  24. },
  25. async getSharedNoticeInfo(noticeId) {
  26. wx.showLoading({
  27. title: "加载中...",
  28. });
  29. let { data } = await postApi("/annual/inspection/notice/share", {
  30. noticeId,
  31. });
  32. wx.hideLoading();
  33. if (data.status === 0) {
  34. this.setData({
  35. sharedNoticeInfo: data.result,
  36. });
  37. } else {
  38. wx.showToast({
  39. title: data.msg || "获取通知信息失败",
  40. icon: "none",
  41. });
  42. }
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady() {},
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow() {},
  52. /**
  53. * 生命周期函数--监听页面隐藏
  54. */
  55. onHide() {},
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload() {},
  60. /**
  61. * 页面相关事件处理函数--监听用户下拉动作
  62. */
  63. onPullDownRefresh() {},
  64. /**
  65. * 页面上拉触底事件的处理函数
  66. */
  67. onReachBottom() {},
  68. /**
  69. * 用户点击右上角分享
  70. */
  71. onShareAppMessage() {},
  72. });