|
|
@@ -49,13 +49,16 @@ const NotificationIconWidget = () => {
|
|
|
localStorage.setItem("notification/new", newMessageTime);
|
|
|
if (window.Notification && Notification.permission !== "denied") {
|
|
|
Notification.requestPermission(function (status) {
|
|
|
- const notification = new Notification("通知标题", {
|
|
|
- body: json.data.rows[0].content,
|
|
|
- icon:
|
|
|
- process.env.REACT_APP_API_HOST +
|
|
|
- "/assets/images/wikipali_logo.png",
|
|
|
- tag: json.data.rows[0].id,
|
|
|
- });
|
|
|
+ const notification = new Notification(
|
|
|
+ json.data.rows[0].res_type,
|
|
|
+ {
|
|
|
+ body: json.data.rows[0].content,
|
|
|
+ icon:
|
|
|
+ process.env.REACT_APP_API_HOST +
|
|
|
+ "/assets/images/wikipali_logo.png",
|
|
|
+ tag: json.data.rows[0].id,
|
|
|
+ }
|
|
|
+ );
|
|
|
notification.onclick = (event) => {
|
|
|
event.preventDefault(); // 阻止浏览器聚焦于 Notification 的标签页
|
|
|
window.open(json.data.rows[0].url, "_blank");
|