index.js 2.5 KB

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