zhangshuangnan il y a 8 ans
Parent
commit
03c3f0b5e4
1 fichiers modifiés avec 30 ajouts et 5 suppressions
  1. 30 5
      WebUI/CallCenterWeb.UI/js/index.js

+ 30 - 5
WebUI/CallCenterWeb.UI/js/index.js

@@ -708,6 +708,34 @@ $(document).ready(function () {
708 708
             clearInterval(rd);
709 709
         }
710 710
     })
711
+    //即时通讯 消息总数
712
+    message_total();
713
+    setInterval(message_total, 5000);
714
+    function message_total(){
715
+    	 $.ajax({
716
+            type: "get",
717
+            url: huayi.config.callcenter_url + "Index/GetChatCount",
718
+            async: true,
719
+            dataType: 'json',
720
+            data: {
721
+                token: $.cookie("token"),
722
+                top: 50
723
+            },
724
+            success: function (data) {
725
+                if (data.total <= 0) {
726
+	                  $('.chat_count').hide();
727
+	                  $('.chat').removeClass("come_mess");
728
+                } else {
729
+                    $('.chat_count').show();
730
+                    $('.chat_count').html(data.total);
731
+                    $('.chat').addClass("come_mess");
732
+                }
733
+            }
734
+        });
735
+    	
736
+    	
737
+    	
738
+    }
711 739
     $('.chat').click(function () {
712 740
         $("#right-sidebar").toggleClass("sidebar-open");
713 741
         if ($("#right-sidebar").hasClass("sidebar-open")) {
@@ -717,6 +745,7 @@ $(document).ready(function () {
717 745
         else {
718 746
             clearInterval(msgs);
719 747
         }
748
+        
720 749
     })
721 750
 
722 751
     rightUp();
@@ -1578,12 +1607,8 @@ function messages(type) {
1578 1607
             if (type == 0) {
1579 1608
                 if (data.total == 0) {
1580 1609
                     $('.readed').hide();
1581
-                    $('.chat_count').hide();
1582
-                    $('.chat').removeClass("come_mess");
1610
+                   
1583 1611
                 } else {
1584
-                    $('.chat_count').show();
1585
-                    $('.chat_count').html(data.total);
1586
-                    $('.chat').addClass("come_mess");
1587 1612
                     $('.readed').show();
1588 1613
                 }
1589 1614
                 $('.close_chat').show();