diff --git a/im-uniapp/store/chatStore.js b/im-uniapp/store/chatStore.js index 16d3419..91dc0a1 100644 --- a/im-uniapp/store/chatStore.js +++ b/im-uniapp/store/chatStore.js @@ -523,6 +523,14 @@ export default defineStore('chatStore', { if (msgInfo.tmpId) { for (let idx = chat.messages.length - 1; idx >= 0; idx--) { let m = chat.messages[idx]; + // 这里只查询临时消息,跳过正常消息 + if (m.id) { + continue; + } + // 这里只查询临时消息,跳过有id的正常消息 + if (m.id) { + contine; + } if (m.tmpId && msgInfo.tmpId == m.tmpId) { return m; } diff --git a/im-web/src/store/chatStore.js b/im-web/src/store/chatStore.js index 046d842..f4b6bc7 100644 --- a/im-web/src/store/chatStore.js +++ b/im-web/src/store/chatStore.js @@ -551,6 +551,10 @@ export default defineStore('chatStore', { if (msgInfo.tmpId) { for (let idx = chat.messages.length - 1; idx >= 0; idx--) { let m = chat.messages[idx]; + // 这里只查询临时消息,跳过正常消息 + if (m.id) { + continue; + } if (m.tmpId && msgInfo.tmpId == m.tmpId) { return m; }