Browse Source

fix: 重连后已读状态异常的bug

master
xsx 8 months ago
parent
commit
40ac808f56
  1. 39
      im-uniapp/pages/chat/chat-box.vue
  2. 11
      im-web/src/components/chat/ChatBox.vue

39
im-uniapp/pages/chat/chat-box.vue

@ -257,12 +257,12 @@ export default {
this.atUserIds = atUserIds;
},
onLongPressHead(msgInfo) {
if (!msgInfo.selfSend && this.chat.type == "GROUP" && this.atUserIds.indexOf(msgInfo.sendId) < 0) {
if (!msgInfo.selfSend && this.isGroup && this.atUserIds.indexOf(msgInfo.sendId) < 0) {
this.atUserIds.push(msgInfo.sendId);
}
},
headImage(msgInfo) {
if (this.chat.type == 'GROUP') {
if (this.isGroup) {
let member = this.groupMembers.find((m) => m.userId == msgInfo.sendId);
return member ? member.headImage : "";
} else {
@ -270,7 +270,7 @@ export default {
}
},
showName(msgInfo) {
if (this.chat.type == 'GROUP') {
if (this.isGroup) {
let member = this.groupMembers.find((m) => m.userId == msgInfo.sendId);
return member ? member.showNickName : "";
} else {
@ -357,7 +357,7 @@ export default {
return atText;
},
fillTargetId(msgInfo, targetId) {
if (this.chat.type == "GROUP") {
if (this.isGroup) {
msgInfo.groupId = targetId;
} else {
msgInfo.recvId = targetId;
@ -675,7 +675,7 @@ export default {
}, 50)
},
onShowMore() {
if (this.chat.type == "GROUP") {
if (this.isGroup) {
uni.navigateTo({
url: "/pages/group/group-info?id=" + this.group.id
})
@ -728,7 +728,7 @@ export default {
readedMessage() {
if (this.unreadCount > 0) {
let url = ""
if (this.chat.type == "GROUP") {
if (this.isGroup) {
url = `/message/group/readed?groupId=${this.chat.targetId}`
} else {
url = `/message/private/readed?friendId=${this.chat.targetId}`
@ -919,7 +919,7 @@ export default {
sendTime: new Date().getTime(),
type: this.$enums.MESSAGE_TYPE.TIP_TEXT
}
if (this.chat.type == "PRIVATE") {
if (this.isPrivate) {
msgInfo.recvId = this.mine.id
msgInfo.content = "该用户已被管理员封禁,原因:" + this.userInfo.reason
} else {
@ -969,7 +969,7 @@ export default {
return "";
}
let title = this.chat.showName;
if (this.chat.type == "GROUP") {
if (this.isGroup) {
let size = this.groupMembers.filter(m => !m.quit).length;
title += `(${size})`;
}
@ -991,8 +991,8 @@ export default {
return this.chat.unreadCount;
},
isBanned() {
return (this.chat.type == "PRIVATE" && this.userInfo.isBanned) ||
(this.chat.type == "GROUP" && this.group.isBanned)
return (this.isPrivate && this.userInfo.isBanned) ||
(this.isGroup && this.group.isBanned)
},
atUserItems() {
let atUsers = [];
@ -1013,6 +1013,15 @@ export default {
},
memberSize() {
return this.groupMembers.filter(m => !m.quit).length;
},
isGroup() {
return this.chat.type == 'GROUP';
},
isPrivate() {
return this.chat.type == 'PRIVATE';
},
loading() {
return this.chatStore.loading;
}
},
watch: {
@ -1038,6 +1047,14 @@ export default {
this.readedMessage()
}
}
},
loading: {
handler(newLoading, oldLoading) {
// 线
if (!newLoading && this.isPrivate) {
this.loadReaded(this.chat.targetId)
}
}
}
},
onLoad(options) {
@ -1049,7 +1066,7 @@ export default {
//
this.readedMessage()
//
if (this.chat.type == "GROUP") {
if (this.isGroup) {
this.loadGroup(this.chat.targetId);
} else {
this.loadFriend(this.chat.targetId);

11
im-web/src/components/chat/ChatBox.vue

@ -784,6 +784,9 @@ export default {
},
isPrivate() {
return this.chat.type == 'PRIVATE';
},
loading() {
return this.chatStore.loading;
}
},
watch: {
@ -833,6 +836,14 @@ export default {
}
}
}
},
loading: {
handler(newLoading, oldLoading) {
// 线
if (!newLoading && this.isPrivate) {
this.loadReaded(this.chat.targetId)
}
}
}
},
mounted() {

Loading…
Cancel
Save