Просмотр исходного кода

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

zhoufan лет назад: 8
Родитель
Сommit
f3784f8132
1 измененных файлов с 17 добавлено и 4 удалено
  1. 17 4
      WebUI/CallCenterWeb.UI/js/main.js

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

@@ -625,12 +625,25 @@ function getNowFormatDate() {
625 625
     return currentdate;
626 626
 }
627 627
 
628
+var iswebcloase = 1;
628 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 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