Commit f2a6352f by Sixong.Zhu

调整已读未读逻辑,移除多余检查

parent cb2682db
...@@ -172,7 +172,10 @@ ...@@ -172,7 +172,10 @@
public mounted() { public mounted() {
this.scollWrapper && this.scollWrapper &&
this.scollWrapper.addEventListener("scroll", this.handleScroll); this.scollWrapper.addEventListener("scroll", this.handleScroll);
this.saveScrollToBottomFunc(this.scrollToNewMsg); this.saveScrollToBottomFunc((e) => {
this.scrollToNewMsg();
this.checkReadingStatus(e);
});
this.scrollToNewMsg(); this.scrollToNewMsg();
setTimeout(() => this.scroll2End(200)); setTimeout(() => this.scroll2End(200));
setTimeout(() => this.scroll2End(1000), 200); setTimeout(() => this.scroll2End(1000), 200);
...@@ -206,6 +209,10 @@ ...@@ -206,6 +209,10 @@
}); });
} }
private checkReadingStatus(e: Message) {
return e;
}
private startLoading() { private startLoading() {
this.loading = true; this.loading = true;
} }
......
...@@ -234,9 +234,6 @@ ...@@ -234,9 +234,6 @@
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER)
private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER; private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER;
@chatStore.Action(ChatStore.ACTION_UPDATE_MESSAGE_READ_STATUS)
private readonly updateMessage!: ChatStore.ACTION_UPDATE_MESSAGE_READ_STATUS;
@Prop({ type: Object, default: () => Object.create(null) }) @Prop({ type: Object, default: () => Object.create(null) })
private readonly data!: dto.Message; private readonly data!: dto.Message;
...@@ -504,32 +501,6 @@ ...@@ -504,32 +501,6 @@
created() { created() {
this.messageComponent = messageMapping.get(this.messageType) as string; this.messageComponent = messageMapping.get(this.messageType) as string;
if (Xim.isBackend()) {
this.data &&
!this.isAllRead &&
ximInstance
.queryNextPageMsg(
"group",
this.chatId as number,
this.data.id - 1,
1
)
.then((m) => {
if (m && m.length) {
const t = m[0];
t.read_count &&
t.read_count !== this.data.read_count &&
this.updateMessage({
chat: this.chatId as number,
start: this.data.id,
all: (this.manualAllRead =
t.read_count === t.total_read_count),
readed: (this.manualReaded = t.read_count),
});
}
});
}
} }
private isCustomer() { private isCustomer() {
......
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
[ChatStore.STATE_ALL_HISTORY_CHAT_MEMBERS]: null, [ChatStore.STATE_ALL_HISTORY_CHAT_MEMBERS]: null,
[ChatStore.STATE_CURRENT_CHAT_TITLE]: "", [ChatStore.STATE_CURRENT_CHAT_TITLE]: "",
[ChatStore.STATE_FUNC_SCROLL_TO_BOTTOM]: () => true, [ChatStore.STATE_FUNC_SCROLL_TO_BOTTOM]: () => true,
[ChatStore.STATE_FUNC_ON_NEW_MSG]: () => true, [ChatStore.STATE_FUNC_ON_NEW_MSG]: (e: Message) => e,
[ChatStore.STATE_CURRENT_CHAT_INPUTING]: [], [ChatStore.STATE_CURRENT_CHAT_INPUTING]: [],
[ChatStore.STATE_CURRENT_CHAT_INITING]: false, [ChatStore.STATE_CURRENT_CHAT_INITING]: false,
[ChatStore.STATE_CHAT_CURRENT_USER_TYPE]: null, [ChatStore.STATE_CHAT_CURRENT_USER_TYPE]: null,
...@@ -304,7 +304,7 @@ export default { ...@@ -304,7 +304,7 @@ export default {
state[ChatStore.STATE_SINGLE_CHAT] = null; state[ChatStore.STATE_SINGLE_CHAT] = null;
}, },
[ChatStore.MUTATION_SCROLL_TO_BOTTOM](state) { [ChatStore.MUTATION_SCROLL_TO_BOTTOM](state) {
state[ChatStore.STATE_FUNC_SCROLL_TO_BOTTOM](); state[ChatStore.STATE_FUNC_SCROLL_TO_BOTTOM](null);
}, },
[ChatStore.MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM]( [ChatStore.MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM](
state, state,
......
...@@ -77,7 +77,7 @@ export namespace ChatStore { ...@@ -77,7 +77,7 @@ export namespace ChatStore {
export type STATE_CURRENT_CHAT_TITLE = string; export type STATE_CURRENT_CHAT_TITLE = string;
export const STATE_FUNC_SCROLL_TO_BOTTOM = "收到消息后滚动到底部的方法"; export const STATE_FUNC_SCROLL_TO_BOTTOM = "收到消息后滚动到底部的方法";
export type STATE_FUNC_SCROLL_TO_BOTTOM = () => void; export type STATE_FUNC_SCROLL_TO_BOTTOM = (e: chatDto.Message) => void;
export const STATE_FUNC_ON_NEW_MSG = "收到消息回调方法"; export const STATE_FUNC_ON_NEW_MSG = "收到消息回调方法";
export type STATE_FUNC_ON_NEW_MSG = (e: chatDto.Message) => void; export type STATE_FUNC_ON_NEW_MSG = (e: chatDto.Message) => void;
...@@ -204,7 +204,7 @@ export namespace ChatStore { ...@@ -204,7 +204,7 @@ export namespace ChatStore {
export const MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM = export const MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM =
"保存收到新消息后滚动到底部的方法"; "保存收到新消息后滚动到底部的方法";
export type MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM = ( export type MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM = (
func: () => void func: (e: chatDto.Message) => void
) => void; ) => void;
export const MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM = export const MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM =
"删除收到新消息后滚动到底部的方法"; "删除收到新消息后滚动到底部的方法";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment