liyubing

fix:直播详情页面,两次调用相同接口,处理成只调用一次

@@ -71,12 +71,23 @@ export struct DetailPlayLiveCommon { @@ -71,12 +71,23 @@ export struct DetailPlayLiveCommon {
71 .then((data: Array<ContentDetailDTO>) => { 71 .then((data: Array<ContentDetailDTO>) => {
72 console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) 72 console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
73 if (data) { 73 if (data) {
  74 +
  75 + let detailData = data[0]
  76 + this.liveLandscape =
  77 + detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')
  78 +
  79 + this.liveState = detailData.liveInfo?.liveState
  80 +
  81 +
  82 + if (this.liveState === 'wait' || this.liveLandscape === 'news') {
  83 + this.contentDetailData = data[0]
  84 + } else if (this.liveLandscape === 'general') {
74 //todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行 85 //todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行
75 setTimeout(() => { 86 setTimeout(() => {
76 - this.contentDetailData = data[0];  
77 - }, 50) 87 + this.contentDetailData = data[0]
  88 + }, 10)
  89 + }
78 90
79 - let detailData = data[0]  
80 console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment) 91 console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment)
81 this.publishCommentModel.targetId = String(detailData?.newsId || '') 92 this.publishCommentModel.targetId = String(detailData?.newsId || '')
82 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') 93 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
@@ -87,12 +98,6 @@ export struct DetailPlayLiveCommon { @@ -87,12 +98,6 @@ export struct DetailPlayLiveCommon {
87 this.publishCommentModel.targetType = String(detailData?.newsType || '') 98 this.publishCommentModel.targetType = String(detailData?.newsType || '')
88 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '') 99 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')
89 this.publishCommentModel.commentContent = '' 100 this.publishCommentModel.commentContent = ''
90 -  
91 - this.liveLandscape =  
92 - detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')  
93 -  
94 -  
95 - this.liveState = detailData.liveInfo?.liveState  
96 this.liveStyle = detailData.liveInfo?.liveStyle 101 this.liveStyle = detailData.liveInfo?.liveStyle
97 102
98 if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) { 103 if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {
@@ -107,7 +112,6 @@ export struct DetailPlayLiveCommon { @@ -107,7 +112,6 @@ export struct DetailPlayLiveCommon {
107 }) 112 })
108 } 113 }
109 114
110 -  
111 onPageShow() { 115 onPageShow() {
112 this.pageShow = Math.random() 116 this.pageShow = Math.random()
113 Logger.info(TAG, 'onPageShow') 117 Logger.info(TAG, 'onPageShow')
@@ -63,7 +63,7 @@ export struct DetailPlayLivePage { @@ -63,7 +63,7 @@ export struct DetailPlayLivePage {
63 Column() { 63 Column() {
64 64
65 TopPlayComponent({ playerController: this.playerController }) 65 TopPlayComponent({ playerController: this.playerController })
66 - .height(this.displayDirection == DisplayDirection.VERTICAL ?211:'100%') 66 + .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
67 67
68 TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) 68 TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
69 .layoutWeight(1) 69 .layoutWeight(1)
@@ -80,7 +80,7 @@ export struct DetailPlayLivePage { @@ -80,7 +80,7 @@ export struct DetailPlayLivePage {
80 // 切换到大家聊 80 // 切换到大家聊
81 this.changeToTab = Math.random() 81 this.changeToTab = Math.random()
82 } 82 }
83 - }) .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 83 + }).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
84 84
85 // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) 85 // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
86 // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 86 // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
@@ -119,6 +119,8 @@ export struct DetailPlayLivePage { @@ -119,6 +119,8 @@ export struct DetailPlayLivePage {
119 119
120 getLiveDetails() { 120 getLiveDetails() {
121 const data = this.contentDetailData 121 const data = this.contentDetailData
  122 + console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState)
  123 + console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle)
122 if (data.liveInfo?.liveState == 'wait') { 124 if (data.liveInfo?.liveState == 'wait') {
123 //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 125 //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
124 if (data.liveInfo?.liveStyle == 1) { 126 if (data.liveInfo?.liveStyle == 1) {
@@ -129,8 +131,14 @@ export struct DetailPlayLivePage { @@ -129,8 +131,14 @@ export struct DetailPlayLivePage {
129 this.tabs = ['简介', '直播间', '大家聊'] 131 this.tabs = ['简介', '直播间', '大家聊']
130 } 132 }
131 } else { 133 } else {
  134 + if (data.liveInfo?.liveStyle == 1) {
  135 + this.tabs = ['大家聊']
  136 + } else if (data.liveInfo?.liveStyle == 2) {
  137 + this.tabs = ['直播间',]
  138 + } else {
132 this.tabs = ['直播间', '大家聊'] 139 this.tabs = ['直播间', '大家聊']
133 } 140 }
  141 + }
134 142
135 } 143 }
136 144