activityInfo.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // pages/my/activityInfo/activityInfo.js
  2. const App = getApp()
  3. const util = require('../../utils/util')
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. activityId: null,
  10. num: 0,
  11. list: [],
  12. willnum: 0,
  13. queryParams: {
  14. page: 1,
  15. limit: 10
  16. },
  17. page: {
  18. total: null,
  19. currPage: null,
  20. totalPage: null,
  21. },
  22. nodata: util.nodata(),
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. console.log(options, 111)
  29. if (options && options.activityId) {
  30. this.setData({
  31. activityId: options.activityId,
  32. willnum: options.willnum
  33. })
  34. this.getlist()
  35. }
  36. },
  37. /**
  38. * 生命周期函数--监听页面初次渲染完成
  39. */
  40. onReady() {
  41. },
  42. /**
  43. * 生命周期函数--监听页面显示
  44. */
  45. onShow() {
  46. },
  47. getlist() {
  48. if (this.data.queryParams.page > 1) {
  49. if (this.data.page.currPage == this.data.page.totalPage) {
  50. wx.showToast({
  51. icon: 'none',
  52. title: '没有更多哦~',
  53. })
  54. return false
  55. }
  56. }
  57. wx.showLoading({
  58. title: '努力加载中...',
  59. })
  60. App._get('activitystu/list', {
  61. ...this.data.queryParams,
  62. pid: this.data.activityId
  63. }, res => {
  64. if (res.code === 0) {
  65. this.setData({
  66. list: res.page.list,
  67. page: {
  68. total: res.page.totalCount,
  69. currPage: res.page.currPage,
  70. totalPage: res.page.totalPage
  71. }
  72. })
  73. }
  74. }, err => {}, complete => {
  75. setTimeout(() => {
  76. wx.hideLoading()
  77. }, 500)
  78. })
  79. },
  80. /**
  81. * 生命周期函数--监听页面隐藏
  82. */
  83. onHide() {
  84. },
  85. /**
  86. * 生命周期函数--监听页面卸载
  87. */
  88. onUnload() {
  89. },
  90. /**
  91. * 页面相关事件处理函数--监听用户下拉动作
  92. */
  93. onPullDownRefresh() {
  94. },
  95. /**
  96. * 页面上拉触底事件的处理函数
  97. */
  98. onReachBottom() {
  99. this.setData({
  100. queryParams: {
  101. page: ++this.data.queryParams.page,
  102. limit: 10
  103. }
  104. })
  105. this.getlist()
  106. },
  107. /**
  108. * 用户点击右上角分享
  109. */
  110. onShareAppMessage() {
  111. }
  112. })