wangliang_wd

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

... ... @@ -4,7 +4,8 @@ import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import { CompDTO, ContentDTO, contentListParams,contentListItem, InteractDataDTO } from 'wdBean'
import { CompDTO, ContentDTO, contentListParams,contentListItem, InteractDataDTO,
postExecuteCollectRecordParams } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
... ... @@ -12,7 +13,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { DateTimeUtils, NetworkUtil } from 'wdKit/Index';
import { DateTimeUtils, NetworkUtil, SPHelper } from 'wdKit/Index';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import { TrackConstants, TrackingButton, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
... ... @@ -67,12 +68,31 @@ struct MyCollectionListPage {
onPageShow(){
this.pageShow = Math.random()
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
this.refreshCollectList()
}
onPageHide(): void {
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect)
}
refreshCollectList(){
let compStr = SPHelper.default.getSync('CompCollectStatus','') as string
if (compStr.length > 0) {
let collectRecordParams:postExecuteCollectRecordParams = JSON.parse(compStr)
if (collectRecordParams.status === '0'){
let deleteIndex:number = 0
this.allDatas.forEach((item,index) => {
if (item.objectId === collectRecordParams.contentList[0].contentId) {
deleteIndex = index
}
})
this.allDatas.splice(deleteIndex,1)
}
SPHelper.default.delete('CompCollectStatus')
}
}
build() {
Column(){
CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.isDisplayButton,editCallback:()=>{
... ...
... ... @@ -432,6 +432,7 @@ export struct LiveOperRowListView {
}
console.log(TAG, '收藏点击', JSON.stringify(params))
PageRepository.postExecuteCollectRecord(params).then(res => {
SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
if (this.newsStatusOfUser && res.code == 0) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if (this.newsStatusOfUser.collectStatus === 1) {
... ...
... ... @@ -551,6 +551,7 @@ export struct OperRowListView {
// console.log(TAG, '收藏点击', JSON.stringify(params))
PageRepository.postExecuteCollectRecord(params).then(res => {
SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
if (this.newsStatusOfUser && res.code == 0) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if (this.newsStatusOfUser.collectStatus === 1) {
... ...
... ... @@ -117,6 +117,7 @@ export struct OperationListView {
}
ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
if (this.newsStatusOfUser && res.code == 0) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
// this.queryContentInteractCount()
... ...
... ... @@ -141,6 +141,7 @@ export struct PlayerRightView {
}
ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
SPHelper.default.saveSync('CompCollectStatus',JSON.stringify(params))
if (this.newsStatusOfUser && res.code == 0) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
// this.queryContentInteractCount()
... ...