Browse Source

消息总数

zhangshuangnan 8 years ago
parent
commit
03c3f0b5e4
1 changed files with 30 additions and 5 deletions
  1. 30 5
      WebUI/CallCenterWeb.UI/js/index.js

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

708
             clearInterval(rd);
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
     $('.chat').click(function () {
739
     $('.chat').click(function () {
712
         $("#right-sidebar").toggleClass("sidebar-open");
740
         $("#right-sidebar").toggleClass("sidebar-open");
713
         if ($("#right-sidebar").hasClass("sidebar-open")) {
741
         if ($("#right-sidebar").hasClass("sidebar-open")) {
717
         else {
745
         else {
718
             clearInterval(msgs);
746
             clearInterval(msgs);
719
         }
747
         }
748
+        
720
     })
749
     })
721
 
750
 
722
     rightUp();
751
     rightUp();
1578
             if (type == 0) {
1607
             if (type == 0) {
1579
                 if (data.total == 0) {
1608
                 if (data.total == 0) {
1580
                     $('.readed').hide();
1609
                     $('.readed').hide();
1581
-                    $('.chat_count').hide();
1582
-                    $('.chat').removeClass("come_mess");
1610
+                   
1583
                 } else {
1611
                 } else {
1584
-                    $('.chat_count').show();
1585
-                    $('.chat_count').html(data.total);
1586
-                    $('.chat').addClass("come_mess");
1587
                     $('.readed').show();
1612
                     $('.readed').show();
1588
                 }
1613
                 }
1589
                 $('.close_chat').show();
1614
                 $('.close_chat').show();