From ac17952cd3e7d32a5588309f97e0008511314966 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 6 Mar 2024 12:01:18 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/functions/web.js | 7 ++++--- resources/assets/js/pages/manage/components/DialogView.vue | 2 +- resources/assets/js/pages/manage/messenger.vue | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index c4b571ba1..28e288f72 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -88,13 +88,14 @@ import {MarkdownPreview} from "../store/markdown"; /** * 格式化时间 * @param date + * @param hiHours 小于多少小时只显示时间H:i * @returns {*|string} */ - formatTime(date) { + formatTime(date, hiHours = 6) { let now = $A.Time(), time = $A.Date(date, true), string = ''; - if (Math.abs(now - time) < 3600 * 6 || $A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { + if (Math.abs(now - time) < 3600 * hiHours || $A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { string = $A.formatDate('H:i', time) } else if ($A.formatDate('Y', now) === $A.formatDate('Y', time)) { string = $A.formatDate('m-d', time) @@ -152,7 +153,7 @@ import {MarkdownPreview} from "../store/markdown"; } else if (time == 0) { return 0 + 's'; } - return this.formatTime(date) + return this.formatTime(date, 6) }, /** diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index cc65a0ada..5b2237ee6 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -219,7 +219,7 @@