fix: 消息阅读回馈

This commit is contained in:
Pang 2024-01-04 20:14:26 +08:00
parent e215cda700
commit 4144f92631
2 changed files with 11 additions and 5 deletions

View File

@ -3062,14 +3062,10 @@ export default {
if (dialog && $A.isArray(dialog.position_msgs)) { if (dialog && $A.isArray(dialog.position_msgs)) {
const index = dialog.position_msgs.findIndex(({msg_id}) => msg_id == data.id); const index = dialog.position_msgs.findIndex(({msg_id}) => msg_id == data.id);
if (index > -1) { if (index > -1) {
state.readEndMark[data.dialog_id] = Math.max(data.id, $A.runNum(state.readEndMark[data.dialog_id]))
dialog.position_msgs.splice(index, 1); dialog.position_msgs.splice(index, 1);
dispatch("saveDialog", dialog) dispatch("saveDialog", dialog)
} }
dispatch("dialogMsgMark", {
type: 'read',
dialog_id: data.dialog_id,
after_msg_id: data.id,
})
} }
} }
clearTimeout(state.readTimeout); clearTimeout(state.readTimeout);
@ -3098,6 +3094,15 @@ export default {
}) })
}).finally(_ => { }).finally(_ => {
state.readLoadNum++ state.readLoadNum++
//
for (let dialog_id in state.readEndMark) {
dispatch("dialogMsgMark", {
type: 'read',
dialog_id,
after_msg_id: state.readEndMark[dialog_id],
})
}
state.readEndMark = {}
}); });
}, 50); }, 50);
}, },

View File

@ -130,6 +130,7 @@ export default {
readLoadNum: 0, readLoadNum: 0,
readTimeout: null, readTimeout: null,
readWaitData: {}, readWaitData: {},
readEndMark: {},
// 文件 // 文件
fileLists: [], fileLists: [],