فهرست منبع

Merge branch 'beta'

lsc 4 هفته پیش
والد
کامیت
2efcf9d6f7
2فایلهای تغییر یافته به همراه41 افزوده شده و 21 حذف شده
  1. 39 20
      js/Desktop/Onload.js
  2. 2 1
      szdjg/Onload.js

+ 39 - 20
js/Desktop/Onload.js

@@ -325,27 +325,38 @@ U.MD.D.getuser = function () {
     // $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gif/longhuaBg.gif")'
     var userInfo = US.userInfo;
     var panId = userInfo && userInfo.accountNumber
-    if (!panId && !U.UF.C.queryString('code') && !U.UF.C.queryString('tycode')) {
+    if (!LoginState &&!panId && !U.UF.C.queryString('code') && !U.UF.C.queryString('tycode')) {
+        LoginState = true
         var _cookie = U.UF.Cookie.get("cocorobo");
-        if (!panId && _cookie) {
-            U.A.Request(US.Config.server + "getcookieuserid", [], function (res) {
-                if (res.value && res.value[0] && res.value[0][0]) {
-                    var _user = res.value[0][0];
-                    U.A.Request(US.Config.edu + "admin/userinfo/userinfoById/" + _user.userid, [], function (res) {
-                        if (res.value && res.value[0] && res.value[0][0]) {
-                            US.userInfo = res.value[0][0]; //记录用户数据
-                            US.userInfo.userid = _user.userid;
-                            // if ($("#U_MD_HomeC_Pop")[0]) {
-                            //     $("#U_MD_HomeC_Pop")[0].close(); //关闭登陆
-                            // }
-                            selectUser(_user.userid, (res) => {
-                              loginSet(res.value[0][0], res);
-                            });
-                        }
+        try {
+            if (!panId && _cookie) {
+                U.A.Request(US.Config.server + "getcookieuserid", [], function (res) {
+                    if (res.value && res.value[0] && res.value[0][0]) {
+                        var _user = res.value[0][0];
+                        U.A.Request(US.Config.edu + "admin/userinfo/userinfoById/" + _user.userid, [], function (res) {
+                            if (res.value && res.value[0] && res.value[0][0]) {
+                                US.userInfo = res.value[0][0]; //记录用户数据
+                                US.userInfo.userid = _user.userid;
+                                // if ($("#U_MD_HomeC_Pop")[0]) {
+                                //     $("#U_MD_HomeC_Pop")[0].close(); //关闭登陆
+                                // }
+                                selectUser(_user.userid, (res) => {
+                                  loginSet(res.value[0][0], res);
+                                });
+                            }else {
+                                LoginState = false
+                            }
 
-                    }, [], { "type": "GET", "withCredentials": true });
-                }
-            }, [], { "type": "GET", "withCredentials": true });
+                        }, [], { "type": "GET", "withCredentials": true });
+                    }else {
+                        LoginState = false
+                    }
+                }, [], { "type": "GET", "withCredentials": true });
+            }else {
+                LoginState = false
+            }
+        } catch (error) {
+            LoginState = false
         }
     }else if(!LoginState &&!panId && U.UF.C.queryString('code').length === 32){
         if($("#U_MD_HomeC_Pop")[0]){
@@ -1181,6 +1192,13 @@ function loginSet(userInfo, res){
 
 
 function selectUser(uid, callback) {
+    var userInfo = US.userInfo;
+    var panId = userInfo && userInfo.accountNumber
+    if(panId){
+        let res = {value:[[userInfo]]}
+        if (callback) callback(res);
+        return
+    }
     const requestUser = () => {
         U.A.Request(`${US.Config.pbl}selectUser?userid=${uid}`, [], function (res) {
             if(res && res.value && res.value.length && res.value[0].length && res.value[0][0].userid){
@@ -1238,13 +1256,14 @@ U.MD.D.addOp3 = async (userTime, loadTime, object, status) => {
         accountNumber: US.userInfo.accountNumber,
         org: US.userInfo.orgName,
         school: US.userInfo.schoolName,
+        role: US.userInfo.type == '1' ? '老师' : '学生',
         browser: browser,
         userTime: userTime == '1' ? _time : userTime, // 使用时间 1次的就1 其次传秒
         loadTime: loadTime, //load的时间没有就“”
         object: JSON.stringify(object), //执行信息传json
         status: status, //成功返回success。失败返回error的信息
     }
-    fetch("https://pbl.cocorobo.cn/api/mongo/updateUserData2", { method: 'POST', body: JSON.stringify(params) }).then(res => {
+    fetch("https://pbl.cocorobo.cn/api/mongo/updateUserData2", { method: 'POST', body: JSON.stringify([params]) }).then(res => {
         if (res.status == 200) {
             console.log('保存成功')
         } else {

+ 2 - 1
szdjg/Onload.js

@@ -957,13 +957,14 @@ U.MD.D.addOp3 = async (userTime, loadTime, object, status) => {
       accountNumber: US.userInfo.accountNumber,
       org: US.userInfo.orgName,
       school: US.userInfo.schoolName,
+      role: US.userInfo.type == '1' ? '老师' : '学生',
       browser: browser,
       userTime: userTime == '1' ? _time : userTime, // 使用时间 1次的就1 其次传秒
       loadTime: loadTime, //load的时间没有就“”
       object: JSON.stringify(object), //执行信息传json
       status: status, //成功返回success。失败返回error的信息
   }
-  fetch("https://pbl.cocorobo.cn/api/mongo/updateUserData2", { method: 'POST', body: JSON.stringify(params) }).then(res => {
+  fetch("https://pbl.cocorobo.cn/api/mongo/updateUserData2", { method: 'POST', body: JSON.stringify([params]) }).then(res => {
       if (res.status == 200) {
           console.log('保存成功')
       } else {