Ver código fonte

添加找朋友请求

smallqiang 5 anos atrás
pai
commit
4447eb7052

+ 8 - 4
assets/scripts/friend/GameFriendSearch.js

@@ -1,3 +1,4 @@
+const FriendApi = require('../net/FriendApi');
 
 cc.Class({
     extends: cc.Component,
@@ -38,16 +39,16 @@ cc.Class({
 
         } else if (CC_WECHATGAME) {
             wx.setClipboardData({
-                data: this.userId,
+                data: this.userId.toString(),
                 success(res) {
                     wx.getClipboardData({
                         success(res) {
-                            GameGlobal.commonAlert.showCommonErrorAlert('复制成功');
+
                         }
                     })
                 },
                 fail() {
-                    GameGlobal.commonAlert.showCommonErrorAlert('复制失败请重试');
+
                 }
             })
         } else {
@@ -56,8 +57,11 @@ cc.Class({
     },
 
     addFriend() {
+        FriendApi.getByFriendId(this.userId, (responseData) => {
 
-    }
+            }, (error) => {
 
+        });
+    }
     // update (dt) {},
 });

+ 24 - 0
assets/scripts/net/FriendApi.js

@@ -0,0 +1,24 @@
+const Api = require('../net/Api');
+
+class FriendApi {
+    getByFriendId(fid, success, fail) {
+        let url = "/friend/getByFid.do";
+
+        let data = {
+            fid: fid
+        };
+
+        let requestBody = {
+            url: url,
+            data: data,
+            success: success,
+            fail: fail,
+            complete: () => {
+            }
+        };
+        Api.httpGet(requestBody);
+    }
+}
+
+module.exports = new FriendApi();
+

+ 9 - 0
assets/scripts/net/FriendApi.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.5",
+  "uuid": "3c881dca-5414-4ec1-ad4d-9dfc2fafdeb6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}