wangliang_wd

feat:优化我的收藏刷新逻辑

@@ -4,7 +4,8 @@ import PageModel from '../../viewmodel/PageModel'; @@ -4,7 +4,8 @@ import PageModel from '../../viewmodel/PageModel';
4 import { CommonConstants, ViewType } from 'wdConstant' 4 import { CommonConstants, ViewType } from 'wdConstant'
5 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' 5 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
6 import { ErrorComponent } from '../view/ErrorComponent' 6 import { ErrorComponent } from '../view/ErrorComponent'
7 -import { CompDTO, ContentDTO, contentListParams,contentListItem, InteractDataDTO } from 'wdBean' 7 +import { CompDTO, ContentDTO, contentListParams,contentListItem, InteractDataDTO,
  8 + postExecuteCollectRecordParams } from 'wdBean'
8 import NoMoreLayout from './NoMoreLayout' 9 import NoMoreLayout from './NoMoreLayout'
9 import { CustomSelectUI } from '../view/CustomSelectUI'; 10 import { CustomSelectUI } from '../view/CustomSelectUI';
10 import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; 11 import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
@@ -12,7 +13,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent'; @@ -12,7 +13,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent';
12 import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel'; 13 import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel';
13 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; 14 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
14 import { MyCustomDialog } from '../reusable/MyCustomDialog' 15 import { MyCustomDialog } from '../reusable/MyCustomDialog'
15 -import { DateTimeUtils, NetworkUtil } from 'wdKit/Index'; 16 +import { DateTimeUtils, NetworkUtil, SPHelper } from 'wdKit/Index';
16 import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' 17 import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
17 import { TrackConstants, TrackingButton, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; 18 import { TrackConstants, TrackingButton, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
18 19
@@ -67,12 +68,31 @@ struct MyCollectionListPage { @@ -67,12 +68,31 @@ struct MyCollectionListPage {
67 onPageShow(){ 68 onPageShow(){
68 this.pageShow = Math.random() 69 this.pageShow = Math.random()
69 TrackingPageBrowseUtils.TrackingPageBrowseExposureStart() 70 TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
  71 +
  72 + this.refreshCollectList()
70 } 73 }
71 74
72 onPageHide(): void { 75 onPageHide(): void {
73 TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect) 76 TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect)
74 } 77 }
75 78
  79 + refreshCollectList(){
  80 + let compStr = SPHelper.default.getSync('CompCollectStatus','') as string
  81 + if (compStr.length > 0) {
  82 + let collectRecordParams:postExecuteCollectRecordParams = JSON.parse(compStr)
  83 + if (collectRecordParams.status === '0'){
  84 + let deleteIndex:number = 0
  85 + this.allDatas.forEach((item,index) => {
  86 + if (item.objectId === collectRecordParams.contentList[0].contentId) {
  87 + deleteIndex = index
  88 + }
  89 + })
  90 + this.allDatas.splice(deleteIndex,1)
  91 + }
  92 + SPHelper.default.delete('CompCollectStatus')
  93 + }
  94 + }
  95 +
76 build() { 96 build() {
77 Column(){ 97 Column(){
78 CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.isDisplayButton,editCallback:()=>{ 98 CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.isDisplayButton,editCallback:()=>{
@@ -432,6 +432,7 @@ export struct LiveOperRowListView { @@ -432,6 +432,7 @@ export struct LiveOperRowListView {
432 } 432 }
433 console.log(TAG, '收藏点击', JSON.stringify(params)) 433 console.log(TAG, '收藏点击', JSON.stringify(params))
434 PageRepository.postExecuteCollectRecord(params).then(res => { 434 PageRepository.postExecuteCollectRecord(params).then(res => {
  435 + SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
435 if (this.newsStatusOfUser && res.code == 0) { 436 if (this.newsStatusOfUser && res.code == 0) {
436 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 437 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
437 if (this.newsStatusOfUser.collectStatus === 1) { 438 if (this.newsStatusOfUser.collectStatus === 1) {
@@ -551,6 +551,7 @@ export struct OperRowListView { @@ -551,6 +551,7 @@ export struct OperRowListView {
551 551
552 // console.log(TAG, '收藏点击', JSON.stringify(params)) 552 // console.log(TAG, '收藏点击', JSON.stringify(params))
553 PageRepository.postExecuteCollectRecord(params).then(res => { 553 PageRepository.postExecuteCollectRecord(params).then(res => {
  554 + SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
554 if (this.newsStatusOfUser && res.code == 0) { 555 if (this.newsStatusOfUser && res.code == 0) {
555 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 556 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
556 if (this.newsStatusOfUser.collectStatus === 1) { 557 if (this.newsStatusOfUser.collectStatus === 1) {
@@ -117,6 +117,7 @@ export struct OperationListView { @@ -117,6 +117,7 @@ export struct OperationListView {
117 117
118 } 118 }
119 ContentDetailRequest.postExecuteCollectRecord(params).then(res => { 119 ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
  120 + SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
120 if (this.newsStatusOfUser && res.code == 0) { 121 if (this.newsStatusOfUser && res.code == 0) {
121 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 122 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
122 // this.queryContentInteractCount() 123 // this.queryContentInteractCount()
@@ -141,6 +141,7 @@ export struct PlayerRightView { @@ -141,6 +141,7 @@ export struct PlayerRightView {
141 141
142 } 142 }
143 ContentDetailRequest.postExecuteCollectRecord(params).then(res => { 143 ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
  144 + SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
144 if (this.newsStatusOfUser && res.code == 0) { 145 if (this.newsStatusOfUser && res.code == 0) {
145 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 146 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
146 // this.queryContentInteractCount() 147 // this.queryContentInteractCount()