myFollow.js 817 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. Page({
  2. data: {
  3. pageToken: 0,
  4. followData: []
  5. },
  6. loadFollowData: function () {
  7. wx.showNavigationBarLoading()
  8. wx.cloud.callFunction({
  9. name: 'listPublishers',
  10. data: {
  11. follow: true,
  12. page_token: this.data.pageToken,
  13. page_size: 20
  14. }
  15. }).then(res => {
  16. wx.hideNavigationBarLoading()
  17. if (res.result.status !== 'OK') {
  18. wx.showToast({
  19. title: res.result.errMsg,
  20. icon: 'none'
  21. })
  22. return
  23. }
  24. this.setData({
  25. followData: this.data.followData.concat(res.result.list),
  26. pageToken: res.result.next_page_token
  27. })
  28. })
  29. },
  30. onReady: function () {
  31. this.loadFollowData()
  32. },
  33. onReachBottom: function () {
  34. this.loadFollowData()
  35. }
  36. })