diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index eacbd24..c7ca09e 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -30,7 +30,14 @@ - {{ localUserNickname }} + + {{ localUserNickname }} + {{ formatTime(message.timestamp) }} + + + + {{ formatTime(message.timestamp) }} + {{ message.content }} @@ -51,7 +58,10 @@ - 智能助手 + + 智能助手 + {{ formatTime(message.timestamp) }} + @@ -1032,20 +1042,9 @@ async loadChatHistoryIfExist() { // 格式化时间 formatTime(timestamp) { const date = new Date(timestamp) - const now = new Date() - const diff = now - date - - if (diff < 60000) { // 1分钟内 - return '刚刚' - } else if (diff < 3600000) { // 1小时内 - return Math.floor(diff / 60000) + '分钟前' - } else if (diff < 86400000) { // 1天内 - return Math.floor(diff / 3600000) + '小时前' - } else { - return date.getMonth() + 1 + '月' + date.getDate() + '日 ' + - date.getHours().toString().padStart(2, '0') + ':' + - date.getMinutes().toString().padStart(2, '0') - } + const hours = date.getHours().toString().padStart(2, '0') + const minutes = date.getMinutes().toString().padStart(2, '0') + return hours + ':' + minutes }, // 格式化文件大小 @@ -2093,11 +2092,20 @@ $radius-lg: 36rpx; color: $color-text-light; margin-bottom: 8rpx; letter-spacing: 0.5rpx; + display: flex; + align-items: center; + gap: 12rpx; + + .message-time { + font-size: 20rpx; + color: #999; + } } /* 用户昵称:右对齐 */ .user-message .message-nickname { text-align: right; + justify-content: flex-end; } /* AI 昵称:使用 .ai-nickname 类控制 */ @@ -2107,6 +2115,7 @@ $radius-lg: 36rpx; padding-left: 0; align-self: flex-start; margin-bottom: 4rpx; + justify-content: flex-start; } /* 用户消息特有样式 */