wangliang_wd

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

@@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout' @@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout'
9 import { CustomSelectUI } from '../view/CustomSelectUI'; 9 import { CustomSelectUI } from '../view/CustomSelectUI';
10 import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; 10 import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
11 import { BigPicCardComponent } from '../view/BigPicCardComponent'; 11 import { BigPicCardComponent } from '../view/BigPicCardComponent';
12 -import { contentListItemParams } from '../../model/MyCollectionModel'; 12 +import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel';
13 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; 13 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
14 import { MyCustomDialog } from '../reusable/MyCustomDialog' 14 import { MyCustomDialog } from '../reusable/MyCustomDialog'
15 import { NetworkUtil } from 'wdKit/Index'; 15 import { NetworkUtil } from 'wdKit/Index';
@@ -180,18 +180,9 @@ struct MyCollectionListPage { @@ -180,18 +180,9 @@ struct MyCollectionListPage {
180 MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { 180 MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
181 if(resolve) resolve('刷新成功') 181 if(resolve) resolve('刷新成功')
182 if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { 182 if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
183 - if (this.currentPage === 1) {  
184 - this.allDatas = []  
185 - }  
186 183
187 - for (let index = 0; index < collectionItem.list.length; index++) {  
188 - const compDTO = collectionItem.list[index];  
189 - compDTO.isCollection = true ///用于时间展示  
190 - this.allDatas.push(compDTO)  
191 - }  
192 -  
193 - if (this.allDatas.length > 0){  
194 - this.getContentData() 184 + if (collectionItem.list.length > 0){
  185 + this.getContentData(collectionItem)
195 } 186 }
196 187
197 if (collectionItem.hasNext === 0) { 188 if (collectionItem.hasNext === 0) {
@@ -279,13 +270,13 @@ struct MyCollectionListPage { @@ -279,13 +270,13 @@ struct MyCollectionListPage {
279 } 270 }
280 } 271 }
281 272
282 - async getContentData(){ 273 + async getContentData(item:MyCollectionItem){
283 try { 274 try {
284 // 获取列表数据 275 // 获取列表数据
285 const params: contentListParams = { 276 const params: contentListParams = {
286 contentList: [] 277 contentList: []
287 } 278 }
288 - this.allDatas.forEach((item: ContentDTO) => { 279 + item.list.forEach((item: ContentDTO) => {
289 params.contentList.push({ 280 params.contentList.push({
290 contentId: item.objectId, 281 contentId: item.objectId,
291 contentType: Number(item.objectType ?? '1') 282 contentType: Number(item.objectType ?? '1')
@@ -293,15 +284,26 @@ struct MyCollectionListPage { @@ -293,15 +284,26 @@ struct MyCollectionListPage {
293 }) 284 })
294 this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params) 285 this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params)
295 286
296 - let datas: ContentDTO[] = [];  
297 - for (let index = 0; index < this.allDatas.length; index++) {  
298 - const compDTO = this.allDatas[index]; 287 + if (this.currentPage === 1) {
  288 + this.allDatas = []
  289 + }
  290 +
  291 + for (let index = 0; index < item.list.length; index++) {
  292 + const compDTO = item.list[index];
  293 + compDTO.isCollection = true ///用于时间展示
299 compDTO.interactData = this.commentList[index] 294 compDTO.interactData = this.commentList[index]
300 - datas.push(compDTO) 295 + this.allDatas.push(compDTO)
301 } 296 }
302 - this.allDatas = []  
303 - this.allDatas.push(...datas) 297 +
304 } catch (exception) { 298 } catch (exception) {
  299 + if (this.currentPage === 1) {
  300 + this.allDatas = []
  301 + }
  302 + for (let index = 0; index < item.list.length; index++) {
  303 + const compDTO = item.list[index];
  304 + compDTO.isCollection = true ///用于时间展示
  305 + this.allDatas.push(compDTO)
  306 + }
305 } 307 }
306 } 308 }
307 } 309 }
@@ -184,16 +184,6 @@ @@ -184,16 +184,6 @@
184 ], 184 ],
185 "requestPermissions": [ 185 "requestPermissions": [
186 { 186 {
187 - "name": "ohos.permission.CAMERA",  
188 - "reason": "$string:permission_camera_tip",  
189 - "usedScene": {  
190 - "abilities": [  
191 - "FormAbility"  
192 - ],  
193 - "when": "inuse"  
194 - }  
195 - },  
196 - {  
197 "name": "ohos.permission.READ_MEDIA", 187 "name": "ohos.permission.READ_MEDIA",
198 "reason": "$string:permission_photo_tip", 188 "reason": "$string:permission_photo_tip",
199 "usedScene": { 189 "usedScene": {