瀏覽代碼

修复好友列表的bug

sa03 6 年之前
父節點
當前提交
e2e239e24d
共有 3 個文件被更改,包括 11 次插入8 次删除
  1. 2 1
      assets/scripts/Tab.js
  2. 8 6
      assets/scripts/levelHome/LevelFriendHome.js
  3. 1 1
      assets/scripts/net/HomeApi.js

+ 2 - 1
assets/scripts/Tab.js

@@ -128,7 +128,8 @@ cc.Class({
                 return n.isApplied != 1
             });
 
-            Global.friendList = this.friends = _friendList;
+            Global.friendList = _friendList;
+            this.friends = _friendList.slice(0, 20);
             this.noArtistTipNode.active = false;
             this.friendLayout();
         }).catch((err) => { // 捕获到报错

+ 8 - 6
assets/scripts/levelHome/LevelFriendHome.js

@@ -29,12 +29,14 @@ cc.Class({
         let target = Global.friendList.find(n => {
             return n.uid == uid
         })
-
-        this.nick = target.nick
-
-        this.stars = target.stars
-
-        this.head = target.head
+        
+        if(target) {
+            this.nick = target.nick
+    
+            this.stars = target.stars
+    
+            this.head = target.head
+        }
 
         this.buildingInfos = [];
 

+ 1 - 1
assets/scripts/net/HomeApi.js

@@ -51,7 +51,7 @@ class HomeApi {
 
         let data = {
             timeline: 0,
-            count: 20
+            count: 50
         };
 
         Api.httpGet(this.setRequestBody(url, data, success, fail));