securityCheck.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. makePhoneCall: function (e) {
  53. const phoneNumber = e.currentTarget.dataset.phone;
  54. if (phoneNumber) {
  55. wx.makePhoneCall({
  56. phoneNumber: phoneNumber,
  57. });
  58. } else {
  59. wx.showToast({
  60. title: "电话号码不存在",
  61. icon: "none",
  62. });
  63. }
  64. },
  65. //POST /annual/inspection/notice 海事年检通知
  66. async getAnnualInspectionNoticeList() {
  67. let { data } = await postApi("/annual/inspection/notice", {
  68. currentPage: 1,
  69. size: 1000,
  70. });
  71. if (data.status === 0) {
  72. this.setData({
  73. noticeList: data.result,
  74. });
  75. } else {
  76. this.setData({
  77. noticeList: [],
  78. });
  79. }
  80. },
  81. share(e) {
  82. this.setData({
  83. shareNoticeId: e.currentTarget.dataset.id,
  84. shareNoticeTitle: e.currentTarget.dataset.title,
  85. });
  86. },
  87. onShareAppMessage() {
  88. return {
  89. title: "海事年检通知",
  90. path: `/pages/securityCheck/sharePage/sharePage?noticeId=${this.data.shareNoticeId}`,
  91. imageUrl: "../../images/logo541.png",
  92. };
  93. },
  94. });