From 41be88ad78f08a445d03aa5bd2ebaaf4bad3d1d6 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Mon, 27 Jul 2020 15:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/html/chat_main.html | 24 ++---------------------- static/html/index.html | 1 + static/js/functions.js | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/static/html/chat_main.html b/static/html/chat_main.html index e8a2a4b..49399a8 100644 --- a/static/html/chat_main.html +++ b/static/html/chat_main.html @@ -237,7 +237,7 @@ this.addOnlineUser(redata.data); //发送通知 let _this=this; - this.notify(redata.data.username, { + notify(redata.data.username, { body: "来了", icon: redata.data.avator }, function(notification) { @@ -293,7 +293,7 @@ this.msgList.push(content); } //发送通知 - this.notify(msg.name, { + notify(msg.name, { body: msg.content, icon: msg.avator }, function(notification) { @@ -528,26 +528,6 @@ $('.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 () { this.getKefuInfo(); diff --git a/static/html/index.html b/static/html/index.html index 59de306..ebe6eca 100644 --- a/static/html/index.html +++ b/static/html/index.html @@ -127,6 +127,7 @@ {{.Document}} {{.VisitorBtn}} {{.AgentBtn}} + Github