From df1d5d97c4d7424e9f3be87500fe3591aa7251d2 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 21 May 2022 20:03:18 +0800 Subject: [PATCH] no message --- resources/assets/js/functions/web.js | 8 +++----- resources/assets/js/pages/manage.vue | 5 ++++- .../assets/js/pages/manage/components/DialogView.vue | 4 +++- resources/assets/js/pages/manage/messenger.vue | 4 +++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 16ffb726c..e40e91297 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -102,13 +102,11 @@ * @returns {*|string} */ formatTime(date) { - let time = $A.Date(date, true), - now = $A.Time(), + let now = $A.Time(), + time = $A.Date(date, true), string = ''; - if ($A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { + if (now - time < 3600 * 6 || $A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { string = $A.formatDate('H:i', time) - } else if (now - time < 86400 * 7) { - string = $A.formatDate('m-d H:i', time) } else if ($A.formatDate('Y', now) === $A.formatDate('Y', time)) { string = $A.formatDate('m-d', time) } else { diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 8d916175c..0e14f9994 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -907,7 +907,10 @@ export default { return; // 可见 且 路由匹配时 } // - const {id, dialog_id, type, msg} = data; + const {id, dialog_id, type, msg, userid} = data; + if (userid == this.userId) { + return; // 自己的消息不弹出通知 + } let body = ''; switch (type) { case 'text': diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index eee7ff5fa..302043f0f 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -47,7 +47,8 @@
-
{{$A.formatTime(msgData.created_at)}}
+
{{msgData.created_at}}
+
{{$A.formatTime(msgData.created_at)}}
{ - this.$store.dispatch("getDialogs", true).catch(() => {}); + if (this.tabActive === 'dialog') { + this.$store.dispatch("getDialogs", true).catch(() => {}); + } }, 2000) }, }