Browse Source

修复消息乱序的bug

master
xie.bx 2 years ago
parent
commit
7ffe22ec9a
  1. 5
      im-ui/src/view/Home.vue
  2. 14
      im-uniapp/App.vue

5
im-ui/src/view/Home.vue

@ -145,11 +145,12 @@
method: 'get'
}).then((msgInfos) => {
msgInfos.forEach((msgInfo) => {
//
msgInfo.selfSend = msgInfo.sendId == this.$store.state.userStore.userInfo.id;
let groupId = msgInfo.groupId;
let group = this.$store.state.groupStore.groups.find((g) => g.id == groupId);
this.handleGroupMessage(group,msgInfo);
if(group){
this.insertGroupMessage(group,msgInfo);
}
})
if (msgInfos.length == 100) {
//

14
im-uniapp/App.vue

@ -69,7 +69,12 @@
method: 'get'
}).then((msgInfos) => {
msgInfos.forEach((msgInfo) => {
this.handlePrivateMessage(msgInfo);
msgInfo.selfSend = msgInfo.sendId == store.state.userStore.userInfo.id;
let friendId = msgInfo.selfSend ? msgInfo.recvId : msgInfo.sendId;
let friend = store.state.friendStore.friends.find((f) => f.id == friendId);
if(friend){
this.insertPrivateMessage(friend,msgInfo);
}
})
if (msgInfos.length == 100) {
//
@ -86,7 +91,12 @@
method: 'get'
}).then((msgInfos) => {
msgInfos.forEach((msgInfo) => {
this.handleGroupMessage(msgInfo);
msgInfo.selfSend = msgInfo.sendId == store.state.userStore.userInfo.id;
let groupId = msgInfo.groupId;
let group = store.state.groupStore.groups.find((g) => g.id == groupId);
if(group){
this.insertGroupMessage(group,msgInfo);
}
})
if (msgInfos.length == 100) {
//

Loading…
Cancel
Save