Showing
11 changed files
with
271 additions
and
168 deletions
| @@ -2,10 +2,12 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | @@ -2,10 +2,12 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | ||
| 2 | import { WDRouterRule } from 'wdRouter/Index' | 2 | import { WDRouterRule } from 'wdRouter/Index' |
| 3 | import { Logger } from 'wdKit/Index' | 3 | import { Logger } from 'wdKit/Index' |
| 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 5 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | 8 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { |
| 8 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| 10 | + | ||
| 9 | build() { | 11 | build() { |
| 10 | Column() { | 12 | Column() { |
| 11 | Row() { | 13 | Row() { |
| @@ -30,7 +32,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -30,7 +32,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 30 | .height(14) | 32 | .height(14) |
| 31 | } | 33 | } |
| 32 | }.justifyContent(FlexAlign.SpaceBetween) | 34 | }.justifyContent(FlexAlign.SpaceBetween) |
| 33 | - .margin({ top: 8 ,bottom: 8}) | 35 | + .margin({ top: 8, bottom: 8 }) |
| 34 | .width('100%') | 36 | .width('100%') |
| 35 | 37 | ||
| 36 | 38 | ||
| @@ -45,12 +47,13 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -45,12 +47,13 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 45 | .fontColor($r("app.color.color_212228")) | 47 | .fontColor($r("app.color.color_212228")) |
| 46 | .fontWeight(400) | 48 | .fontWeight(400) |
| 47 | .maxLines(1) | 49 | .maxLines(1) |
| 48 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 50 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 49 | .textAlign(TextAlign.Start) | 51 | .textAlign(TextAlign.Start) |
| 50 | .margin({ top: 8 }) | 52 | .margin({ top: 8 }) |
| 51 | .width('100%') | 53 | .width('100%') |
| 52 | 54 | ||
| 53 | - }.width("100%") | 55 | + } |
| 56 | + .width("100%") | ||
| 54 | .padding({ | 57 | .padding({ |
| 55 | top: 14, | 58 | top: 14, |
| 56 | left: 16, | 59 | left: 16, |
| @@ -59,16 +62,26 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -59,16 +62,26 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 59 | }) | 62 | }) |
| 60 | .backgroundColor($r("app.color.white")) | 63 | .backgroundColor($r("app.color.white")) |
| 61 | .margin({ bottom: 8 }) | 64 | .margin({ bottom: 8 }) |
| 62 | - .onClick(()=>{ | 65 | + .onClick(() => { |
| 63 | this.gotoLive(this.compDTO?.operDataList[0]) | 66 | this.gotoLive(this.compDTO?.operDataList[0]) |
| 64 | }) | 67 | }) |
| 65 | } | 68 | } |
| 66 | - gotoLive(content: ContentDTO) { | 69 | + |
| 70 | + async gotoLive(content: ContentDTO) { | ||
| 71 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 72 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 73 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + console.error('liveDetail===', liveDetail) | ||
| 77 | + | ||
| 78 | + | ||
| 67 | let taskAction: Action = { | 79 | let taskAction: Action = { |
| 68 | type: 'JUMP_DETAIL_PAGE', | 80 | type: 'JUMP_DETAIL_PAGE', |
| 69 | params: { | 81 | params: { |
| 70 | detailPageType: 2, | 82 | detailPageType: 2, |
| 71 | contentID: content?.objectId, | 83 | contentID: content?.objectId, |
| 84 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 72 | extra: { | 85 | extra: { |
| 73 | relType: content?.relType, | 86 | relType: content?.relType, |
| 74 | relId: content?.relId, | 87 | relId: content?.relId, |
| @@ -76,6 +89,6 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -76,6 +89,6 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 76 | } as Params, | 89 | } as Params, |
| 77 | }; | 90 | }; |
| 78 | WDRouterRule.jumpWithAction(taskAction) | 91 | WDRouterRule.jumpWithAction(taskAction) |
| 79 | - Logger.debug(`gotoLive, ${content.objectId}`); | 92 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 80 | } | 93 | } |
| 81 | } | 94 | } |
| @@ -6,6 +6,7 @@ import { WDRouterRule } from 'wdRouter/Index' | @@ -6,6 +6,7 @@ import { WDRouterRule } from 'wdRouter/Index' | ||
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 8 | import { Logger } from 'wdKit/Index' | 8 | import { Logger } from 'wdKit/Index' |
| 9 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct LiveHorizontalCardComponent { | 12 | export struct LiveHorizontalCardComponent { |
| @@ -100,12 +101,22 @@ export struct LiveHorizontalCardComponent { | @@ -100,12 +101,22 @@ export struct LiveHorizontalCardComponent { | ||
| 100 | }) | 101 | }) |
| 101 | .backgroundColor($r("app.color.white")) | 102 | .backgroundColor($r("app.color.white")) |
| 102 | } | 103 | } |
| 103 | - gotoLive(content: ContentDTO) { | 104 | + |
| 105 | + async gotoLive(content: ContentDTO) { | ||
| 106 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 107 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 108 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + console.error('liveDetail===', liveDetail) | ||
| 112 | + | ||
| 113 | + | ||
| 104 | let taskAction: Action = { | 114 | let taskAction: Action = { |
| 105 | type: 'JUMP_DETAIL_PAGE', | 115 | type: 'JUMP_DETAIL_PAGE', |
| 106 | params: { | 116 | params: { |
| 107 | detailPageType: 2, | 117 | detailPageType: 2, |
| 108 | contentID: content?.objectId, | 118 | contentID: content?.objectId, |
| 119 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 109 | extra: { | 120 | extra: { |
| 110 | relType: content?.relType, | 121 | relType: content?.relType, |
| 111 | relId: content?.relId, | 122 | relId: content?.relId, |
| @@ -113,6 +124,6 @@ export struct LiveHorizontalCardComponent { | @@ -113,6 +124,6 @@ export struct LiveHorizontalCardComponent { | ||
| 113 | } as Params, | 124 | } as Params, |
| 114 | }; | 125 | }; |
| 115 | WDRouterRule.jumpWithAction(taskAction) | 126 | WDRouterRule.jumpWithAction(taskAction) |
| 116 | - Logger.debug(`gotoLive, ${content.objectId}`); | 127 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 117 | } | 128 | } |
| 118 | } | 129 | } |
| @@ -6,6 +6,7 @@ import { Logger, StringUtils } from 'wdKit/Index' | @@ -6,6 +6,7 @@ import { Logger, StringUtils } from 'wdKit/Index' | ||
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 8 | import { WDRouterRule } from 'wdRouter/Index' | 8 | import { WDRouterRule } from 'wdRouter/Index' |
| 9 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct LiveHorizontalReservationComponent { | 12 | export struct LiveHorizontalReservationComponent { |
| @@ -92,12 +93,21 @@ export struct LiveHorizontalReservationComponent { | @@ -92,12 +93,21 @@ export struct LiveHorizontalReservationComponent { | ||
| 92 | .backgroundColor($r("app.color.white")) | 93 | .backgroundColor($r("app.color.white")) |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | - gotoLive(content: ContentDTO) { | 96 | + async gotoLive(content: ContentDTO) { |
| 97 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 98 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 99 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + console.error('liveDetail===', liveDetail) | ||
| 103 | + | ||
| 104 | + | ||
| 96 | let taskAction: Action = { | 105 | let taskAction: Action = { |
| 97 | type: 'JUMP_DETAIL_PAGE', | 106 | type: 'JUMP_DETAIL_PAGE', |
| 98 | params: { | 107 | params: { |
| 99 | detailPageType: 2, | 108 | detailPageType: 2, |
| 100 | contentID: content?.objectId, | 109 | contentID: content?.objectId, |
| 110 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 101 | extra: { | 111 | extra: { |
| 102 | relType: content?.relType, | 112 | relType: content?.relType, |
| 103 | relId: content?.relId, | 113 | relId: content?.relId, |
| @@ -105,6 +115,6 @@ export struct LiveHorizontalReservationComponent { | @@ -105,6 +115,6 @@ export struct LiveHorizontalReservationComponent { | ||
| 105 | } as Params, | 115 | } as Params, |
| 106 | }; | 116 | }; |
| 107 | WDRouterRule.jumpWithAction(taskAction) | 117 | WDRouterRule.jumpWithAction(taskAction) |
| 108 | - Logger.debug(`gotoLive, ${content.objectId}`); | 118 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 109 | } | 119 | } |
| 110 | } | 120 | } |
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayHLivePage.ets
deleted
100644 → 0
| 1 | -import { BottomComponent } from '../widgets/details/BottomComponent'; | ||
| 2 | -import { TabComponent } from '../widgets/details/TabComponent'; | ||
| 3 | -import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -@Component | ||
| 7 | -export struct DetailPlayHLivePage { | ||
| 8 | - aboutToAppear(): void { | ||
| 9 | - | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - build() { | ||
| 13 | - Column() { | ||
| 14 | - TopPlayComponent() | ||
| 15 | - TabComponent() | ||
| 16 | - BottomComponent() | ||
| 17 | - } | ||
| 18 | - .height('100%') | ||
| 19 | - .width('100%') | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - onPageShow(): void { | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - aboutToDisappear(): void { | ||
| 27 | - | ||
| 28 | - } | ||
| 29 | -} |
| @@ -60,12 +60,13 @@ export struct DetailPlayVLivePage { | @@ -60,12 +60,13 @@ export struct DetailPlayVLivePage { | ||
| 60 | swiperController: this.swiperController, | 60 | swiperController: this.swiperController, |
| 61 | swiperIndex: $swiperIndex | 61 | swiperIndex: $swiperIndex |
| 62 | }) | 62 | }) |
| 63 | - | 63 | + |
| 64 | Image($r('app.media.icon_live_more')) | 64 | Image($r('app.media.icon_live_more')) |
| 65 | .width(40) | 65 | .width(40) |
| 66 | - .aspectRatio(1)// .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | 66 | + .aspectRatio(1) |
| 67 | + .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 67 | .animation({ duration: 500 }) | 68 | .animation({ duration: 500 }) |
| 68 | - .position({ x: '95%', y: '95%' }) | 69 | + .position({ x: '90%', y: '90%' }) |
| 69 | .onClick(() => { | 70 | .onClick(() => { |
| 70 | this.swiperController.showNext() | 71 | this.swiperController.showNext() |
| 71 | }) | 72 | }) |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/ChartItemComponent.ets
0 → 100644
| 1 | +import { LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct ChatItemComponent { | ||
| 5 | + item: LiveRoomItemBean = {} as LiveRoomItemBean | ||
| 6 | + | ||
| 7 | + aboutToAppear(): void { | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Row() { | ||
| 12 | + Image(this.item.senderUserAvatarUrl) | ||
| 13 | + .borderRadius(90) | ||
| 14 | + .width(24) | ||
| 15 | + .height(24) | ||
| 16 | + Text() { | ||
| 17 | + Span(this.item.senderUserName + ': ') | ||
| 18 | + .fontColor('#666666') | ||
| 19 | + Span(this.item.text) | ||
| 20 | + .fontColor('#222222') | ||
| 21 | + } | ||
| 22 | + .margin({ left: 8 }) | ||
| 23 | + .lineHeight(20) | ||
| 24 | + .layoutWeight(1) | ||
| 25 | + .fontSize('14fp') | ||
| 26 | + .fontWeight(400) | ||
| 27 | + } | ||
| 28 | + .alignItems(VerticalAlign.Top) | ||
| 29 | + .padding({ | ||
| 30 | + left: 15, | ||
| 31 | + top: 15, | ||
| 32 | + right: 15 | ||
| 33 | + }) | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + aboutToDisappear(): void { | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index' | ||
| 3 | +import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | ||
| 4 | +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | ||
| 5 | +import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | ||
| 6 | +import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' | ||
| 7 | +import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | ||
| 8 | +import { ViewType } from 'wdConstant/Index' | ||
| 9 | +import { LiveViewModel } from '../../viewModel/LiveViewModel' | ||
| 10 | +import { TabChatItemComponent } from '../details/TabChatItemComponent' | ||
| 11 | + | ||
| 12 | + | ||
| 1 | @Component | 13 | @Component |
| 2 | export struct PlayerCommentComponent { | 14 | export struct PlayerCommentComponent { |
| 15 | + liveViewModel: LiveViewModel = new LiveViewModel() | ||
| 16 | + @Consume liveDetailsBean: LiveDetailsBean | ||
| 17 | + @State private pageModel: PageModel = new PageModel() | ||
| 18 | + @State liveChatList: Array<LiveRoomItemBean> = [] | ||
| 19 | + | ||
| 20 | + aboutToAppear(): void { | ||
| 21 | + this.getLiveChatList() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + getLiveChatList() { | ||
| 25 | + this.pageModel.currentPage = 1 | ||
| 26 | + this.liveViewModel.getLiveChatList( | ||
| 27 | + 1, | ||
| 28 | + this.liveDetailsBean?.liveInfo?.mlive?.mliveId, | ||
| 29 | + this.liveDetailsBean?.newsId, | ||
| 30 | + 20,) | ||
| 31 | + .then( | ||
| 32 | + (data) => { | ||
| 33 | + if (data.barrageResponses && data.barrageResponses.length > 0) { | ||
| 34 | + this.pageModel.viewType = ViewType.LOADED; | ||
| 35 | + this.liveChatList.push(...data.barrageResponses) | ||
| 36 | + if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 37 | + this.pageModel.currentPage++; | ||
| 38 | + this.pageModel.hasMore = true; | ||
| 39 | + } else { | ||
| 40 | + this.pageModel.hasMore = false; | ||
| 41 | + } | ||
| 42 | + } else { | ||
| 43 | + this.pageModel.viewType = ViewType.EMPTY; | ||
| 44 | + } | ||
| 45 | + }, | ||
| 46 | + () => { | ||
| 47 | + | ||
| 48 | + }) | ||
| 49 | + } | ||
| 50 | + | ||
| 3 | build() { | 51 | build() { |
| 52 | + Stack() { | ||
| 53 | + if (this.pageModel.viewType == ViewType.LOADING) { | ||
| 54 | + this.LoadingLayout() | ||
| 55 | + } else if (this.pageModel.viewType == ViewType.ERROR) { | ||
| 56 | + ErrorComponent() | ||
| 57 | + } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 58 | + EmptyComponent() | ||
| 59 | + } else { | ||
| 60 | + this.ListLayout() | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + .align(Alignment.Top) | ||
| 64 | + // .backgroundColor('#F5F5F5') | ||
| 65 | + .height('100%') | ||
| 66 | + .width('100%') | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Builder | ||
| 70 | + LoadingLayout() { | ||
| 71 | + CustomRefreshLoadLayout({ | ||
| 72 | + refreshBean: new RefreshLayoutBean(true, | ||
| 73 | + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Builder | ||
| 78 | + ListLayout() { | ||
| 79 | + List() { | ||
| 80 | + ListItem() { | ||
| 81 | + // 下拉刷新 | ||
| 82 | + RefreshLayout({ | ||
| 83 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 84 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 85 | + }) | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + ForEach(this.liveChatList, (item: LiveRoomItemBean) => { | ||
| 89 | + ListItem() { | ||
| 90 | + TabChatItemComponent({ item: item }) | ||
| 91 | + } | ||
| 92 | + }) | ||
| 93 | + // 加载更多 | ||
| 94 | + ListItem() { | ||
| 95 | + if (this.pageModel.hasMore) { | ||
| 96 | + LoadMoreLayout({ | ||
| 97 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 98 | + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 99 | + }) | ||
| 100 | + } else { | ||
| 101 | + ListHasNoMoreDataUI() | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 4 | } | 105 | } |
| 5 | } | 106 | } |
| @@ -4,7 +4,7 @@ import { PlayerUIComponent } from './PlayerUIComponent' | @@ -4,7 +4,7 @@ import { PlayerUIComponent } from './PlayerUIComponent' | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct PlayerInfoComponent { | 5 | export struct PlayerInfoComponent { |
| 6 | swiperController?: SwiperController | 6 | swiperController?: SwiperController |
| 7 | - @Prop playerController: WDPlayerController | 7 | + private playerController?: WDPlayerController |
| 8 | @Consume bottomSafeHeight: number | 8 | @Consume bottomSafeHeight: number |
| 9 | @Consume topSafeHeight: number | 9 | @Consume topSafeHeight: number |
| 10 | @Link swiperIndex: number | 10 | @Link swiperIndex: number |
| 1 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 1 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 2 | import { NumberFormatterUtils } from 'wdKit/Index' | 2 | import { NumberFormatterUtils } from 'wdKit/Index' |
| 3 | 3 | ||
| 4 | +@Preview | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct PlayerTitleComponent { | 6 | export struct PlayerTitleComponent { |
| 6 | @Consume liveDetailsBean: LiveDetailsBean | 7 | @Consume liveDetailsBean: LiveDetailsBean |
| @@ -9,133 +10,72 @@ export struct PlayerTitleComponent { | @@ -9,133 +10,72 @@ export struct PlayerTitleComponent { | ||
| 9 | build() { | 10 | build() { |
| 10 | Column() { | 11 | Column() { |
| 11 | Row() { | 12 | Row() { |
| 12 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 13 | - .width(24) | ||
| 14 | - .aspectRatio(1) | ||
| 15 | - .visibility(Visibility.None) | ||
| 16 | - .margin({ | ||
| 17 | - right: 10 | ||
| 18 | - }) | ||
| 19 | - if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { | ||
| 20 | - Text(this.liveDetailsBean.newsTitle) | ||
| 21 | - .maxLines(1) | ||
| 22 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 23 | - .fontSize('16fp') | ||
| 24 | - .fontWeight(500) | ||
| 25 | - .fontColor(Color.White) | ||
| 26 | - .textAlign(TextAlign.Start) | ||
| 27 | - .layoutWeight(1) | ||
| 28 | - } else { | ||
| 29 | - Blank() | ||
| 30 | - } | ||
| 31 | - Image($r('app.media.icon_share')) | ||
| 32 | - .width(24) | ||
| 33 | - .aspectRatio(1) | ||
| 34 | - .visibility(Visibility.None) | 13 | + Text(this.liveDetailsBean.newsTitle || '') |
| 14 | + .maxLines(2) | ||
| 15 | + .fontSize(16) | ||
| 16 | + .fontWeight(500) | ||
| 17 | + .fontColor(Color.White) | ||
| 18 | + }.margin({ bottom: 10 }) | ||
| 19 | + | ||
| 20 | + Row() { | ||
| 21 | + this.getLiveStatusView() | ||
| 35 | } | 22 | } |
| 36 | - .width('100%') | ||
| 37 | - .alignItems(VerticalAlign.Center) | ||
| 38 | - .margin({ | ||
| 39 | - bottom: 10 | ||
| 40 | - }) | ||
| 41 | 23 | ||
| 42 | - this.getLiveStatusView() | ||
| 43 | - }.width('100%') | 24 | + } |
| 25 | + .width('100%') | ||
| 26 | + .alignItems(HorizontalAlign.Start) | ||
| 44 | .padding({ | 27 | .padding({ |
| 45 | - top: 20, | ||
| 46 | - bottom: 6, | ||
| 47 | - left: 10, | ||
| 48 | - right: 10 | 28 | + top: 12, |
| 29 | + left: 16 | ||
| 49 | }) | 30 | }) |
| 50 | - .alignItems(HorizontalAlign.Start) | ||
| 51 | - .visibility(Visibility.Visible) | 31 | + |
| 52 | } | 32 | } |
| 53 | 33 | ||
| 54 | @Builder | 34 | @Builder |
| 55 | getLiveStatusView() { | 35 | getLiveStatusView() { |
| 56 | Row() { | 36 | Row() { |
| 57 | - Image(this.liveDetailsBean.rmhInfo.rmhHeadUrl) | ||
| 58 | - .width(22) | ||
| 59 | - .height(18) | ||
| 60 | - Text(this.liveDetailsBean.rmhInfo.rmhName) | ||
| 61 | - .fontSize('11fp') | ||
| 62 | - .fontWeight(400) | 37 | + Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') |
| 38 | + .width(24) | ||
| 39 | + .aspectRatio(1) | ||
| 40 | + .borderRadius('50%') | ||
| 41 | + .fillColor(Color.Transparent) | ||
| 42 | + Text(this.liveDetailsBean.rmhInfo?.rmhName || '') | ||
| 43 | + .fontSize(12) | ||
| 44 | + .fontWeight(500) | ||
| 63 | .fontColor(Color.White) | 45 | .fontColor(Color.White) |
| 46 | + .padding({ | ||
| 47 | + top: 2, | ||
| 48 | + right: 8, | ||
| 49 | + left: 4, | ||
| 50 | + bottom: 2 | ||
| 51 | + }) | ||
| 64 | } | 52 | } |
| 65 | .backgroundColor('#4D000000') | 53 | .backgroundColor('#4D000000') |
| 66 | - .padding({ | ||
| 67 | - top: 1, | ||
| 68 | - right: 4, | ||
| 69 | - bottom: 1 | ||
| 70 | - }) | 54 | + .borderRadius(2) |
| 55 | + .margin({ right: 8 }) | ||
| 71 | 56 | ||
| 72 | - | ||
| 73 | - // 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 74 | - // 预约 | ||
| 75 | - if (this.liveDetailsBean.liveInfo?.liveState == 'wait') { | ||
| 76 | - Row() { | ||
| 77 | - Image($r('app.media.icon_live_status_wait')) | ||
| 78 | - .width(22) | ||
| 79 | - .height(18) | ||
| 80 | - Text('预约') | ||
| 81 | - .fontSize('11fp') | ||
| 82 | - .fontWeight(400) | ||
| 83 | - .fontColor(Color.White) | ||
| 84 | - } | ||
| 85 | - .backgroundColor('#4D000000') | ||
| 86 | - .padding({ | ||
| 87 | - top: 1, | ||
| 88 | - right: 4, | ||
| 89 | - bottom: 1 | ||
| 90 | - }) | ||
| 91 | - } | ||
| 92 | - // 直播中 | ||
| 93 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | ||
| 94 | - Row() { | 57 | + Row() { |
| 58 | + if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | ||
| 95 | Image($r('app.media.icon_live_status_running')) | 59 | Image($r('app.media.icon_live_status_running')) |
| 96 | .width(22) | 60 | .width(22) |
| 97 | .height(18) | 61 | .height(18) |
| 98 | - Text('直播中') | ||
| 99 | - .fontSize('11fp') | ||
| 100 | - .fontWeight(400) | ||
| 101 | - .fontColor(Color.White) | ||
| 102 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 103 | - .width(12) | ||
| 104 | - .height(12) | ||
| 105 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 106 | - .fontSize('11fp') | ||
| 107 | - .fontWeight(400) | ||
| 108 | - .fontColor(Color.White) | 62 | + .margin({ right: 1 }) |
| 109 | } | 63 | } |
| 110 | - .backgroundColor('#4D000000') | ||
| 111 | - .padding({ | ||
| 112 | - top: 1, | ||
| 113 | - right: 4, | ||
| 114 | - bottom: 1 | ||
| 115 | - }) | ||
| 116 | - } | ||
| 117 | - //回看 | ||
| 118 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'end') { | ||
| 119 | - Row() { | ||
| 120 | - Text('回看') | ||
| 121 | - .fontSize('11fp') | ||
| 122 | - .fontWeight(400) | ||
| 123 | - .fontColor(Color.White) | ||
| 124 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 125 | - .width(12) | ||
| 126 | - .height(12) | ||
| 127 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 128 | - .fontSize('11fp') | ||
| 129 | - .fontWeight(400) | ||
| 130 | - .fontColor(Color.White) | ||
| 131 | - } | ||
| 132 | - .backgroundColor('#4D000000') | ||
| 133 | - .padding({ | ||
| 134 | - left: 4, | ||
| 135 | - top: 1, | ||
| 136 | - right: 4, | ||
| 137 | - bottom: 1 | ||
| 138 | - }) | 64 | + |
| 65 | + Text(this.liveDetailsBean.liveInfo?.liveState == 'running' ? '直播中' : '回看') | ||
| 66 | + .fontSize(11) | ||
| 67 | + .fontWeight(400) | ||
| 68 | + .fontColor(Color.White) | ||
| 69 | + Image($r('app.media.icon_live_player_status_end')) | ||
| 70 | + .width(12) | ||
| 71 | + .height(12) | ||
| 72 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 73 | + .fontSize('11fp') | ||
| 74 | + .fontWeight(400) | ||
| 75 | + .fontColor(Color.White) | ||
| 139 | } | 76 | } |
| 77 | + .backgroundColor('#4D000000') | ||
| 78 | + .borderRadius(2) | ||
| 79 | + .padding(this.liveDetailsBean.liveInfo?.liveState == 'running' ? { left: 0, right: 4, top: 0, bottom: 0 } : 4) | ||
| 140 | } | 80 | } |
| 141 | } | 81 | } |
| 1 | import { WDPlayerController } from 'wdPlayer/Index'; | 1 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 2 | +import { PlayerCommentComponent } from './PlayerCommentComponent'; | ||
| 3 | +import { PlayerTitleComponent } from './PlayerTitleComponent'; | ||
| 4 | +import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | ||
| 2 | 5 | ||
| 3 | @Component | 6 | @Component |
| 4 | export struct PlayerUIComponent { | 7 | export struct PlayerUIComponent { |
| 5 | - playerController: WDPlayerController = new WDPlayerController(); | 8 | + private playerController?: WDPlayerController |
| 6 | 9 | ||
| 7 | build() { | 10 | build() { |
| 11 | + Column() { | ||
| 12 | + PlayerTitleComponent() | ||
| 13 | + Blank() | ||
| 14 | + // PlayerCommentComponent().layoutWeight(1) | ||
| 15 | + PlayerVideoControlComponent({ playerController: this.playerController }) | ||
| 16 | + } | ||
| 17 | + .height('100%') | ||
| 18 | + .width('100%') | ||
| 19 | + | ||
| 8 | } | 20 | } |
| 9 | } | 21 | } |
| @@ -8,7 +8,7 @@ import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | @@ -8,7 +8,7 @@ import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | ||
| 8 | 8 | ||
| 9 | @Component | 9 | @Component |
| 10 | export struct PlayerVideoControlComponent { | 10 | export struct PlayerVideoControlComponent { |
| 11 | - playerController: WDPlayerController = new WDPlayerController(); | 11 | + private playerController?: WDPlayerController |
| 12 | @Consume liveDetailsBean: LiveDetailsBean | 12 | @Consume liveDetailsBean: LiveDetailsBean |
| 13 | @Consume liveRoomDataBean: LiveRoomDataBean | 13 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 14 | //菜单键是否可见 | 14 | //菜单键是否可见 |
| @@ -21,12 +21,16 @@ export struct PlayerVideoControlComponent { | @@ -21,12 +21,16 @@ export struct PlayerVideoControlComponent { | ||
| 21 | @State isPlayStatus: boolean = true | 21 | @State isPlayStatus: boolean = true |
| 22 | 22 | ||
| 23 | aboutToAppear(): void { | 23 | aboutToAppear(): void { |
| 24 | - //播放进度监听 | ||
| 25 | - this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 26 | - this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 27 | - this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 28 | - this.progressVal = Math.floor(position * 100 / duration); | 24 | + if (this.playerController) { |
| 25 | + //播放进度监听 | ||
| 26 | + this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 27 | + console.log('onTimeUpdate===', position, duration) | ||
| 28 | + this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 29 | + this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 30 | + this.progressVal = Math.floor(position * 100 / duration); | ||
| 31 | + } | ||
| 29 | } | 32 | } |
| 33 | + | ||
| 30 | } | 34 | } |
| 31 | 35 | ||
| 32 | build() { | 36 | build() { |
| @@ -90,10 +94,10 @@ export struct PlayerVideoControlComponent { | @@ -90,10 +94,10 @@ export struct PlayerVideoControlComponent { | ||
| 90 | .onClick(() => { | 94 | .onClick(() => { |
| 91 | if (this.isPlayStatus) { | 95 | if (this.isPlayStatus) { |
| 92 | this.isPlayStatus = false | 96 | this.isPlayStatus = false |
| 93 | - this.playerController.pause() | 97 | + this.playerController?.pause() |
| 94 | } else { | 98 | } else { |
| 95 | this.isPlayStatus = true | 99 | this.isPlayStatus = true |
| 96 | - this.playerController.play() | 100 | + this.playerController?.play() |
| 97 | } | 101 | } |
| 98 | }) | 102 | }) |
| 99 | } | 103 | } |
| @@ -108,15 +112,16 @@ export struct PlayerVideoControlComponent { | @@ -108,15 +112,16 @@ export struct PlayerVideoControlComponent { | ||
| 108 | .blockSize({ | 112 | .blockSize({ |
| 109 | width: 18, | 113 | width: 18, |
| 110 | height: 12 | 114 | height: 12 |
| 111 | - })// .blockStyle({ | ||
| 112 | - // type: SliderBlockType.IMAGE, | ||
| 113 | - // image: $r('app.media.ic_player_block') | ||
| 114 | - // }) | ||
| 115 | - .blockColor(Color.White) | 115 | + }) |
| 116 | .trackColor('#4DFFFFFF') | 116 | .trackColor('#4DFFFFFF') |
| 117 | .selectedColor('#FFED2800') | 117 | .selectedColor('#FFED2800') |
| 118 | + .trackThickness(2) | ||
| 119 | + .blockStyle({ | ||
| 120 | + type: SliderBlockType.IMAGE, | ||
| 121 | + image: $r('app.media.ic_player_block') | ||
| 122 | + }) | ||
| 123 | + .blockSize({ width: 18, height: 12 }) | ||
| 118 | .height(14) | 124 | .height(14) |
| 119 | - .trackThickness(1) | ||
| 120 | .layoutWeight(1) | 125 | .layoutWeight(1) |
| 121 | .margin({ | 126 | .margin({ |
| 122 | left: 8, | 127 | left: 8, |
-
Please register or login to post a comment