lx 5 年之前
父节点
当前提交
4446f97676
共有 1 个文件被更改,包括 55 次插入24 次删除
  1. 55 24
      pages/attention/attention.js

+ 55 - 24
pages/attention/attention.js

@@ -66,27 +66,27 @@ Page({
   onLoad: function() {
     var that = this;
     // 获取关注的信息
-    var data={
-      userId:this.data.uerId,
-      currPage:this.data.currentPage
-    };
-    var that = this;
-    wx.showLoading({title: '加载中…'});
-
-    wxRequest.followList(data).then((res)=>{     
-      console.log(res);
-      wx.hideLoading()    
-      if(res.statusCode==200){
-        that.setData({
-         array:res.data.data.incInfos
-        })
-       }else{
-        wx.showToast({
-          title: '125',
-          icon: 'none'
-        })
-      }
-    })
+    // var data={
+    //   userId:this.data.uerId,
+    //   currPage:this.data.currentPage
+    // };
+    // var that = this;
+    // wx.showLoading({title: '加载中…'});
+    this.getFollow(this.data.uerId,this.data.currentPage);
+    // wxRequest.followList(data).then((res)=>{     
+    //   console.log(res);
+    //   wx.hideLoading()    
+    //   if(res.statusCode==200){
+    //     that.setData({
+    //      array:res.data.data.incInfos
+    //     })
+    //    }else{
+    //     wx.showToast({
+    //       title: '125',
+    //       icon: 'none'
+    //     })
+    //   }
+    // })
     // 获取系统信息 
     wx.getSystemInfo({
       success: function(res) {    
@@ -110,12 +110,43 @@ Page({
     }
     that.setData({
       currentPage: tempCurrentPage,
+      userId:wx.getStorageSync('openid')
     })
+    that.getFollow(that.data.userId,that.data.currentPage);
   },
 
-   
-  getFollow:function(userId){
-   
+  getFollow:function(userId,currentPage){
+    console.log(userId,currentPage);
+    let data = {
+      userId:userId,
+      currPage:currentPage
+    }
+    var pageIndex = this.data.currentPage;
+    if(pageIndex==1){
+      wx.showLoading({title: '加载中…'})
+    }
+    wxRequest.followList(data).then((res)=>{     
+      console.log(res);
+      wx.hideLoading()    
+      if(res.statusCode==200){
+        if(pageIndex==1){
+          this.setData({
+            array:res.data.data.incInfos,
+            totalpages:res.data.data.pages
+           })
+        }else{
+          var array=this.data.array.concat(res.data.data.incInfos)
+          this.setData({
+            array:array
+           })
+        }
+       }else{
+        wx.showToast({
+          title: '125',
+          icon: 'none'
+        })
+      }
+    })
     
   },
   open: function (e) {