feree.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. var that = this;
  17. var header = {
  18. 'content-type': 'application/x-www-form-urlencoded',
  19. };
  20. wx.request({
  21. url: app.globalData.url + '/routine/auth_api/get_spread_list?uid=' + app.globalData.uid,
  22. method: 'GET',
  23. data: {
  24. first: that.data.first,
  25. limit: that.data.limit
  26. },
  27. success: function (res) {
  28. if (res.data.code == 200) {
  29. that.setData({
  30. count: res.data.data.count ? res.data.data.count : 0,
  31. fereeArray: res.data.data.list,
  32. loadinghidden: true,
  33. title: '加载完成'
  34. })
  35. }
  36. }
  37. });
  38. },
  39. toTwo:function(e){
  40. if (e.currentTarget.dataset.id) {
  41. wx.navigateTo({
  42. url: '/pages/feree-two/feree-two?uid=' + e.currentTarget.dataset.id,
  43. })
  44. }
  45. },
  46. onReachBottom: function () {
  47. var that = this;
  48. var limit = 20;
  49. var first = that.data.first;
  50. var startpage = limit * first;
  51. var array = that.data.fereeArray;
  52. wx.request({
  53. url: app.globalData.url + '/routine/auth_api/get_spread_list?uid=' + app.globalData.uid,
  54. data: {
  55. limit: limit,
  56. first: startpage
  57. },
  58. method: 'GET',
  59. success: function (res) {
  60. var len = res.data.data.list.length;
  61. for (var i = 0; i < len; i++) {
  62. array.push(res.data.data.list[i])
  63. }
  64. that.setData({
  65. fereeArray: array,
  66. loadinghidden: true,
  67. title: '加载完成'
  68. })
  69. }
  70. })
  71. }
  72. })