未读显示bug修复
This commit is contained in:
@@ -306,9 +306,6 @@ export default {
|
||||
changeMenu(menu) {
|
||||
this.activeMenu = menu;
|
||||
this.currentContact = null;
|
||||
if (menu === "contacts") {
|
||||
this.getContactList();
|
||||
}
|
||||
},
|
||||
|
||||
// 退出登录
|
||||
@@ -326,6 +323,7 @@ export default {
|
||||
.then((response) => {
|
||||
this.currentUser = response.data;
|
||||
this.getRecentMessageList();
|
||||
this.getContactList();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
@@ -492,9 +490,11 @@ export default {
|
||||
contactName: contactName,
|
||||
content: newMessage.content,
|
||||
createdAt: newMessage.createdAt,
|
||||
unreadCount: 1,
|
||||
unreadCount: 1
|
||||
});
|
||||
}
|
||||
|
||||
this.$nextTick();
|
||||
},
|
||||
|
||||
// 监听websocket连接成功事件
|
||||
@@ -535,21 +535,20 @@ export default {
|
||||
from: "other",
|
||||
time: message.createdAt,
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottom();
|
||||
});
|
||||
} else {
|
||||
// 不是当前联系人,不加入 contactMessages
|
||||
// 如果是当前联系人列表中的成员,更新最近聊天列表、未读数量
|
||||
const contactIndex = this.contactList.findIndex(
|
||||
(item) => item.contactName === senderName
|
||||
);
|
||||
console.log("contactIndex="+contactIndex)
|
||||
if (contactIndex === -1) return;
|
||||
|
||||
this.updateRecentChat("receive", senderName, message);
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottom();
|
||||
});
|
||||
|
||||
// 发送新消息成功之后,需要把新消息显示到聊天框中(由于要拿数据库里的写入时间,所以要等websocket返回成功再刷新)
|
||||
} else if (data.type == "sendSuccess") {
|
||||
const message = data.message;
|
||||
|
||||
Reference in New Issue
Block a user