feat: 添加对话切换标志位,防止上拉刷新异常出发

This commit is contained in:
yangzhe 2025-07-14 09:45:17 +08:00
parent 1ed96024b4
commit 3ba1e3e0e7
1 changed files with 30 additions and 2 deletions

View File

@ -275,6 +275,7 @@ export default {
isLoading: false, // loadingMore
isLoadingMore: false, //
noMoreData: false, //
isSwitchingConversation: false, //
pageQuery: {
PageIndex: 1,
@ -544,6 +545,9 @@ export default {
this.isChat = true;
//
this.isSwitchingConversation = true;
//
this.messageGroups = [];
this.pageQuery.PageIndex = 1;
@ -572,6 +576,12 @@ export default {
//
return timeA - timeB;
});
})
.finally(() => {
//
setTimeout(() => {
this.isSwitchingConversation = false;
}, 500);
});
},
@ -580,6 +590,10 @@ export default {
//
this.popupShow = false;
this.isChat = true;
//
this.isSwitchingConversation = true;
this.currentConversationId = "";
this.messageGroups = [];
@ -587,11 +601,20 @@ export default {
this.pageQuery.PageIndex = 1;
this.isLoadingMore = false;
this.noMoreData = false;
//
setTimeout(() => {
this.isSwitchingConversation = false;
}, 500);
},
//
handleStartChat() {
this.isChat = true;
//
this.isSwitchingConversation = true;
this.currentConversationId = "";
this.messageGroups = [];
@ -599,6 +622,11 @@ export default {
this.pageQuery.PageIndex = 1;
this.isLoadingMore = false;
this.noMoreData = false;
//
setTimeout(() => {
this.isSwitchingConversation = false;
}, 500);
},
//
@ -610,8 +638,8 @@ export default {
onScrollToUpper() {
console.log("触发上拉刷新");
//
if (this.noMoreData) {
//
if (this.noMoreData || this.isSwitchingConversation) {
return;
}