meeting-inspection-history.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // pages/meeting-inspection-history/meeting-inspection-history.js
  2. const util = require('../../utils/util.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. current: 1,
  9. size: 10,
  10. total: 0,
  11. list: []
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. let that = this;
  18. let inspectionType = options.inspectionType;
  19. let meetingId = options.meetingId;
  20. util.get({
  21. url: '/api/inspection/record/list',
  22. data: {
  23. current: that.data.current,
  24. size: that.data.size,
  25. inspectionType: inspectionType,
  26. meetingId: meetingId
  27. },
  28. success: function (res) {
  29. console.info(res)
  30. wx.hideLoading();
  31. if (res.data.code != 200) {
  32. util.toast(res.data.msg);
  33. } else {
  34. that.setData({
  35. total: res.data.data.total,
  36. list: res.data.data.records
  37. });
  38. }
  39. }
  40. });
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面隐藏
  54. */
  55. onHide: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面卸载
  59. */
  60. onUnload: function () {
  61. },
  62. /**
  63. * 页面相关事件处理函数--监听用户下拉动作
  64. */
  65. onPullDownRefresh: function () {
  66. let that = this;
  67. that.setData({
  68. current: 1,
  69. list: []
  70. });
  71. util.get({
  72. url: '/api/inspection/record/list',
  73. data: {
  74. current: that.data.current,
  75. size: that.data.size
  76. },
  77. success: (res) => {
  78. wx.hideLoading();
  79. wx.stopPullDownRefresh();
  80. if (res.data.code != 200) {
  81. util.toast(res.data.msg);
  82. } else {
  83. that.setData({
  84. total: res.data.data.total,
  85. list: res.data.data.records
  86. });
  87. }
  88. }
  89. });
  90. },
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom: function () {
  95. let that = this;
  96. let arr = that.data.list;
  97. let page = that.data.current;
  98. if (arr.length >= that.data.total) {
  99. util.toast('没有更多数据了');
  100. return;
  101. }
  102. that.setData({
  103. current: ++page
  104. });
  105. util.get({
  106. url: '/api/inspection/record/list',
  107. data: {
  108. current: that.data.current,
  109. size: that.data.size
  110. },
  111. success: (res) => {
  112. wx.hideLoading();
  113. wx.stopPullDownRefresh();
  114. console.info(res);
  115. if (res.data.code != 200) {
  116. util.toast(res.data.msg);
  117. } else {
  118. let list = res.data.data.records;
  119. that.setData({
  120. list: arr.concat(list)
  121. });
  122. }
  123. }
  124. });
  125. },
  126. /**
  127. * 用户点击右上角分享
  128. */
  129. onShareAppMessage: function () {
  130. },
  131. /**
  132. * 查看详情
  133. * @param {*} e
  134. */
  135. openDetail: function (e) {
  136. wx.navigateTo({
  137. url: '../meeting-inspection-history-detail/meeting-inspection-history-detail?id=' + e.currentTarget.dataset.id,
  138. });
  139. }
  140. })