index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. const _my = require("../../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. import { checkTurnMeetingPageList, myTurnMeetingPageList } from "../../../utils/api/meeting";
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. list: [],
  10. //tab的current
  11. currentPage: 0,
  12. searchData: {
  13. data: {
  14. status: null
  15. },
  16. pageNum: 1,
  17. pageSize: 5
  18. },
  19. total: null,
  20. type: ""
  21. },
  22. // 获取列表 type-> 1:初始化 2:下拉加载 currentPage-> 0全部1审核中2通过3不通过
  23. getList(type) {
  24. let {
  25. searchData,
  26. list,
  27. currentPage
  28. } = this.data;
  29. if (currentPage == 0) {
  30. searchData.data.status = null;
  31. } else {
  32. searchData.data.status = currentPage;
  33. }
  34. searchData.pageNum = type === 1 ? 1 : searchData.pageNum + 1;
  35. this.setData({
  36. "searchData.pageNum": searchData.pageNum
  37. });
  38. wx.showLoading({
  39. title: "加载中"
  40. });
  41. if (this.data.type == "transfer-audit") {
  42. checkTurnMeetingPageList(searchData).then(res => {
  43. list = type === 1 ? res.data.records : list.concat(res.data.records);
  44. this.setData({
  45. list: list,
  46. total: res.data.total
  47. });
  48. wx.hideLoading();
  49. });
  50. } else {
  51. myTurnMeetingPageList(searchData).then(res => {
  52. list = type === 1 ? res.data.records : list.concat(res.data.records);
  53. this.setData({
  54. list: list,
  55. total: res.data.total
  56. });
  57. wx.hideLoading();
  58. });
  59. }
  60. },
  61. // scrollView触底事件
  62. reachBottom(e) {
  63. this.getList(e.currentTarget.dataset.type);
  64. },
  65. //获得切换tab的index
  66. changeSwiper(e) {
  67. var {
  68. currentPage
  69. } = this.data;
  70. switch (e.currentTarget.dataset.type) {
  71. case "click":
  72. currentPage = e.currentTarget.dataset.index;
  73. break;
  74. case "slide":
  75. currentPage = e.detail.current;
  76. break;
  77. default:
  78. break;
  79. }
  80. this.setData({
  81. currentPage
  82. });
  83. this.getList(1);
  84. },
  85. /**
  86. * 生命周期函数--监听页面加载
  87. */
  88. onLoad(options) {
  89. if (options.type) {
  90. this.setData({
  91. type: options.type
  92. });
  93. }
  94. },
  95. /**
  96. * 生命周期函数--监听页面初次渲染完成
  97. */
  98. onReady() {},
  99. /**
  100. * 生命周期函数--监听页面显示
  101. */
  102. onShow() {
  103. this.getList(1);
  104. },
  105. /**
  106. * 生命周期函数--监听页面隐藏
  107. */
  108. onHide() {},
  109. /**
  110. * 生命周期函数--监听页面卸载
  111. */
  112. onUnload() {},
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh() {},
  117. /**
  118. * 页面上拉触底事件的处理函数
  119. */
  120. onReachBottom() {},
  121. /**
  122. * 用户点击右上角分享
  123. */
  124. onShareAppMessage() {},
  125. antmoveAction: function () {
  126. //执行时动态赋值,请勿删除
  127. }
  128. });