|
|
@@ -162,7 +162,7 @@ function Connect() {
|
|
162
|
162
|
//console.log("连接关闭!");
|
|
163
|
163
|
$(".hwzt").text('连接关闭!');
|
|
164
|
164
|
$("#top-search li i").removeClass("active");
|
|
165
|
|
- //showMsgNotification('呼叫系统提示', '话务连接关闭'); //暂时关闭
|
|
|
165
|
+ showMsgNotification('呼叫系统提示', '话务连接关闭'); //暂时关闭
|
|
166
|
166
|
reconnect();
|
|
167
|
167
|
}
|
|
168
|
168
|
};
|
|
|
@@ -170,7 +170,7 @@ function Connect() {
|
|
170
|
170
|
ws.onerror = function(evt) {
|
|
171
|
171
|
//产生异常
|
|
172
|
172
|
$(".hwzt").text('连接出现异常!');
|
|
173
|
|
- //showMsgNotification('呼叫系统提示', '连接出现异常'); //暂时关闭
|
|
|
173
|
+ showMsgNotification('呼叫系统提示', '连接出现异常'); //暂时关闭
|
|
174
|
174
|
console.log(ws);
|
|
175
|
175
|
if(ws == null || ws.readyState != ws.OPEN) {
|
|
176
|
176
|
console.log(new Date() + "开始重连");
|
|
|
@@ -547,82 +547,78 @@ function getNowFormatDate() {
|
|
547
|
547
|
}
|
|
548
|
548
|
//桌面弹出提示
|
|
549
|
549
|
function showMsgNotification(title, msg) {
|
|
550
|
|
- var Notification = window.Notification || window.mozNotification || window.webkitNotification;
|
|
551
|
|
-
|
|
552
|
|
- if(Notification) {//支持桌面通知
|
|
553
|
|
- if(Notification.permission == "granted") {//已经允许通知
|
|
554
|
|
- var instance = new Notification(title, {
|
|
555
|
|
- body: msg,
|
|
556
|
|
- tag:msg,
|
|
557
|
|
- icon: "img/tips.png",
|
|
558
|
|
- requireInteraction:true,
|
|
559
|
|
- renotify:true
|
|
560
|
|
-
|
|
561
|
|
- });
|
|
562
|
|
-
|
|
563
|
|
- instance.onclick = function() {
|
|
564
|
|
-// $('body').css({'background': 'red'});
|
|
565
|
|
-// console.log('onclick');
|
|
566
|
|
-// instance.close();
|
|
567
|
|
- };
|
|
568
|
|
- instance.onerror = function() {
|
|
569
|
|
- console.log('onerror');
|
|
570
|
|
- };
|
|
571
|
|
- instance.onshow = function() {
|
|
572
|
|
- console.log('onshow');
|
|
573
|
|
- };
|
|
574
|
|
- instance.onclose = function() {
|
|
575
|
|
- console.log('onclose');
|
|
576
|
|
- };
|
|
577
|
|
- }else {//第一次询问或已经禁止通知(如果用户之前已经禁止显示通知,那么浏览器不会再次询问用户的意见,Notification.requestPermission()方法无效)
|
|
578
|
|
- Notification.requestPermission(function(status) {
|
|
579
|
|
- if (status === "granted") {//用户允许
|
|
580
|
|
- var instance = new Notification(title, {
|
|
581
|
|
- body: msg,
|
|
582
|
|
- tag:msg,
|
|
583
|
|
- icon: "img/tips.png",
|
|
584
|
|
- requireInteraction:true,
|
|
585
|
|
- renotify:true
|
|
586
|
|
- });
|
|
587
|
|
-
|
|
588
|
|
- instance.onclick = function() {
|
|
589
|
|
- // Something to do
|
|
590
|
|
- };
|
|
591
|
|
- instance.onerror = function() {
|
|
592
|
|
- // Something to do
|
|
593
|
|
- };
|
|
594
|
|
- instance.onshow = function() {
|
|
595
|
|
- // Something to do
|
|
596
|
|
- };
|
|
597
|
|
- instance.onclose = function() {
|
|
598
|
|
- // Something to do
|
|
599
|
|
- };
|
|
600
|
|
- }else {//用户禁止
|
|
601
|
|
- return false
|
|
602
|
|
- }
|
|
603
|
|
- });
|
|
604
|
|
- }
|
|
605
|
|
- }else {//不支持(IE等)
|
|
606
|
|
- var index = 0;
|
|
|
550
|
+// var Notification = window.Notification || window.mozNotification || window.webkitNotification;
|
|
|
551
|
+//
|
|
|
552
|
+// if(Notification) {//支持桌面通知
|
|
|
553
|
+// if(Notification.permission == "granted") {//已经允许通知
|
|
|
554
|
+// var instance = new Notification(title, {
|
|
|
555
|
+// body: msg,
|
|
|
556
|
+// tag:msg,
|
|
|
557
|
+// icon: "img/tips.png",
|
|
|
558
|
+// requireInteraction:true,
|
|
|
559
|
+// renotify:true
|
|
|
560
|
+//
|
|
|
561
|
+// });
|
|
|
562
|
+//
|
|
|
563
|
+// instance.onclick = function() {
|
|
|
564
|
+//// $('body').css({'background': 'red'});
|
|
|
565
|
+//// console.log('onclick');
|
|
|
566
|
+//// instance.close();
|
|
|
567
|
+// };
|
|
|
568
|
+// instance.onerror = function() {
|
|
|
569
|
+// console.log('onerror');
|
|
|
570
|
+// };
|
|
|
571
|
+// instance.onshow = function() {
|
|
|
572
|
+// console.log('onshow');
|
|
|
573
|
+// };
|
|
|
574
|
+// instance.onclose = function() {
|
|
|
575
|
+// console.log('onclose');
|
|
|
576
|
+// };
|
|
|
577
|
+// }else {//第一次询问或已经禁止通知(如果用户之前已经禁止显示通知,那么浏览器不会再次询问用户的意见,Notification.requestPermission()方法无效)
|
|
|
578
|
+// Notification.requestPermission(function(status) {
|
|
|
579
|
+// if (status === "granted") {//用户允许
|
|
|
580
|
+// var instance = new Notification(title, {
|
|
|
581
|
+// body: msg,
|
|
|
582
|
+// tag:msg,
|
|
|
583
|
+// icon: "img/tips.png",
|
|
|
584
|
+// requireInteraction:true,
|
|
|
585
|
+// renotify:true
|
|
|
586
|
+// });
|
|
|
587
|
+//
|
|
|
588
|
+// instance.onclick = function() {
|
|
|
589
|
+// // Something to do
|
|
|
590
|
+// };
|
|
|
591
|
+// instance.onerror = function() {
|
|
|
592
|
+// // Something to do
|
|
|
593
|
+// };
|
|
|
594
|
+// instance.onshow = function() {
|
|
|
595
|
+// // Something to do
|
|
|
596
|
+// };
|
|
|
597
|
+// instance.onclose = function() {
|
|
|
598
|
+// // Something to do
|
|
|
599
|
+// };
|
|
|
600
|
+// }else {//用户禁止
|
|
|
601
|
+// return false
|
|
|
602
|
+// }
|
|
|
603
|
+// });
|
|
|
604
|
+// }
|
|
|
605
|
+// }else {//不支持(IE等)
|
|
|
606
|
+
|
|
|
607
|
+ var index = 0;
|
|
607
|
608
|
|
|
608
|
609
|
clearInterval(timer);
|
|
609
|
610
|
timer = setInterval(function() {
|
|
610
|
611
|
if(index%2) {
|
|
611
|
|
- $('title').text('【 】'+ title);//这里是中文全角空格,其他不行
|
|
|
612
|
+ $('title').text('【 】'+ title);//这里是中文全角空格,其他不行
|
|
612
|
613
|
}else {
|
|
613
|
|
- $('title').text('【新消息】'+ title);
|
|
|
614
|
+ $('title').text('【'+ msg+'】'+ title);
|
|
614
|
615
|
}
|
|
615
|
616
|
index++;
|
|
616
|
|
-
|
|
617
|
|
- if(index > 20) {
|
|
618
|
|
- clearInterval(timer);
|
|
619
|
|
- }
|
|
|
617
|
+// if(index > 20) {
|
|
|
618
|
+// clearInterval(timer);
|
|
|
619
|
+// }
|
|
620
|
620
|
}, 500);
|
|
621
|
|
- }
|
|
622
|
|
-
|
|
623
|
|
-
|
|
624
|
|
-
|
|
625
|
|
-
|
|
|
621
|
+// }
|
|
626
|
622
|
|
|
627
|
623
|
}
|
|
628
|
624
|
|