integral-con.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // pages/integral-con/integral-con.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. userInfo:[],
  9. integralInfo:[],
  10. first:0,
  11. limit:8,
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. this.getUserInfo();
  18. this.getList();
  19. },//user_integral_list
  20. getList:function(){
  21. var that = this;
  22. wx.request({
  23. url: app.globalData.url + '/routine/auth_api/user_integral_list?uid=' + app.globalData.uid,
  24. method: 'GET',
  25. data:{
  26. first: that.data.first,
  27. limit: that.data.limit,
  28. },
  29. success: function (res) {
  30. that.setData({
  31. integralInfo: res.data.data,
  32. })
  33. }
  34. });
  35. },
  36. getUserInfo:function(){
  37. var that = this;
  38. wx.request({
  39. url: app.globalData.url + '/routine/auth_api/my?uid=' + app.globalData.uid,
  40. method: 'POST',
  41. success: function (res) {
  42. that.setData({
  43. userInfo: res.data.data,
  44. })
  45. console.log(that.data.userInfo);
  46. }
  47. });
  48. },
  49. /**
  50. * 生命周期函数--监听页面初次渲染完成
  51. */
  52. onReady: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面显示
  56. */
  57. onShow: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面隐藏
  61. */
  62. onHide: function () {
  63. },
  64. /**
  65. * 生命周期函数--监听页面卸载
  66. */
  67. onUnload: function () {
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh: function () {
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom: function () {
  78. var that = this;
  79. var first = that.data.first;
  80. var limit = that.data.limit;
  81. if (!first) first = 1;
  82. var startpage = limit * first;
  83. wx.request({
  84. url: app.globalData.url + '/routine/auth_api/user_integral_list?uid=' + app.globalData.uid,
  85. method: 'GET',
  86. data: {
  87. first: startpage,
  88. limit: that.data.limit,
  89. },
  90. success: function (res) {
  91. var len = res.data.data.length;
  92. for (var i = 0; i < len; i++) {
  93. that.data.integralInfo.push(res.data.data[i])
  94. }
  95. that.setData({
  96. first: first + 1,
  97. integralInfo: that.data.integralInfo
  98. });
  99. }
  100. });
  101. },
  102. /**
  103. * 用户点击右上角分享
  104. */
  105. onShareAppMessage: function () {
  106. }
  107. })