feree-two.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. var app = getApp();
  2. Page({
  3. data: {
  4. url: app.globalData.urlImages,
  5. fereeArray: [],
  6. page: 1,
  7. count: '',
  8. first:0,
  9. limit:20,
  10. title: "",
  11. loadinghidden: false
  12. },
  13. onLoad: function (options) {
  14. app.setBarColor();
  15. app.setUserInfo();
  16. if (options.uid){
  17. this.setData({
  18. uid: options.uid
  19. })
  20. this.getSpreadListTwo();
  21. }else{
  22. wx.showToast({
  23. title: '参数错误',
  24. icon: 'none',
  25. duration: 1000,
  26. })
  27. setTimeout(function(){
  28. wx.navigateTo({
  29. url: '/pages/feree/feree'
  30. })
  31. },1200);
  32. }
  33. },
  34. getSpreadListTwo:function(){
  35. var that = this;
  36. wx.request({
  37. url: app.globalData.url + '/routine/auth_api/get_spread_list_two?uid=' + app.globalData.uid,
  38. data: {
  39. two_uid: that.data.uid,
  40. first: that.data.first,
  41. limit: that.data.limit
  42. },
  43. method: 'GET',
  44. success: function (res) {
  45. if (res.data.code == 200) {
  46. that.setData({
  47. count: res.data.data.count ? res.data.data.count : 0,
  48. fereeArray: res.data.data.list,
  49. loadinghidden: true,
  50. title: '加载完成'
  51. })
  52. }
  53. }
  54. });
  55. },
  56. onReachBottom: function () {
  57. var that = this;
  58. var limit = 20;
  59. var first = that.data.first;
  60. var startpage = limit * first;
  61. var array = that.data.fereeArray;
  62. wx.request({
  63. url: app.globalData.url + '/routine/auth_api/get_spread_list_two?uid=' + app.globalData.uid,
  64. data: {
  65. two_uid: that.data.uid,
  66. limit: limit,
  67. first: startpage
  68. },
  69. method: 'GET',
  70. success: function (res) {
  71. var len = res.data.data.list.length;
  72. for (var i = 0; i < len; i++) {
  73. array.push(res.data.data.list[i])
  74. }
  75. that.setData({
  76. fereeArray: array,
  77. loadinghidden: true,
  78. title: '加载完成'
  79. })
  80. }
  81. })
  82. }
  83. })