yangchenggong1_wd

fix |> 20785 【偶现】搜索结果,数据重复展示

... ... @@ -112,6 +112,7 @@ export class ContentDTO implements BaseDTO {
sameContentList:ContentDTO[] = []
sameContentListJson:string = ""
sameContentListSize:number = 0
sameContentListId:string = ""
/*
本地辅助字段
*/
... ...
... ... @@ -62,7 +62,6 @@ export struct SearchResultContentComponent {
this.curPageNum = 1
this.hasMore = true
this.isLoading = false
this.getNewSearchResultData()
}
... ... @@ -86,6 +85,10 @@ export struct SearchResultContentComponent {
}
getNewSearchResultData() {
if (this.isLoading){
return
}
this.isLoading = true
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("20", `${this.curPageNum}`, this.searchType, this.keywords,
... ... @@ -178,6 +181,8 @@ export struct SearchResultContentComponent {
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
}else{
this.isLoading = false
}
}
... ... @@ -236,12 +241,23 @@ export struct SearchResultContentComponent {
// }
let contentDTO = this.dataTransform(rem, value, photos);
if (value.data.type != "13") {
this.data.push(contentDTO)
if (value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
contentDTO2.sameContentListSize = value.data.sameContentList.length
this.data.push(contentDTO2)
//避免 重复(偶现bug 暂时处理)
let index = this.data.getDataArray().findIndex(obj => obj.objectId == contentDTO.objectId);
if (index === -1) {
this.data.push(contentDTO)
if (value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListId = contentDTO.objectId + value.data.sameContentList[0].id
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
contentDTO2.sameContentListSize = value.data.sameContentList.length
let index = this.data.getDataArray().findIndex(obj => obj.sameContentListId == contentDTO2.sameContentListId)
if (index === -1){
this.data.push(contentDTO2)
}
}
}
}
})
... ... @@ -256,6 +272,7 @@ export struct SearchResultContentComponent {
}
this.isLoading = false
}).catch((err: Error) => {
this.isLoading = false
console.log(TAG, JSON.stringify(err))
})
}).catch((err: Error) => {
... ... @@ -265,6 +282,7 @@ export struct SearchResultContentComponent {
})
} else {
this.hasMore = false
this.isLoading = false
}
}
... ...