wuyanan

ref |>修复缺陷 18780-进入直播间,未评论,评论后,切换直播间,然后在切到大家聊后,数据消失

... ... @@ -34,6 +34,7 @@ export struct TabChatComponent {
updateData() {
if (this.index === this.parentComponentIndex && this.initUI) {
this.initUI = false
this.getLiveList()
}
... ... @@ -87,7 +88,7 @@ export struct TabChatComponent {
this.ListLayout()
},
onRefresh: (resolve) => {
this.pageModel.currentPage = 1
this.pageModel.currentPage ++
this.getLiveList(resolve)
},
... ... @@ -136,7 +137,6 @@ export struct TabChatComponent {
return
}
this.pageModel.isLoading = true
this.pageModel.currentPage = 1
this.liveViewModel.getLiveChatList(
this.pageModel.currentPage,
this.contentDetailData?.liveInfo?.mlive?.mliveId,
... ... @@ -152,34 +152,37 @@ export struct TabChatComponent {
resolve('')
}
}
if (this.pageModel.currentPage === 1) {
this.liveChatList.clear()
}
// if (this.pageModel.currentPage === 1) {
// this.liveChatList.clear()
// }
Logger.debug(TAG, `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
this.pageModel.viewType = ViewType.LOADED;
this.liveChatList.push(...data.barrageResponses)
if (this.initUI) {
this.initUI = false
if (this.pageModel.currentPage === 1) {
setTimeout(() => {
this.scroller.scrollToIndex(this.liveChatList.totalCount() - 1)
}, 300)
}
if (data.barrageResponses.length === this.pageModel.pageSize) {
this.pageModel.currentPage++;
this.pageModel.hasMore = true;
} else {
this.pageModel.hasMore = false;
}
// this.pageModel.currentPage++;
// if (data.barrageResponses.length === this.pageModel.pageSize) {
//
// this.pageModel.hasMore = true;
// } else {
// this.pageModel.hasMore = false;
// }
} else {
this.pageModel.viewType = ViewType.EMPTY;
if (this.liveChatList.totalCount() == 0 ) {
this.pageModel.viewType = ViewType.EMPTY;
}
}
},
() => {
Logger.debug(TAG, `error`)
this.pageModel.viewType = ViewType.ERROR;
if (this.liveChatList.totalCount() == 0) {
this.pageModel.viewType = ViewType.ERROR;
}
})
}
... ...