Преглед изворни кода

feat: 添加登录次数统计变量并更新登录相关判断条件

lsc пре 3 часа
родитељ
комит
8689662864
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      js/liyuan/Onload2.js

+ 9 - 4
js/liyuan/Onload2.js

@@ -332,6 +332,7 @@ U.MD.D.error = function (errorMessage, scripturi, linenumber, columnnumber, erro
 let LoginState = false
 let CookieS = ''
 let CookieCheckTimes = 0
+let loginTimes = 0
 let isPanL = false
 U.MD.D.getuser = function () {
     // $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gif/longhuaBg.gif")'
@@ -344,6 +345,7 @@ U.MD.D.getuser = function () {
         try {
             if (!panId && _cookie && loginType != 1) {
                 U.A.Request(US.Config.server + "getcookieuserid", [], function (res) {
+                    loginTimes++
                     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) {
@@ -398,6 +400,7 @@ U.MD.D.getuser = function () {
         fetch(url, requestOptions)
         .then(response => response.text())
         .then(result => {
+            loginTimes++
             // console.log(result)
             let data = JSON.parse(result).data
             if(JSON.parse(result).code == 200){
@@ -461,6 +464,7 @@ U.MD.D.getuser = function () {
         fetch(url, requestOptions)
         .then(response => response.text())
         .then(result => {
+            loginTimes++
             // console.log(result)
             let data = JSON.parse(result).data
             // return
@@ -531,6 +535,7 @@ U.MD.D.getuser = function () {
         fetch(url, requestOptions)
         .then(response => response.text())
         .then(result => {
+            loginTimes++
             // console.log(result)
             let data = JSON.parse(result).data
             // return
@@ -691,13 +696,13 @@ U.MD.D.getuser = function () {
     }
 
     var _cookie = U.UF.Cookie.get("cocorobo");
-    if(LoginState && !_cookie){
+    if(LoginState && !_cookie && loginTimes != 0){
         window.onbeforeunload = null
         window.location.reload();
-    }else if(LoginState && !CookieS){
+    }else if(LoginState && !CookieS && loginTimes != 0){
         CookieS = _cookie
         U.UF.Cookie.set("cocoroboLoginType=2");
-    }else if(LoginState && _cookie != CookieS){
+    }else if(LoginState && _cookie != CookieS && loginTimes != 0){
         U.alert(LoginState && _cookie != CookieS)                
         window.alert(_cookie+""+CookieS)        
         window.alert(LoginState)
@@ -728,7 +733,7 @@ U.MD.D.getuser = function () {
                 }
             }
         }, [], { "type": "GET", "withCredentials": true });
-    }else if(LoginState && _cookie && !isPanL){
+    }else if(LoginState && _cookie && !isPanL && loginTimes != 0){
         CookieCheckTimes++
         if (CookieCheckTimes % 5 !== 0) return;
         isPanL = true