securityCheck.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. const { postApi } = require("../../apis/api");
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. currentNotice: {}, // 当前显示的通知详情
  8. noticeList: [],
  9. shareNoticeId: "",
  10. shareNoticeTitle: "",
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. // 设置导航栏标题
  17. wx.setNavigationBarTitle({
  18. title: "海事年检通知",
  19. });
  20. this.getAnnualInspectionNoticeList();
  21. },
  22. /**
  23. * 生命周期函数--监听页面初次渲染完成
  24. */
  25. onReady: function () {},
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: function () {
  30. if (typeof this.getTabBar === "function" && this.getTabBar()) {
  31. this.getTabBar().setData({
  32. selected: 3,
  33. });
  34. }
  35. },
  36. /**
  37. * 生命周期函数--监听页面隐藏
  38. */
  39. onHide: function () {},
  40. /**
  41. * 生命周期函数--监听页面卸载
  42. */
  43. onUnload: function () {},
  44. /**
  45. * 页面相关事件处理函数--监听用户下拉动作
  46. */
  47. onPullDownRefresh: function () {},
  48. /**
  49. * 页面上拉触底事件的处理函数
  50. */
  51. onReachBottom: function () {},
  52. /**
  53. * 用户点击右上角分享
  54. */
  55. onShareAppMessage: function (res) {
  56. if (res.from === "button" && res.target && res.target.dataset.title) {
  57. return {
  58. title: res.target.dataset.title || "海事年检通知",
  59. path: "/pages/securityCheck/securityCheck",
  60. };
  61. }
  62. return {
  63. title: "海事年检通知",
  64. path: "/pages/securityCheck/securityCheck",
  65. };
  66. },
  67. makePhoneCall: function (e) {
  68. const phoneNumber = e.currentTarget.dataset.phone;
  69. if (phoneNumber) {
  70. wx.makePhoneCall({
  71. phoneNumber: phoneNumber,
  72. });
  73. } else {
  74. wx.showToast({
  75. title: "电话号码不存在",
  76. icon: "none",
  77. });
  78. }
  79. },
  80. //POST /annual/inspection/notice 海事年检通知
  81. async getAnnualInspectionNoticeList() {
  82. let { data } = await postApi("/annual/inspection/notice", {
  83. currentPage: 1,
  84. size: 1000,
  85. });
  86. if (data.status === 0) {
  87. this.setData({
  88. noticeList: data.result,
  89. });
  90. } else {
  91. this.setData({
  92. noticeList: [],
  93. });
  94. }
  95. },
  96. share(e) {
  97. this.setData({
  98. shareNoticeId: e.currentTarget.dataset.id,
  99. shareNoticeTitle: e.currentTarget.dataset.title,
  100. });
  101. },
  102. onShareAppMessage() {
  103. return {
  104. title: this.data.shareNoticeTitle,
  105. path: `/pages/securityCheck/sharePage/sharePage?noticeId=${this.data.shareNoticeId}`,
  106. };
  107. },
  108. });