王士厅

轮播卡-文章专题_已收藏专题进入详情页、收藏按钮未点亮展示

... ... @@ -76,4 +76,5 @@ export class ContentDetailDTO {
// 本地字段
showTime:boolean = false;
isLogin?:string
}
\ No newline at end of file
... ...
... ... @@ -48,7 +48,6 @@ export struct ImageAndTextPageComponent {
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State recommendList: ContentDTO[] = []
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
... ... @@ -74,10 +73,6 @@ export struct ImageAndTextPageComponent {
pageShowForUpdateData() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
// 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果
if(this.getNewsStatusOfUser) {
this.getInteractDataStatus()
}
}
//内容浏览Tracking
... ... @@ -373,11 +368,9 @@ export struct ImageAndTextPageComponent {
// console.log(TAG,'contentDetailData', JSON.stringify(params.contentList))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.getNewsStatusOfUser = false // 获取成功
this.newsStatusOfUser = data[0];
// console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
this.getNewsStatusOfUser = true // 获取失败
console.error(TAG,'exception', JSON.stringify(exception))
}
}
... ... @@ -461,6 +454,10 @@ export struct ImageAndTextPageComponent {
}
}
})
// 登录成功
EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
this.getInteractDataStatus()
})
}
aboutToDisappear() {
... ...
... ... @@ -83,6 +83,12 @@ export struct LiveOperRowListView {
this.onDetailUpdated()
this.contentTrackingDict()
this.checkCanInputComment()
// 登录成功
EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
this.getInteractDataStatus()
// 激活点赞组件监听
this.contentDetailData['isLogin'] = 'y'
})
}
contentTrackingDict(){
... ... @@ -103,7 +109,7 @@ export struct LiveOperRowListView {
if (user_id) {
this.getInteractDataStatus()
}
await this.queryContentInteractCount()
this.queryContentInteractCount()
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList))
... ...
... ... @@ -114,6 +114,12 @@ export struct OperRowListView {
}
}
})
// 登录成功
EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
this.getInteractDataStatus()
// 激活点赞组件监听
this.likeBean['isLogin'] = 'y'
})
this.contentTrackingDict()
}
... ... @@ -135,7 +141,7 @@ export struct OperRowListView {
if (user_id) {
this.getInteractDataStatus()
}
await this.queryContentInteractCount()
this.queryContentInteractCount()
// 点赞需要数据
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
if(this.contentDetailData.userInfo?.userName) {
... ...