王士厅

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

@@ -76,4 +76,5 @@ export class ContentDetailDTO { @@ -76,4 +76,5 @@ export class ContentDetailDTO {
76 76
77 // 本地字段 77 // 本地字段
78 showTime:boolean = false; 78 showTime:boolean = false;
  79 + isLogin?:string
79 } 80 }
@@ -48,7 +48,6 @@ export struct ImageAndTextPageComponent { @@ -48,7 +48,6 @@ export struct ImageAndTextPageComponent {
48 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 48 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
49 @State recommendList: ContentDTO[] = [] 49 @State recommendList: ContentDTO[] = []
50 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 50 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
51 - @State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败  
52 @State interactData: InteractDataDTO = {} as InteractDataDTO 51 @State interactData: InteractDataDTO = {} as InteractDataDTO
53 @State isPageEnd: boolean = false 52 @State isPageEnd: boolean = false
54 @State publishTime: string = '' 53 @State publishTime: string = ''
@@ -74,10 +73,6 @@ export struct ImageAndTextPageComponent { @@ -74,10 +73,6 @@ export struct ImageAndTextPageComponent {
74 73
75 pageShowForUpdateData() { 74 pageShowForUpdateData() {
76 this.pageShowTime = DateTimeUtils.getTimeStamp() 75 this.pageShowTime = DateTimeUtils.getTimeStamp()
77 - // 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果  
78 - if(this.getNewsStatusOfUser) {  
79 - this.getInteractDataStatus()  
80 - }  
81 } 76 }
82 77
83 //内容浏览Tracking 78 //内容浏览Tracking
@@ -373,11 +368,9 @@ export struct ImageAndTextPageComponent { @@ -373,11 +368,9 @@ export struct ImageAndTextPageComponent {
373 // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) 368 // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList))
374 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) 369 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
375 console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) 370 console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
376 - this.getNewsStatusOfUser = false // 获取成功  
377 this.newsStatusOfUser = data[0]; 371 this.newsStatusOfUser = data[0];
378 // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) 372 // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
379 } catch (exception) { 373 } catch (exception) {
380 - this.getNewsStatusOfUser = true // 获取失败  
381 console.error(TAG,'exception', JSON.stringify(exception)) 374 console.error(TAG,'exception', JSON.stringify(exception))
382 } 375 }
383 } 376 }
@@ -461,6 +454,10 @@ export struct ImageAndTextPageComponent { @@ -461,6 +454,10 @@ export struct ImageAndTextPageComponent {
461 } 454 }
462 } 455 }
463 }) 456 })
  457 + // 登录成功
  458 + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
  459 + this.getInteractDataStatus()
  460 + })
464 } 461 }
465 462
466 aboutToDisappear() { 463 aboutToDisappear() {
@@ -83,6 +83,12 @@ export struct LiveOperRowListView { @@ -83,6 +83,12 @@ export struct LiveOperRowListView {
83 this.onDetailUpdated() 83 this.onDetailUpdated()
84 this.contentTrackingDict() 84 this.contentTrackingDict()
85 this.checkCanInputComment() 85 this.checkCanInputComment()
  86 + // 登录成功
  87 + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
  88 + this.getInteractDataStatus()
  89 + // 激活点赞组件监听
  90 + this.contentDetailData['isLogin'] = 'y'
  91 + })
86 } 92 }
87 93
88 contentTrackingDict(){ 94 contentTrackingDict(){
@@ -103,7 +109,7 @@ export struct LiveOperRowListView { @@ -103,7 +109,7 @@ export struct LiveOperRowListView {
103 if (user_id) { 109 if (user_id) {
104 this.getInteractDataStatus() 110 this.getInteractDataStatus()
105 } 111 }
106 - await this.queryContentInteractCount() 112 + this.queryContentInteractCount()
107 113
108 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) 114 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
109 console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList)) 115 console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList))
@@ -114,6 +114,12 @@ export struct OperRowListView { @@ -114,6 +114,12 @@ export struct OperRowListView {
114 } 114 }
115 } 115 }
116 }) 116 })
  117 + // 登录成功
  118 + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
  119 + this.getInteractDataStatus()
  120 + // 激活点赞组件监听
  121 + this.likeBean['isLogin'] = 'y'
  122 + })
117 this.contentTrackingDict() 123 this.contentTrackingDict()
118 } 124 }
119 125
@@ -135,7 +141,7 @@ export struct OperRowListView { @@ -135,7 +141,7 @@ export struct OperRowListView {
135 if (user_id) { 141 if (user_id) {
136 this.getInteractDataStatus() 142 this.getInteractDataStatus()
137 } 143 }
138 - await this.queryContentInteractCount() 144 + this.queryContentInteractCount()
139 // 点赞需要数据 145 // 点赞需要数据
140 this.likeBean['contentId'] = this.contentDetailData.newsId + '' 146 this.likeBean['contentId'] = this.contentDetailData.newsId + ''
141 if(this.contentDetailData.userInfo?.userName) { 147 if(this.contentDetailData.userInfo?.userName) {