This commit is contained in:
2025-06-26 10:09:06 +08:00
parent 6091a012cf
commit 5a0444234f

View File

@@ -673,20 +673,23 @@
})
.then(response => {
console.log('请求成功:', response.data);
// 添加消息到UI自己的消息
addMessage({
userId: currentUser.id,
name: currentUser.name,
avatarColor: currentUser.avatarColor,
text: text,
timestamp: new Date(),
type: 'sent'
});
// 清空输入框
messageInput.value = '';
let res = response.data;
if (res.code === 200) {
// 添加消息到UI自己的消息
addMessage({
userId: currentUser.id,
name: currentUser.name,
avatarColor: currentUser.avatarColor,
text: text,
timestamp: new Date(),
type: 'sent'
});
// 清空输入框
messageInput.value = '';
// 重新聚焦输入框
messageInput.focus();
// 重新聚焦输入框
messageInput.focus();
}
})
.catch(error => {
console.error('请求出错:', error);