Showing
15 changed files
with
154 additions
and
38 deletions
| @@ -167,7 +167,7 @@ export interface LiveDetailsBean { | @@ -167,7 +167,7 @@ export interface LiveDetailsBean { | ||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | export interface LiveInfo { | 169 | export interface LiveInfo { |
| 170 | - //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 170 | + //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 |
| 171 | liveState: string | 171 | liveState: string |
| 172 | //2024-04-12 15:00:00 直播开始时间 | 172 | //2024-04-12 15:00:00 直播开始时间 |
| 173 | planStartTime: string | 173 | planStartTime: string |
| 1 | -import { CommonConstants } from 'wdConstant' | ||
| 2 | -import { CompDTO } from 'wdBean' | 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean' |
| 2 | +import { WDRouterRule } from 'wdRouter/Index' | ||
| 3 | +import { Logger } from 'wdKit/Index' | ||
| 4 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | ||
| 3 | 5 | ||
| 4 | @Component | 6 | @Component |
| 5 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | 7 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { |
| @@ -57,5 +59,23 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -57,5 +59,23 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 57 | }) | 59 | }) |
| 58 | .backgroundColor($r("app.color.white")) | 60 | .backgroundColor($r("app.color.white")) |
| 59 | .margin({ bottom: 8 }) | 61 | .margin({ bottom: 8 }) |
| 62 | + .onClick(()=>{ | ||
| 63 | + this.gotoLive(this.compDTO?.operDataList[0]) | ||
| 64 | + }) | ||
| 65 | + } | ||
| 66 | + gotoLive(content: ContentDTO) { | ||
| 67 | + let taskAction: Action = { | ||
| 68 | + type: 'JUMP_DETAIL_PAGE', | ||
| 69 | + params: { | ||
| 70 | + detailPageType: 2, | ||
| 71 | + contentID: content?.objectId, | ||
| 72 | + extra: { | ||
| 73 | + relType: content?.relType, | ||
| 74 | + relId: content?.relId, | ||
| 75 | + } as ExtraDTO | ||
| 76 | + } as Params, | ||
| 77 | + }; | ||
| 78 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 79 | + Logger.debug(`gotoLive, ${content.objectId}`); | ||
| 60 | } | 80 | } |
| 61 | } | 81 | } |
| @@ -4,6 +4,9 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | @@ -4,6 +4,9 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | ||
| 4 | import { CommonConstants } from 'wdConstant' | 4 | import { CommonConstants } from 'wdConstant' |
| 5 | import { WDRouterRule } from 'wdRouter/Index' | 5 | 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' | ||
| 8 | +import { Logger } from 'wdKit/Index' | ||
| 9 | + | ||
| 7 | @Component | 10 | @Component |
| 8 | export struct LiveHorizontalCardComponent { | 11 | export struct LiveHorizontalCardComponent { |
| 9 | @State compDTO: CompDTO = {} as CompDTO | 12 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -79,6 +82,7 @@ export struct LiveHorizontalCardComponent { | @@ -79,6 +82,7 @@ export struct LiveHorizontalCardComponent { | ||
| 79 | .onClick(() => { | 82 | .onClick(() => { |
| 80 | if (item.objectType != '0') { | 83 | if (item.objectType != '0') { |
| 81 | console.log(item.objectId) | 84 | console.log(item.objectId) |
| 85 | + this.gotoLive(item) | ||
| 82 | } | 86 | } |
| 83 | }) | 87 | }) |
| 84 | }) | 88 | }) |
| @@ -96,4 +100,19 @@ export struct LiveHorizontalCardComponent { | @@ -96,4 +100,19 @@ export struct LiveHorizontalCardComponent { | ||
| 96 | }) | 100 | }) |
| 97 | .backgroundColor($r("app.color.white")) | 101 | .backgroundColor($r("app.color.white")) |
| 98 | } | 102 | } |
| 103 | + gotoLive(content: ContentDTO) { | ||
| 104 | + let taskAction: Action = { | ||
| 105 | + type: 'JUMP_DETAIL_PAGE', | ||
| 106 | + params: { | ||
| 107 | + detailPageType: 2, | ||
| 108 | + contentID: content?.objectId, | ||
| 109 | + extra: { | ||
| 110 | + relType: content?.relType, | ||
| 111 | + relId: content?.relId, | ||
| 112 | + } as ExtraDTO | ||
| 113 | + } as Params, | ||
| 114 | + }; | ||
| 115 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 116 | + Logger.debug(`gotoLive, ${content.objectId}`); | ||
| 117 | + } | ||
| 99 | } | 118 | } |
| 1 | // 视频直播直播预约 | 1 | // 视频直播直播预约 |
| 2 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' | 2 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' |
| 3 | -import { CompDTO, ContentDTO } from 'wdBean' | 3 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean' |
| 4 | import { CommonConstants } from 'wdConstant' | 4 | import { CommonConstants } from 'wdConstant' |
| 5 | -import { StringUtils } from 'wdKit/Index' | 5 | +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' | ||
| 8 | +import { WDRouterRule } from 'wdRouter/Index' | ||
| 9 | + | ||
| 7 | @Component | 10 | @Component |
| 8 | export struct LiveHorizontalReservationComponent { | 11 | export struct LiveHorizontalReservationComponent { |
| 9 | @State compDTO: CompDTO = {} as CompDTO | 12 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -70,6 +73,7 @@ export struct LiveHorizontalReservationComponent { | @@ -70,6 +73,7 @@ export struct LiveHorizontalReservationComponent { | ||
| 70 | .onClick(() => { | 73 | .onClick(() => { |
| 71 | if (item.objectType != '0') { | 74 | if (item.objectType != '0') { |
| 72 | console.log(item.objectId) | 75 | console.log(item.objectId) |
| 76 | + this.gotoLive(item) | ||
| 73 | } | 77 | } |
| 74 | }) | 78 | }) |
| 75 | }) | 79 | }) |
| @@ -87,4 +91,20 @@ export struct LiveHorizontalReservationComponent { | @@ -87,4 +91,20 @@ export struct LiveHorizontalReservationComponent { | ||
| 87 | }) | 91 | }) |
| 88 | .backgroundColor($r("app.color.white")) | 92 | .backgroundColor($r("app.color.white")) |
| 89 | } | 93 | } |
| 94 | + | ||
| 95 | + gotoLive(content: ContentDTO) { | ||
| 96 | + let taskAction: Action = { | ||
| 97 | + type: 'JUMP_DETAIL_PAGE', | ||
| 98 | + params: { | ||
| 99 | + detailPageType: 2, | ||
| 100 | + contentID: content?.objectId, | ||
| 101 | + extra: { | ||
| 102 | + relType: content?.relType, | ||
| 103 | + relId: content?.relId, | ||
| 104 | + } as ExtraDTO | ||
| 105 | + } as Params, | ||
| 106 | + }; | ||
| 107 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 108 | + Logger.debug(`gotoLive, ${content.objectId}`); | ||
| 109 | + } | ||
| 90 | } | 110 | } |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | "wdKit": "file:../../commons/wdKit", | 13 | "wdKit": "file:../../commons/wdKit", |
| 14 | "wdBean": "file:../../features/wdBean", | 14 | "wdBean": "file:../../features/wdBean", |
| 15 | "wdConstant": "file:../../commons/wdConstant", | 15 | "wdConstant": "file:../../commons/wdConstant", |
| 16 | - "wdDetailPlayApi": "file:../../features/wdDetailPlayApi" | 16 | + "wdDetailPlayApi": "file:../../features/wdDetailPlayApi", |
| 17 | + "wdRouter": "file:../../commons/wdRouter" | ||
| 17 | } | 18 | } |
| 18 | } | 19 | } |
| @@ -10,11 +10,12 @@ import router from '@ohos.router'; | @@ -10,11 +10,12 @@ import router from '@ohos.router'; | ||
| 10 | export struct DetailPlayLivePage { | 10 | export struct DetailPlayLivePage { |
| 11 | TAG: string = 'DetailPlayLivePage'; | 11 | TAG: string = 'DetailPlayLivePage'; |
| 12 | liveViewModel: LiveViewModel = new LiveViewModel() | 12 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 13 | - @State relId: string = '500005302448' | ||
| 14 | - @State contentId: string = '20000016340' | ||
| 15 | - @State relType: string = '1' | 13 | + @State relId: string = '' |
| 14 | + @State contentId: string = '' | ||
| 15 | + @State relType: string = '' | ||
| 16 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean | 16 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean |
| 17 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean | 17 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean |
| 18 | + @State tabs: string[] = ['直播间', '大家聊'] | ||
| 18 | 19 | ||
| 19 | aboutToAppear(): void { | 20 | aboutToAppear(): void { |
| 20 | //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 | 21 | //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 |
| @@ -30,7 +31,7 @@ export struct DetailPlayLivePage { | @@ -30,7 +31,7 @@ export struct DetailPlayLivePage { | ||
| 30 | build() { | 31 | build() { |
| 31 | Column() { | 32 | Column() { |
| 32 | TopPlayComponent() | 33 | TopPlayComponent() |
| 33 | - TabComponent() | 34 | + TabComponent({ tabs: this.tabs }) |
| 34 | BottomComponent() | 35 | BottomComponent() |
| 35 | } | 36 | } |
| 36 | .height('100%') | 37 | .height('100%') |
| @@ -46,6 +47,9 @@ export struct DetailPlayLivePage { | @@ -46,6 +47,9 @@ export struct DetailPlayLivePage { | ||
| 46 | .then( | 47 | .then( |
| 47 | (data) => { | 48 | (data) => { |
| 48 | if (data.length > 0) { | 49 | if (data.length > 0) { |
| 50 | + if (data[0].liveInfo?.liveState == 'wait') { | ||
| 51 | + this.tabs = ['简介', '直播间', '大家聊'] | ||
| 52 | + } | ||
| 49 | this.liveDetailsBean = data[0] | 53 | this.liveDetailsBean = data[0] |
| 50 | } | 54 | } |
| 51 | }, | 55 | }, |
| @@ -170,10 +170,10 @@ export class LiveModel { | @@ -170,10 +170,10 @@ export class LiveModel { | ||
| 170 | * @param isSubscribe | 170 | * @param isSubscribe |
| 171 | * @returns | 171 | * @returns |
| 172 | */ | 172 | */ |
| 173 | - liveAppointment(relationId: string, mLiveId: string, isSubscribe: boolean) { | 173 | + liveAppointment(relationId: string, liveId: string, isSubscribe: boolean) { |
| 174 | let params: Record<string, string> = {}; | 174 | let params: Record<string, string> = {}; |
| 175 | params['relationId'] = relationId | 175 | params['relationId'] = relationId |
| 176 | - params['liveId'] = mLiveId | 176 | + params['liveId'] = liveId |
| 177 | params['isSubscribe'] = `${isSubscribe}` | 177 | params['isSubscribe'] = `${isSubscribe}` |
| 178 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 178 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 179 | return new Promise<ResponseDTO<string>>((success, fail) => { | 179 | return new Promise<ResponseDTO<string>>((success, fail) => { |
| @@ -67,9 +67,9 @@ export class LiveViewModel { | @@ -67,9 +67,9 @@ export class LiveViewModel { | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | //直播预约/取消预约 | 69 | //直播预约/取消预约 |
| 70 | - liveAppointment(relationId: string, mLiveId: string, isSubscribe: boolean) { | 70 | + liveAppointment(relationId: string, liveId: string, isSubscribe: boolean) { |
| 71 | return new Promise<ResponseDTO<string>>((success, fail) => { | 71 | return new Promise<ResponseDTO<string>>((success, fail) => { |
| 72 | - this.liveModel.liveAppointment(relationId, mLiveId, isSubscribe).then((data) => { | 72 | + this.liveModel.liveAppointment(relationId, liveId, isSubscribe).then((data) => { |
| 73 | success(data) | 73 | success(data) |
| 74 | }).catch((message: string) => { | 74 | }).catch((message: string) => { |
| 75 | fail(message) | 75 | fail(message) |
| @@ -2,10 +2,12 @@ import font from '@ohos.font' | @@ -2,10 +2,12 @@ import font from '@ohos.font' | ||
| 2 | import { LiveDetailsBean } from 'wdBean/Index' | 2 | import { LiveDetailsBean } from 'wdBean/Index' |
| 3 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' | 3 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' |
| 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 5 | +import { HttpUrlUtils } from 'wdNetwork/Index' | ||
| 6 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 5 | 7 | ||
| 6 | @Component | 8 | @Component |
| 7 | export struct LiveCountdownComponent { | 9 | export struct LiveCountdownComponent { |
| 8 | - @Consume @Watch('calculateDataStatus') liveDetailsBean: LiveDetailsBean | 10 | + @State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean |
| 9 | textTimerController: TextTimerController = new TextTimerController() | 11 | textTimerController: TextTimerController = new TextTimerController() |
| 10 | @State format: string = 'HH:mm:ss' | 12 | @State format: string = 'HH:mm:ss' |
| 11 | @State month: string = '' | 13 | @State month: string = '' |
| @@ -26,7 +28,8 @@ export struct LiveCountdownComponent { | @@ -26,7 +28,8 @@ export struct LiveCountdownComponent { | ||
| 26 | }) | 28 | }) |
| 27 | setTimeout(() => { | 29 | setTimeout(() => { |
| 28 | this.textTimerController.start() | 30 | this.textTimerController.start() |
| 29 | - }, 2000) | 31 | + }, 0) |
| 32 | + this.updateData() | ||
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | build() { | 35 | build() { |
| @@ -100,7 +103,7 @@ export struct LiveCountdownComponent { | @@ -100,7 +103,7 @@ export struct LiveCountdownComponent { | ||
| 100 | 103 | ||
| 101 | @Builder | 104 | @Builder |
| 102 | showAppointment() { | 105 | showAppointment() { |
| 103 | - Text('我要预约') | 106 | + Text(this.isAppointmentLive ? '取消预约' : '我要预约') |
| 104 | .width('100%') | 107 | .width('100%') |
| 105 | .height(42) | 108 | .height(42) |
| 106 | .textAlign(TextAlign.Center) | 109 | .textAlign(TextAlign.Center) |
| @@ -113,13 +116,17 @@ export struct LiveCountdownComponent { | @@ -113,13 +116,17 @@ export struct LiveCountdownComponent { | ||
| 113 | .border({ radius: 4 }) | 116 | .border({ radius: 4 }) |
| 114 | .backgroundColor(this.isAppointmentLive ? '#CCCCCC' : '#ED2800') | 117 | .backgroundColor(this.isAppointmentLive ? '#CCCCCC' : '#ED2800') |
| 115 | .onClick(() => { | 118 | .onClick(() => { |
| 119 | + if (!HttpUrlUtils.getUserId()) { | ||
| 120 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 121 | + return | ||
| 122 | + } | ||
| 116 | if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) { | 123 | if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) { |
| 117 | this.liveAppointment() | 124 | this.liveAppointment() |
| 118 | } | 125 | } |
| 119 | }) | 126 | }) |
| 120 | } | 127 | } |
| 121 | 128 | ||
| 122 | - calculateDataStatus() { | 129 | + updateData() { |
| 123 | if (!this.liveDetailsBean) { | 130 | if (!this.liveDetailsBean) { |
| 124 | return | 131 | return |
| 125 | } | 132 | } |
| 1 | -import { LiveDetailsBean } from 'wdBean/Index' | ||
| 2 | import { TabChatComponent } from './TabChatComponent' | 1 | import { TabChatComponent } from './TabChatComponent' |
| 3 | import { TabInfoComponent } from './TabInfoComponent' | 2 | import { TabInfoComponent } from './TabInfoComponent' |
| 4 | import { TabLiveComponent } from './TabLiveComponent' | 3 | import { TabLiveComponent } from './TabLiveComponent' |
| @@ -9,7 +8,7 @@ export struct TabComponent { | @@ -9,7 +8,7 @@ export struct TabComponent { | ||
| 9 | @State selectedFontColor: string = '#222222' | 8 | @State selectedFontColor: string = '#222222' |
| 10 | @State currentIndex: number = 0 | 9 | @State currentIndex: number = 0 |
| 11 | private controller: TabsController = new TabsController() | 10 | private controller: TabsController = new TabsController() |
| 12 | - tabs: string[] = ['简介', '直播间', '大家聊'] | 11 | + @Prop tabs: string[] = [] |
| 13 | 12 | ||
| 14 | aboutToAppear(): void { | 13 | aboutToAppear(): void { |
| 15 | 14 | ||
| @@ -19,12 +18,21 @@ export struct TabComponent { | @@ -19,12 +18,21 @@ export struct TabComponent { | ||
| 19 | Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { | 18 | Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { |
| 20 | ForEach(this.tabs, (item: string, index: number) => { | 19 | ForEach(this.tabs, (item: string, index: number) => { |
| 21 | TabContent() { | 20 | TabContent() { |
| 22 | - if (0 == index) { | ||
| 23 | - TabInfoComponent() | ||
| 24 | - } else if (1 == index) { | ||
| 25 | - TabLiveComponent() | ||
| 26 | - } else { | ||
| 27 | - TabChatComponent() | 21 | + if (this.tabs.length == 3) { |
| 22 | + if (0 == index) { | ||
| 23 | + TabInfoComponent() | ||
| 24 | + } else if (1 == index) { | ||
| 25 | + TabLiveComponent() | ||
| 26 | + } else { | ||
| 27 | + TabChatComponent() | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + else { | ||
| 31 | + if (0 == index) { | ||
| 32 | + TabLiveComponent() | ||
| 33 | + } else { | ||
| 34 | + TabChatComponent() | ||
| 35 | + } | ||
| 28 | } | 36 | } |
| 29 | }.tabBar(this.tabBuilder(index, item)) | 37 | }.tabBar(this.tabBuilder(index, item)) |
| 30 | .backgroundColor('#F5F5F5') | 38 | .backgroundColor('#F5F5F5') |
| @@ -12,7 +12,7 @@ export struct TabInfoComponent { | @@ -12,7 +12,7 @@ export struct TabInfoComponent { | ||
| 12 | Column() { | 12 | Column() { |
| 13 | this.showLiveTitle() | 13 | this.showLiveTitle() |
| 14 | this.showLiveDetails() | 14 | this.showLiveDetails() |
| 15 | - LiveCountdownComponent() | 15 | + LiveCountdownComponent({liveDetailsBean:this.liveDetailsBean}) |
| 16 | }.margin({ | 16 | }.margin({ |
| 17 | top: 13, | 17 | top: 13, |
| 18 | left: 16, | 18 | left: 16, |
| @@ -8,12 +8,16 @@ import { TabLiveItemComponent } from './TabLiveItemComponent' | @@ -8,12 +8,16 @@ import { TabLiveItemComponent } from './TabLiveItemComponent' | ||
| 8 | export struct TabLiveComponent { | 8 | export struct TabLiveComponent { |
| 9 | liveViewModel: LiveViewModel = new LiveViewModel() | 9 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 10 | @State liveList: Array<LiveRoomItemBean> = [] | 10 | @State liveList: Array<LiveRoomItemBean> = [] |
| 11 | - @Consume liveDetailsBean: LiveDetailsBean | 11 | + @Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean |
| 12 | 12 | ||
| 13 | - aboutToAppear(): void { | 13 | + updateDate() { |
| 14 | this.getLiveList() | 14 | this.getLiveList() |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | + aboutToAppear(): void { | ||
| 18 | + | ||
| 19 | + } | ||
| 20 | + | ||
| 17 | build() { | 21 | build() { |
| 18 | Stack() { | 22 | Stack() { |
| 19 | if (this.liveList.length == 0) { | 23 | if (this.liveList.length == 0) { |
| @@ -51,14 +51,18 @@ export struct PlayUIComponent { | @@ -51,14 +51,18 @@ export struct PlayUIComponent { | ||
| 51 | .margin({ | 51 | .margin({ |
| 52 | right: 10 | 52 | right: 10 |
| 53 | }) | 53 | }) |
| 54 | - Text(this.liveDetailsBean.newsTitle) | ||
| 55 | - .maxLines(1) | ||
| 56 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 57 | - .fontSize('16fp') | ||
| 58 | - .fontWeight(500) | ||
| 59 | - .fontColor(Color.White) | ||
| 60 | - .textAlign(TextAlign.Start) | ||
| 61 | - .layoutWeight(1) | 54 | + if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { |
| 55 | + Text(this.liveDetailsBean.newsTitle) | ||
| 56 | + .maxLines(1) | ||
| 57 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 58 | + .fontSize('16fp') | ||
| 59 | + .fontWeight(500) | ||
| 60 | + .fontColor(Color.White) | ||
| 61 | + .textAlign(TextAlign.Start) | ||
| 62 | + .layoutWeight(1) | ||
| 63 | + } else { | ||
| 64 | + Blank() | ||
| 65 | + } | ||
| 62 | Image($r('app.media.icon_share')) | 66 | Image($r('app.media.icon_share')) |
| 63 | .width(24) | 67 | .width(24) |
| 64 | .aspectRatio(1) | 68 | .aspectRatio(1) |
| @@ -86,8 +90,25 @@ export struct PlayUIComponent { | @@ -86,8 +90,25 @@ export struct PlayUIComponent { | ||
| 86 | getLiveStatusView() { | 90 | getLiveStatusView() { |
| 87 | // 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 91 | // 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 88 | // 预约 | 92 | // 预约 |
| 93 | + if (this.liveDetailsBean.liveInfo?.liveState == 'wait') { | ||
| 94 | + Row() { | ||
| 95 | + Image($r('app.media.icon_live_status_wait')) | ||
| 96 | + .width(22) | ||
| 97 | + .height(18) | ||
| 98 | + Text('预约') | ||
| 99 | + .fontSize('11fp') | ||
| 100 | + .fontWeight(400) | ||
| 101 | + .fontColor(Color.White) | ||
| 102 | + } | ||
| 103 | + .backgroundColor('#4D000000') | ||
| 104 | + .padding({ | ||
| 105 | + top: 1, | ||
| 106 | + right: 4, | ||
| 107 | + bottom: 1 | ||
| 108 | + }) | ||
| 109 | + } | ||
| 89 | // 直播中 | 110 | // 直播中 |
| 90 | - if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | 111 | + else if (this.liveDetailsBean.liveInfo?.liveState == 'running') { |
| 91 | Row() { | 112 | Row() { |
| 92 | Image($r('app.media.icon_live_status_running')) | 113 | Image($r('app.media.icon_live_status_running')) |
| 93 | .width(22) | 114 | .width(22) |
| @@ -6,6 +6,8 @@ import { PlayUIComponent } from './PlayUIComponent'; | @@ -6,6 +6,8 @@ import { PlayUIComponent } from './PlayUIComponent'; | ||
| 6 | export struct TopPlayComponent { | 6 | export struct TopPlayComponent { |
| 7 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 7 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 8 | playerController: WDPlayerController = new WDPlayerController(); | 8 | playerController: WDPlayerController = new WDPlayerController(); |
| 9 | + @State imgUrl: string = '' | ||
| 10 | + @State isWait: boolean = false | ||
| 9 | 11 | ||
| 10 | aboutToAppear(): void { | 12 | aboutToAppear(): void { |
| 11 | this.playerController.onCanplay = () => { | 13 | this.playerController.onCanplay = () => { |
| @@ -15,6 +17,10 @@ export struct TopPlayComponent { | @@ -15,6 +17,10 @@ export struct TopPlayComponent { | ||
| 15 | 17 | ||
| 16 | updateData() { | 18 | updateData() { |
| 17 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 19 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 20 | + if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | ||
| 21 | + this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | ||
| 22 | + } | ||
| 23 | + this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' | ||
| 18 | if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { | 24 | if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { |
| 19 | let playUrl = '' | 25 | let playUrl = '' |
| 20 | if (this.liveDetailsBean.liveInfo.liveState == 'running') { | 26 | if (this.liveDetailsBean.liveInfo.liveState == 'running') { |
| @@ -35,6 +41,10 @@ export struct TopPlayComponent { | @@ -35,6 +41,10 @@ export struct TopPlayComponent { | ||
| 35 | }) | 41 | }) |
| 36 | .height('100%') | 42 | .height('100%') |
| 37 | .width('100%') | 43 | .width('100%') |
| 44 | + .visibility(this.isWait ? Visibility.None : Visibility.Visible) | ||
| 45 | + Image(this.imgUrl) | ||
| 46 | + .objectFit(ImageFit.Contain) | ||
| 47 | + .visibility(this.isWait ? Visibility.Visible : Visibility.None) | ||
| 38 | PlayUIComponent({ playerController: this.playerController }) | 48 | PlayUIComponent({ playerController: this.playerController }) |
| 39 | } | 49 | } |
| 40 | .height(211) | 50 | .height(211) |
| @@ -43,5 +53,7 @@ export struct TopPlayComponent { | @@ -43,5 +53,7 @@ export struct TopPlayComponent { | ||
| 43 | 53 | ||
| 44 | aboutToDisappear(): void { | 54 | aboutToDisappear(): void { |
| 45 | this.playerController.pause() | 55 | this.playerController.pause() |
| 56 | + this.playerController.stop() | ||
| 57 | + this.playerController.release() | ||
| 46 | } | 58 | } |
| 47 | } | 59 | } |
-
Please register or login to post a comment