sharePage.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: {}, // 用于存储分享的海事年检通知信息
  10. },
  11. makePhoneCall: function (e) {
  12. const phoneNumber = e.currentTarget.dataset.phone;
  13. if (phoneNumber) {
  14. wx.makePhoneCall({
  15. phoneNumber: phoneNumber,
  16. });
  17. } else {
  18. wx.showToast({
  19. title: "电话号码不存在",
  20. icon: "none",
  21. });
  22. }
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. console.log(options);
  29. const noticeId = options.noticeId;
  30. if (noticeId) {
  31. this.getSharedNoticeInfo(noticeId);
  32. } else {
  33. wx.showToast({
  34. title: "无效的分享链接",
  35. icon: "none",
  36. });
  37. }
  38. },
  39. async getSharedNoticeInfo(noticeId) {
  40. wx.showLoading({
  41. title: "加载中...",
  42. });
  43. let { data } = await postApi("/annual/inspection/notice/share", {
  44. noticeId,
  45. });
  46. wx.hideLoading();
  47. if (data.status === 0) {
  48. this.setData({
  49. sharedNoticeInfo: data.result,
  50. });
  51. } else {
  52. wx.showToast({
  53. title: data.msg || "获取通知信息失败",
  54. icon: "none",
  55. });
  56. }
  57. },
  58. /**
  59. * 生命周期函数--监听页面初次渲染完成
  60. */
  61. onReady() {},
  62. /**
  63. * 生命周期函数--监听页面显示
  64. */
  65. onShow() {},
  66. /**
  67. * 生命周期函数--监听页面隐藏
  68. */
  69. onHide() {},
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload() {},
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh() {},
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom() {},
  82. /**
  83. * 用户点击右上角分享
  84. */
  85. onShareAppMessage() {},
  86. });