Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-11-08 10:50:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
25b2484129508427f17bcc9a5fdace66d20817f0
25b24841
1 parent
b0642d97
feat:增加直播间主持人发言弹出提示
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
9 deletions
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/ChartItemCompereComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
View file @
25b2484
import { ContentDetailDTO, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { CustomToast, Logger, WindowModel } from 'wdKit/Index';
import { CustomToast,
DisplayUtils,
Logger, WindowModel } from 'wdKit/Index';
import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
import { WDAliPlayerController } from 'wdPlayer/Index';
...
...
@@ -14,6 +14,7 @@ import { StringUtils } from 'wdKit';
import { LiveDetailChatRoomController } from '../im/LiveDetailChatRoomController';
import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
import { JSON } from '@kit.ArkTS';
import { ChartItemCompereComponent } from '../widgets/vertical/ChartItemCompereComponent';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
...
...
@@ -45,6 +46,9 @@ export struct DetailPlayVLivePage {
@State showClearButton: boolean = false
@Consume liveDetailPageLogic: LiveDetailPageLogic
@Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息
@Provide hostInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 是否是主持人发言
@State hostCommentLeft: number = 0
//播放错误
@State isPlayerError: boolean = false
@State isCanplay: boolean = false
...
...
@@ -54,6 +58,8 @@ export struct DetailPlayVLivePage {
/// null 直播流画面类型未知,0 横屏流,1 竖屏流,后台选择画面时,以选择的为准
@Provide isVerticalStream: boolean | null = this.liveDetailPageLogic.dealLiveStreamType()
@State isDisplayHost: boolean = false
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
...
...
@@ -107,7 +113,24 @@ export struct DetailPlayVLivePage {
if (this.liveViewModel.filterMySelfCommentNoPreDisplay(liveRoomItemBean, preDisplay)) {
return
}
this.lastInputedComment = liveRoomItemBean
if (liveRoomItemBean.role === 'host') {
this.isDisplayHost = true
this.hostCommentLeft = - DisplayUtils.getDeviceWidth()
this.hostInputedComment = liveRoomItemBean
animateTo({
duration: 400,
onFinish: () => {
let t = setTimeout(()=>{
this.isDisplayHost = false
this.lastInputedComment = liveRoomItemBean
clearTimeout(t)
},2000)
}
}, () => {
this.hostCommentLeft = 0;
})
}
}
this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => {
switch (liveRoomItemBean.optionType) {
...
...
@@ -262,8 +285,14 @@ export struct DetailPlayVLivePage {
TrackingButton.click('clearScreen', TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail)
})
}
Stack(){
ChartItemCompereComponent().width('100%').margin({left:this.hostCommentLeft})
}
.visibility(this.isDisplayHost?Visibility.Visible:Visibility.Hidden)
.height('100%')
.width('100%')
}
.height('100%')
.width('100%')
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/ChartItemCompereComponent.ets
View file @
25b2484
import { ContentDetailDTO } from 'wdBean/Index'
import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index'
import { DisplayUtils } from 'wdKit'
@Component
export struct ChartItemCompereComponent {
// @Consume liveDetailsBean: LiveDetailsBean
@Consume contentDetailData: ContentDetailDTO
@Consume hostInputedComment: LiveRoomItemBean
aboutToAppear(): void {
}
...
...
@@ -11,13 +11,14 @@ export struct ChartItemCompereComponent {
ListItem() {
Column() {
Row() {
Image($r('app.media.default_head'))
Image(this.hostInputedComment.senderUserAvatarUrl)
.alt($r('app.media.default_head'))
.borderRadius(10)
.width(20)
.height(20)
.margin({ right: 8 })
Text(
'人民日报'
)
Text(
this.hostInputedComment.senderUserName
)
.fontSize(14)
.fontColor('#FFFFFFFF')
.margin({ right: 8 })
...
...
@@ -32,7 +33,7 @@ export struct ChartItemCompereComponent {
.margin({ bottom: 8 })
.justifyContent(FlexAlign.Start)
Text(this.
contentDetailData.newIntroduction
).lineHeight(22).fontColor('#FFFFFFFF').fontSize(14)
Text(this.
hostInputedComment.text
).lineHeight(22).fontColor('#FFFFFFFF').fontSize(14)
}
.backgroundColor('#4D000000')
.borderRadius(3)
...
...
@@ -42,7 +43,8 @@ export struct ChartItemCompereComponent {
left: 8,
right: 8
})
.margin({ left: 16, bottom: 4 })
.width(DisplayUtils.getDeviceWidth() - 32)
.margin({ left: 16, bottom: 4, right:16 })
.alignItems(HorizontalAlign.Start)
}
...
...
Please
register
or
login
to post a comment