lsc 1 тиждень тому
батько
коміт
ba2cb822ee
1 змінених файлів з 29 додано та 13 видалено
  1. 29 13
      js/Desktop/Onload.js

+ 29 - 13
js/Desktop/Onload.js

@@ -330,9 +330,9 @@ U.MD.D.getuser = function () {
                             if ($("#U_MD_HomeC_Pop")[0]) {
                                 $("#U_MD_HomeC_Pop")[0].close(); //关闭登陆
                             }
-                            U.A.Request(US.Config.pbl + "selectUser?userid=" + _user.userid, [], function (res) { //US.userInfo.userid
-                                loginSet(res.value[0][0], res)
-                            }, [], { "type": "GET", "withCredentials": true });
+                            selectUser(_user.userid, (res) => {
+                              loginSet(res.value[0][0], res);
+                            });
                         }
 
                     }, [], { "type": "GET", "withCredentials": true });
@@ -392,9 +392,9 @@ U.MD.D.getuser = function () {
                             if(a.length>0){
                                 let userId = a[0][0].userid
                                 US.userInfo.userid = userId
-                                U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
-                                    loginSet(res.value[0][0], res)
-                                }, [], { "type": "GET", "withCredentials": true });
+                                selectUser(userId, (res) => {
+                                    loginSet(res.value[0][0], res);
+                                });
                             }
                             
                         })
@@ -456,9 +456,9 @@ U.MD.D.getuser = function () {
                             if(a.length>0){
                                 let userId = a[0][0].userid
                                 US.userInfo.userid = userId
-                                U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
-                                    loginSet(res.value[0][0], res)
-                                }, [], { "type": "GET", "withCredentials": true });
+                                selectUser(userId, (res) => {
+                                    loginSet(res.value[0][0], res);
+                                });
                             }
                             
                         })
@@ -524,10 +524,10 @@ U.MD.D.getuser = function () {
                             if(a.length>0){
                                 let userId = a[0][0].userid
                                 US.userInfo.userid = userId
-                                U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
+                                selectUser(userId, (res) => {
                                     loginSet(res.value[0][0], res)
                                     U.UF.DL.uploading(document.body)
-                                }, [], { "type": "GET", "withCredentials": true });
+                                });
                             }
                             
                         })
@@ -683,7 +683,7 @@ U.MD.D.getuser2 = function (userid, cid) {
                 }
                 let userId = a[0][0].userid
                 US.userInfo.userid = userId
-                U.A.Request(US.Config.pbl + "selectUser?userid=" + userid, [], function (res) { //US.userInfo.userid
+                selectUser(userId, (res) => {
                     if ($("#U_MD_HomeC_Pop")[0]) {
                         $("#U_MD_HomeC_Pop")[0].close(); //关闭登陆
                     }
@@ -718,7 +718,7 @@ U.MD.D.getuser2 = function (userid, cid) {
                     U.MD.O.P.connect(); //登录成功后连接socket服务同步协同编辑
                     U.MD.D.I.openInApplication("studyDetail", cid, 2, 2)
                     U.MD.D.I.openInApplication("studyDetail", cid, 2, 2)
-                }, [], { "type": "GET", "withCredentials": true });
+                });
             }
             
         })
@@ -1156,4 +1156,20 @@ function loginSet(userInfo, res){
         U.MD.D.I.openApplication(U.UF.C.queryString('app'))
     }
     U.MD.O.P.connect(); //登录成功后连接socket服务同步协同编辑
+}
+
+
+function selectUser(uid, callback) {
+    const requestUser = () => {
+        U.A.Request(US.Config.pbl + "selectUser?userid=" + uid, [], function (res) {
+            if (callback) callback(res);
+        }, [], { "type": "GET", "withCredentials": true });
+    };
+
+    try {
+        requestUser();
+    } catch (error) {
+        U.alert("登录失败,正在重试!")
+        requestUser();
+    }
 }