liyubing

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

... ... @@ -71,12 +71,23 @@ export struct DetailPlayLiveCommon {
.then((data: Array<ContentDetailDTO>) => {
console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
if (data) {
let detailData = data[0]
this.liveLandscape =
detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')
this.liveState = detailData.liveInfo?.liveState
if (this.liveState === 'wait' || this.liveLandscape === 'news') {
this.contentDetailData = data[0]
} else if (this.liveLandscape === 'general') {
//todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行
setTimeout(() => {
this.contentDetailData = data[0];
}, 50)
this.contentDetailData = data[0]
}, 10)
}
let detailData = data[0]
console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment)
this.publishCommentModel.targetId = String(detailData?.newsId || '')
this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
... ... @@ -87,12 +98,6 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetType = String(detailData?.newsType || '')
this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
this.liveLandscape =
detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')
this.liveState = detailData.liveInfo?.liveState
this.liveStyle = detailData.liveInfo?.liveStyle
if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {
... ... @@ -107,7 +112,6 @@ export struct DetailPlayLiveCommon {
})
}
onPageShow() {
this.pageShow = Math.random()
Logger.info(TAG, 'onPageShow')
... ...
... ... @@ -63,7 +63,7 @@ export struct DetailPlayLivePage {
Column() {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ?211:'100%')
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
.layoutWeight(1)
... ... @@ -80,7 +80,7 @@ export struct DetailPlayLivePage {
// 切换到大家聊
this.changeToTab = Math.random()
}
}) .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
// LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
// .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ... @@ -119,6 +119,8 @@ export struct DetailPlayLivePage {
getLiveDetails() {
const data = this.contentDetailData
console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState)
console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle)
if (data.liveInfo?.liveState == 'wait') {
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
if (data.liveInfo?.liveStyle == 1) {
... ... @@ -129,8 +131,14 @@ export struct DetailPlayLivePage {
this.tabs = ['简介', '直播间', '大家聊']
}
} else {
if (data.liveInfo?.liveStyle == 1) {
this.tabs = ['大家聊']
} else if (data.liveInfo?.liveStyle == 2) {
this.tabs = ['直播间',]
} else {
this.tabs = ['直播间', '大家聊']
}
}
}
... ...