wangliang_wd

feat:优化我的收藏评论拉取逻辑

... ... @@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { NetworkUtil } from 'wdKit/Index';
... ... @@ -180,18 +180,9 @@ struct MyCollectionListPage {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < collectionItem.list.length; index++) {
const compDTO = collectionItem.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
if (this.allDatas.length > 0){
this.getContentData()
if (collectionItem.list.length > 0){
this.getContentData(collectionItem)
}
if (collectionItem.hasNext === 0) {
... ... @@ -279,13 +270,13 @@ struct MyCollectionListPage {
}
}
async getContentData(){
async getContentData(item:MyCollectionItem){
try {
// 获取列表数据
const params: contentListParams = {
contentList: []
}
this.allDatas.forEach((item: ContentDTO) => {
item.list.forEach((item: ContentDTO) => {
params.contentList.push({
contentId: item.objectId,
contentType: Number(item.objectType ?? '1')
... ... @@ -293,15 +284,26 @@ struct MyCollectionListPage {
})
this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params)
let datas: ContentDTO[] = [];
for (let index = 0; index < this.allDatas.length; index++) {
const compDTO = this.allDatas[index];
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < item.list.length; index++) {
const compDTO = item.list[index];
compDTO.isCollection = true ///用于时间展示
compDTO.interactData = this.commentList[index]
datas.push(compDTO)
this.allDatas.push(compDTO)
}
this.allDatas = []
this.allDatas.push(...datas)
} catch (exception) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < item.list.length; index++) {
const compDTO = item.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -184,16 +184,6 @@
],
"requestPermissions": [
{
"name": "ohos.permission.CAMERA",
"reason": "$string:permission_camera_tip",
"usedScene": {
"abilities": [
"FormAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "$string:permission_photo_tip",
"usedScene": {
... ...