修复了一些逻辑漏洞
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { ChatMessage } from '@/types/api'
|
||||
import { formatTime } from '@/utils/format'
|
||||
import { formatMessageTime } from '@/utils/format'
|
||||
import { isSystemOrNotifyMessage, getMessageTypeIcon, getMessageSummary } from '@/utils/messageTypes'
|
||||
import { MessageType } from '@/types/message'
|
||||
import TextBubble from './bubble/Text.vue'
|
||||
@@ -84,16 +84,8 @@ const bubbleShapeClass = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
// 使用 format.ts 中的逻辑,但可以根据需要微调为 HH:mm
|
||||
// 使用相对时间格式化
|
||||
const formattedTime = computed(() => {
|
||||
const date = new Date(props.message.created_at)
|
||||
// 如果是当天,只显示时间,否则显示日期+时间
|
||||
const now = new Date()
|
||||
const isToday = date.toDateString() === now.toDateString()
|
||||
|
||||
if (isToday) {
|
||||
return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
return formatTime(props.message.created_at)
|
||||
return formatMessageTime(props.message.created_at)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user