index.js 3.4 KB

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