|
|
@ -237,7 +237,7 @@
|
|
|
|
this.addOnlineUser(redata.data);
|
|
|
|
this.addOnlineUser(redata.data);
|
|
|
|
//发送通知
|
|
|
|
//发送通知
|
|
|
|
let _this=this;
|
|
|
|
let _this=this;
|
|
|
|
this.notify(redata.data.username, {
|
|
|
|
notify(redata.data.username, {
|
|
|
|
body: "来了",
|
|
|
|
body: "来了",
|
|
|
|
icon: redata.data.avator
|
|
|
|
icon: redata.data.avator
|
|
|
|
}, function(notification) {
|
|
|
|
}, function(notification) {
|
|
|
@ -293,7 +293,7 @@
|
|
|
|
this.msgList.push(content);
|
|
|
|
this.msgList.push(content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//发送通知
|
|
|
|
//发送通知
|
|
|
|
this.notify(msg.name, {
|
|
|
|
notify(msg.name, {
|
|
|
|
body: msg.content,
|
|
|
|
body: msg.content,
|
|
|
|
icon: msg.avator
|
|
|
|
icon: msg.avator
|
|
|
|
}, function(notification) {
|
|
|
|
}, function(notification) {
|
|
|
@ -528,26 +528,6 @@
|
|
|
|
$('.chatBox').scrollTop($(".chatBox")[0].scrollHeight);
|
|
|
|
$('.chatBox').scrollTop($(".chatBox")[0].scrollHeight);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
notify(title, options, callback) {
|
|
|
|
|
|
|
|
// 先检查浏览器是否支持
|
|
|
|
|
|
|
|
if (!window.Notification) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var notification;
|
|
|
|
|
|
|
|
// 检查用户曾经是否同意接受通知
|
|
|
|
|
|
|
|
if (Notification.permission === 'granted') {
|
|
|
|
|
|
|
|
notification = new Notification(title, options); // 显示通知
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var promise = Notification.requestPermission();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (notification && callback) {
|
|
|
|
|
|
|
|
notification.onclick = function(event) {
|
|
|
|
|
|
|
|
callback(notification, event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
this.getKefuInfo();
|
|
|
|
this.getKefuInfo();
|
|
|
|