diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 72be1d6ad..27f39198e 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -98,21 +98,22 @@ import {MarkdownPreview} from "../store/markdown"; /** * 格式化时间 * @param date - * @param hiHours 小于多少小时只显示时间H:i * @returns {*|string} */ - formatTime(date, hiHours = 6) { + formatTime(date) { let now = $A.Time(), time = $A.Date(date, true), string = ''; - 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) - } else { - string = $A.formatDate('Y-m-d', time) + if ($A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { + return $A.formatDate('H:i', time) } - return string || ''; + if ($A.formatDate('Ymd', now - 86400) === $A.formatDate('Ymd', time)) { + return `${$A.L('昨天')} ${$A.formatDate('H:i', time)}` + } + if ($A.formatDate('Y', now) === $A.formatDate('Y', time)) { + return $A.formatDate('m-d', time) + } + return $A.formatDate('Y-m-d', time); }, /** @@ -163,7 +164,7 @@ import {MarkdownPreview} from "../store/markdown"; } else if (time == 0) { return 0 + 's'; } - return this.formatTime(date, 6) + return this.formatTime(date) }, /** diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 5b2237ee6..cc65a0ada 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -219,7 +219,7 @@