securityCheck.js 2.2 KB

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