Przeglądaj źródła

修改关闭浏览器发送2次签出bug

zhoufan 8 lat temu
rodzic
commit
f3784f8132
1 zmienionych plików z 17 dodań i 4 usunięć
  1. 17 4
      WebUI/CallCenterWeb.UI/js/main.js

+ 17 - 4
WebUI/CallCenterWeb.UI/js/main.js

625
     return currentdate;
625
     return currentdate;
626
 }
626
 }
627
 
627
 
628
+var iswebcloase = 1;
628
 window.onunload = function () {
629
 window.onunload = function () {
629
-    obj.Type = 'Logout';
630
-    Send();
630
+    if (iswebcloase) {
631
+        iswebcloase = 0;
632
+        if (ws.readyState == ws.OPEN) {
633
+            obj.Type = 'Logout';
634
+            Send();
635
+            ws.onclose();
636
+        }
637
+    }
631
 }
638
 }
632
 window.onbeforeunload = function () {
639
 window.onbeforeunload = function () {
633
-    obj.Type = 'Logout';
634
-    Send();
640
+    if (iswebcloase) {
641
+        iswebcloase = 0;
642
+        if (ws.readyState == ws.OPEN) {
643
+            obj.Type = 'Logout';
644
+            Send();
645
+            ws.onclose();
646
+        }
647
+    }
635
 }
648
 }
636
 
649