Showing
13 changed files
with
127 additions
and
35 deletions
| @@ -49,6 +49,10 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi | @@ -49,6 +49,10 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi | ||
| 49 | 49 | ||
| 50 | export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO'; | 50 | export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO'; |
| 51 | 51 | ||
| 52 | +export { RmhInfoDTO } from './src/main/ets/bean/detail/RmhInfoDTO'; | ||
| 53 | + | ||
| 54 | +export { UserInfoDTO } from './src/main/ets/bean/detail/UserInfoDTO'; | ||
| 55 | + | ||
| 52 | export { AuthorListDTO } from './src/main/ets/bean/detail/AuthorListDTO'; | 56 | export { AuthorListDTO } from './src/main/ets/bean/detail/AuthorListDTO'; |
| 53 | 57 | ||
| 54 | export { FullColumnImgUrlDTO } from './src/main/ets/bean/detail/FullColumnImgUrlDTO'; | 58 | export { FullColumnImgUrlDTO } from './src/main/ets/bean/detail/FullColumnImgUrlDTO'; |
| @@ -3,6 +3,8 @@ import { FullColumnImgUrlDTO } from './FullColumnImgUrlDTO'; | @@ -3,6 +3,8 @@ import { FullColumnImgUrlDTO } from './FullColumnImgUrlDTO'; | ||
| 3 | import { ReLInfoDTO } from './ReLInfoDTO'; | 3 | import { ReLInfoDTO } from './ReLInfoDTO'; |
| 4 | import { ShareInfoDTO } from './ShareInfoDTO'; | 4 | import { ShareInfoDTO } from './ShareInfoDTO'; |
| 5 | import { VideoInfoDTO } from './VideoInfoDTO'; | 5 | import { VideoInfoDTO } from './VideoInfoDTO'; |
| 6 | +import { RmhInfoDTO } from './RmhInfoDTO' | ||
| 7 | +import { UserInfoDTO } from './UserInfoDTO' | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * 接口定义: | 10 | * 接口定义: |
| @@ -40,8 +42,8 @@ export interface ContentDetailDTO { | @@ -40,8 +42,8 @@ export interface ContentDetailDTO { | ||
| 40 | videoInfo: VideoInfoDTO[]; | 42 | videoInfo: VideoInfoDTO[]; |
| 41 | liveInfo?: any; | 43 | liveInfo?: any; |
| 42 | voteInfo?: any; | 44 | voteInfo?: any; |
| 43 | - rmhInfo?: any; | ||
| 44 | - userInfo?: any; | 45 | + rmhInfo?: RmhInfoDTO; |
| 46 | + userInfo?: UserInfoDTO; | ||
| 45 | openLikes: number; | 47 | openLikes: number; |
| 46 | openComment: number; | 48 | openComment: number; |
| 47 | likesStyle: number; | 49 | likesStyle: number; |
| 1 | +export interface RmhInfoDTO { | ||
| 2 | + authIcon: string; | ||
| 3 | + authTitle: string; | ||
| 4 | + authTitle2: string; | ||
| 5 | + banControl: number; | ||
| 6 | + cnAttention: number; | ||
| 7 | + cnMainControl: number; | ||
| 8 | + cnShareControl: number; | ||
| 9 | + cnlsComment: number; | ||
| 10 | + cnlsLike: number; | ||
| 11 | + posterShareControl: number; | ||
| 12 | + rmhDesc: string; | ||
| 13 | + rmhHeadUrl: string; | ||
| 14 | + rmhId: string; | ||
| 15 | + rmhName: string; | ||
| 16 | + userId: string; | ||
| 17 | + userType: string; | ||
| 18 | +} |
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | import mediaquery from '@ohos.mediaquery'; | 2 | import mediaquery from '@ohos.mediaquery'; |
| 3 | import window from '@ohos.window'; | 3 | import window from '@ohos.window'; |
| 4 | -import { Action } from 'wdBean'; | 4 | +import { Action, RmhInfoDTO, UserInfoDTO } from 'wdBean'; |
| 5 | import { Logger, SPHelper, WindowModel } from 'wdKit'; | 5 | import { Logger, SPHelper, WindowModel } from 'wdKit'; |
| 6 | import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; | 6 | import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; |
| 7 | import { devicePLSensorManager } from 'wdDetailPlayApi'; | 7 | import { devicePLSensorManager } from 'wdDetailPlayApi'; |
| @@ -30,27 +30,34 @@ export struct DetailPlayShortVideoPage { | @@ -30,27 +30,34 @@ export struct DetailPlayShortVideoPage { | ||
| 30 | @Provide canStart?: boolean = false; | 30 | @Provide canStart?: boolean = false; |
| 31 | @Provide status: number = PlayerConstants.STATUS_START; | 31 | @Provide status: number = PlayerConstants.STATUS_START; |
| 32 | @Provide userId: string = ''; | 32 | @Provide userId: string = ''; |
| 33 | - @Provide newsSourceName?: string = undefined | ||
| 34 | - @Provide title?: string = undefined | ||
| 35 | - @Provide message?: string = undefined | ||
| 36 | - @Provide newsSummary?: string = undefined | 33 | + @Provide newsSourceName?: string = '' |
| 34 | + @Provide newsTitle?: string = '' | ||
| 35 | + @Provide editorName?: string = '' | ||
| 36 | + @Provide rmhInfo?: RmhInfoDTO = undefined | ||
| 37 | + @Provide userInfo?: UserInfoDTO = undefined | ||
| 38 | + @Provide message?: string = '' | ||
| 39 | + @Provide newsSummary?: string = '' | ||
| 37 | @Provide progressVal: number = 0; | 40 | @Provide progressVal: number = 0; |
| 38 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 | 41 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 |
| 39 | 42 | ||
| 40 | playVMChanged(name: string) { | 43 | playVMChanged(name: string) { |
| 41 | this.url = this.playVM.url | 44 | this.url = this.playVM.url |
| 42 | this.newsSourceName = this.playVM.newsSourceName | 45 | this.newsSourceName = this.playVM.newsSourceName |
| 43 | - this.title = this.playVM.title | 46 | + this.newsTitle = this.playVM.newsTitle |
| 47 | + this.editorName = this.playVM.editorName | ||
| 44 | this.newsSummary = this.playVM.newsSummary | 48 | this.newsSummary = this.playVM.newsSummary |
| 45 | this.videoLandScape = this.playVM.videoLandScape ?? 1 | 49 | this.videoLandScape = this.playVM.videoLandScape ?? 1 |
| 46 | this.curContId = this.playVM.contentId | 50 | this.curContId = this.playVM.contentId |
| 47 | this.nextContId = this.playVM.nextContId | 51 | this.nextContId = this.playVM.nextContId |
| 48 | this.canStart = this.playVM.canStart; | 52 | this.canStart = this.playVM.canStart; |
| 49 | this.message = this.playVM.message | 53 | this.message = this.playVM.message |
| 54 | + this.rmhInfo = this.playVM.rmhInfo | ||
| 55 | + this.userInfo = this.playVM.userInfo | ||
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | aboutToAppear() { | 58 | aboutToAppear() { |
| 53 | let action: Action = router.getParams() as Action | 59 | let action: Action = router.getParams() as Action |
| 60 | + Logger.info(TAG, "action", JSON.stringify(action)) | ||
| 54 | if (action) { | 61 | if (action) { |
| 55 | this.contentId = action.params?.contentID | 62 | this.contentId = action.params?.contentID |
| 56 | if (action.params && action.params.extra) { | 63 | if (action.params && action.params.extra) { |
| @@ -86,11 +93,12 @@ export struct DetailPlayShortVideoPage { | @@ -86,11 +93,12 @@ export struct DetailPlayShortVideoPage { | ||
| 86 | } | 93 | } |
| 87 | 94 | ||
| 88 | @Builder | 95 | @Builder |
| 89 | - playerViewContainer() { | 96 | + playerViewContainerBuilder() { |
| 90 | // 播放窗口 | 97 | // 播放窗口 |
| 91 | WDPlayerRenderView({ | 98 | WDPlayerRenderView({ |
| 92 | playerController: this.playerController, | 99 | playerController: this.playerController, |
| 93 | onLoad: async () => { | 100 | onLoad: async () => { |
| 101 | + console.log('onload==') | ||
| 94 | // this.playVM.playWithContentId(this.contentId ?? "846899373") | 102 | // this.playVM.playWithContentId(this.contentId ?? "846899373") |
| 95 | this.playVM.playWithIds(this.contentId ?? "846899373", | 103 | this.playVM.playWithIds(this.contentId ?? "846899373", |
| 96 | this.relId ?? "500000301942", this.relType ?? "1") | 104 | this.relId ?? "500000301942", this.relType ?? "1") |
| @@ -101,7 +109,7 @@ export struct DetailPlayShortVideoPage { | @@ -101,7 +109,7 @@ export struct DetailPlayShortVideoPage { | ||
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | @Builder | 111 | @Builder |
| 104 | - playControlViewContainer() { | 112 | + playControlViewContainerBuilder() { |
| 105 | // 播放窗口控制bar | 113 | // 播放窗口控制bar |
| 106 | PlayControlViewContainer({ | 114 | PlayControlViewContainer({ |
| 107 | playerController: this.playerController | 115 | playerController: this.playerController |
| @@ -109,7 +117,7 @@ export struct DetailPlayShortVideoPage { | @@ -109,7 +117,7 @@ export struct DetailPlayShortVideoPage { | ||
| 109 | } | 117 | } |
| 110 | 118 | ||
| 111 | @Builder | 119 | @Builder |
| 112 | - detailContainer() { | 120 | + detailContainerBuilder() { |
| 113 | // DetailTabBarPageComponent({ pageId: this.pageId }).backgroundColor(Color.Black) | 121 | // DetailTabBarPageComponent({ pageId: this.pageId }).backgroundColor(Color.Black) |
| 114 | DetailContainer({ | 122 | DetailContainer({ |
| 115 | playerController: this.playerController | 123 | playerController: this.playerController |
| @@ -118,13 +126,15 @@ export struct DetailPlayShortVideoPage { | @@ -118,13 +126,15 @@ export struct DetailPlayShortVideoPage { | ||
| 118 | 126 | ||
| 119 | build() { | 127 | build() { |
| 120 | Row() { | 128 | Row() { |
| 121 | - PlayerDetailContainer({ playerView: () => { | ||
| 122 | - this.playerViewContainer() | 129 | + PlayerDetailContainer({ |
| 130 | + playerView: () => { | ||
| 131 | + this.playerViewContainerBuilder() | ||
| 123 | }, playControlView: () => { | 132 | }, playControlView: () => { |
| 124 | - this.playControlViewContainer() | 133 | + this.playControlViewContainerBuilder() |
| 125 | }, detailView: () => { | 134 | }, detailView: () => { |
| 126 | - this.detailContainer() | ||
| 127 | - } }) | 135 | + this.detailContainerBuilder() |
| 136 | + } | ||
| 137 | + }) | ||
| 128 | .height('100%') | 138 | .height('100%') |
| 129 | .width('100%') | 139 | .width('100%') |
| 130 | } | 140 | } |
| 1 | +import { RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; | ||
| 1 | import { ToastUtils } from 'wdKit'; | 2 | import { ToastUtils } from 'wdKit'; |
| 2 | 3 | ||
| 3 | export interface OperationItem { | 4 | export interface OperationItem { |
| @@ -12,13 +13,14 @@ const FULL_PARENT: string = '100%'; | @@ -12,13 +13,14 @@ const FULL_PARENT: string = '100%'; | ||
| 12 | 13 | ||
| 13 | const TAG = 'OperationListView'; | 14 | const TAG = 'OperationListView'; |
| 14 | 15 | ||
| 15 | -@Entry | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct OperationListView { | 17 | export struct OperationListView { |
| 18 | + @Consume rmhInfo?: RmhInfoDTO | ||
| 19 | + @Consume userInfo?: UserInfoDTO | ||
| 18 | @State operationList: OperationItem[] = [ | 20 | @State operationList: OperationItem[] = [ |
| 19 | { | 21 | { |
| 20 | icon: $r('app.media.ic_like_uncheck'), | 22 | icon: $r('app.media.ic_like_uncheck'), |
| 21 | - text: "点赞", | 23 | + text: "赞", |
| 22 | num: 6622 | 24 | num: 6622 |
| 23 | }, | 25 | }, |
| 24 | { | 26 | { |
| @@ -62,6 +64,7 @@ export struct OperationListView { | @@ -62,6 +64,7 @@ export struct OperationListView { | ||
| 62 | // }) | 64 | // }) |
| 63 | 65 | ||
| 64 | Column() { | 66 | Column() { |
| 67 | + this.buildUserComp() | ||
| 65 | ForEach(this.operationList, (item: OperationItem, index: number) => { | 68 | ForEach(this.operationList, (item: OperationItem, index: number) => { |
| 66 | this.buildOperationItem(item, index) | 69 | this.buildOperationItem(item, index) |
| 67 | }, (item: OperationItem, index: number) => JSON.stringify(item)) | 70 | }, (item: OperationItem, index: number) => JSON.stringify(item)) |
| @@ -69,6 +72,17 @@ export struct OperationListView { | @@ -69,6 +72,17 @@ export struct OperationListView { | ||
| 69 | .width(48) | 72 | .width(48) |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 75 | + @Builder | ||
| 76 | + buildUserComp() { | ||
| 77 | + Column() { | ||
| 78 | + Image(this.rmhInfo?.rmhHeadUrl || this.userInfo?.userHeadUrl) | ||
| 79 | + .width(48) | ||
| 80 | + .borderRadius(24) | ||
| 81 | + .aspectRatio(1) | ||
| 82 | + // .margin(18) | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 72 | /** | 86 | /** |
| 73 | * 组件项 | 87 | * 组件项 |
| 74 | * | 88 | * |
| @@ -97,7 +111,7 @@ export struct OperationListView { | @@ -97,7 +111,7 @@ export struct OperationListView { | ||
| 97 | .hoverEffect(HoverEffect.Scale) | 111 | .hoverEffect(HoverEffect.Scale) |
| 98 | .onClick((event: ClickEvent) => { | 112 | .onClick((event: ClickEvent) => { |
| 99 | console.info(TAG, `buildOperationItem onClick event index: ${index}`); | 113 | console.info(TAG, `buildOperationItem onClick event index: ${index}`); |
| 100 | - ToastUtils.showToast('体验版,本功能暂未开发', 1000); | 114 | + // ToastUtils.showToast('体验版,本功能暂未开发', 1000); |
| 101 | }) | 115 | }) |
| 102 | } | 116 | } |
| 103 | } | 117 | } |
| @@ -103,12 +103,17 @@ export struct PlayControlViewContainer { | @@ -103,12 +103,17 @@ export struct PlayControlViewContainer { | ||
| 103 | .height('100%') | 103 | .height('100%') |
| 104 | .width('100%') | 104 | .width('100%') |
| 105 | .zIndex(1) | 105 | .zIndex(1) |
| 106 | - .gesture(TapGesture({ count: 2 }) | 106 | + .gesture(TapGesture({ count: 1 }) |
| 107 | .onAction((event: GestureEvent) => { | 107 | .onAction((event: GestureEvent) => { |
| 108 | let curStatus = (this.status === PlayerConstants.STATUS_START); | 108 | let curStatus = (this.status === PlayerConstants.STATUS_START); |
| 109 | this.status = curStatus ? PlayerConstants.STATUS_PAUSE : PlayerConstants.STATUS_START; | 109 | this.status = curStatus ? PlayerConstants.STATUS_PAUSE : PlayerConstants.STATUS_START; |
| 110 | this.playerController?.switchPlayOrPause(); | 110 | this.playerController?.switchPlayOrPause(); |
| 111 | })) | 111 | })) |
| 112 | + .gesture(TapGesture({ count: 2 }) | ||
| 113 | + .onAction((event: GestureEvent) => { | ||
| 114 | + // TODO 双击点赞|收藏 | ||
| 115 | + })) | ||
| 116 | + | ||
| 112 | 117 | ||
| 113 | Row() { | 118 | Row() { |
| 114 | Image($r('app.media.ic_volume')) | 119 | Image($r('app.media.ic_volume')) |
| @@ -8,7 +8,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi'; | @@ -8,7 +8,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi'; | ||
| 8 | @Component | 8 | @Component |
| 9 | export struct PlayerTitle { | 9 | export struct PlayerTitle { |
| 10 | private playerController?: WDPlayerController; | 10 | private playerController?: WDPlayerController; |
| 11 | - @Consume title?: string | 11 | + @Consume newsTitle?: string |
| 12 | @Consume isFullScreen: boolean; | 12 | @Consume isFullScreen: boolean; |
| 13 | @State @Watch('watchSpeed') playSpeed: number = 1; | 13 | @State @Watch('watchSpeed') playSpeed: number = 1; |
| 14 | 14 | ||
| @@ -46,7 +46,7 @@ export struct PlayerTitle { | @@ -46,7 +46,7 @@ export struct PlayerTitle { | ||
| 46 | router.back(); | 46 | router.back(); |
| 47 | } | 47 | } |
| 48 | }) | 48 | }) |
| 49 | - Text(this.title) | 49 | + Text(this.newsTitle) |
| 50 | .fontColor(Color.White) | 50 | .fontColor(Color.White) |
| 51 | .fontSize('14fp') | 51 | .fontSize('14fp') |
| 52 | .maxLines(2) | 52 | .maxLines(2) |
| @@ -5,12 +5,14 @@ import { WindowModel } from 'wdKit'; | @@ -5,12 +5,14 @@ import { WindowModel } from 'wdKit'; | ||
| 5 | import { WDPlayerController } from 'wdPlayer'; | 5 | import { WDPlayerController } from 'wdPlayer'; |
| 6 | import { devicePLSensorManager } from 'wdDetailPlayApi'; | 6 | import { devicePLSensorManager } from 'wdDetailPlayApi'; |
| 7 | import { OperationListView } from './OperationListView'; | 7 | import { OperationListView } from './OperationListView'; |
| 8 | +import { RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; | ||
| 8 | 9 | ||
| 9 | @Component | 10 | @Component |
| 10 | export struct PlayerTitleComment { | 11 | export struct PlayerTitleComment { |
| 11 | private playerController?: WDPlayerController; | 12 | private playerController?: WDPlayerController; |
| 12 | @Consume newsSourceName?: string | 13 | @Consume newsSourceName?: string |
| 13 | - @Consume title?: string | 14 | + @Consume newsTitle?: string |
| 15 | + @Consume editorName?: string | ||
| 14 | @Consume newsSummary?: string; | 16 | @Consume newsSummary?: string; |
| 15 | @State @Watch('watchSpeed') playSpeed: number = 1; | 17 | @State @Watch('watchSpeed') playSpeed: number = 1; |
| 16 | @Consume isFullScreen: boolean; | 18 | @Consume isFullScreen: boolean; |
| @@ -57,15 +59,15 @@ export struct PlayerTitleComment { | @@ -57,15 +59,15 @@ export struct PlayerTitleComment { | ||
| 57 | 59 | ||
| 58 | Row() { | 60 | Row() { |
| 59 | Column() { | 61 | Column() { |
| 60 | - if (this.newsSourceName) { | ||
| 61 | - Text("@" + this.newsSourceName) | 62 | + if (this.newsSourceName || this.editorName) { |
| 63 | + Text("@" + (this.newsSourceName || this.editorName)) | ||
| 62 | .fontColor(Color.White) | 64 | .fontColor(Color.White) |
| 63 | .fontSize(15) | 65 | .fontSize(15) |
| 64 | .maxLines(1) | 66 | .maxLines(1) |
| 65 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 67 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 66 | } | 68 | } |
| 67 | - if (this.newsSummary) { | ||
| 68 | - Text(this.newsSummary) | 69 | + if (this.newsTitle || this.newsSummary) { |
| 70 | + Text(this.newsTitle || this.newsSummary) | ||
| 69 | .fontColor(Color.White) | 71 | .fontColor(Color.White) |
| 70 | .fontSize(15) | 72 | .fontSize(15) |
| 71 | .maxLines(3) | 73 | .maxLines(3) |
| @@ -80,6 +82,7 @@ export struct PlayerTitleComment { | @@ -80,6 +82,7 @@ export struct PlayerTitleComment { | ||
| 80 | } | 82 | } |
| 81 | .layoutWeight(1) | 83 | .layoutWeight(1) |
| 82 | .alignItems(HorizontalAlign.Start) | 84 | .alignItems(HorizontalAlign.Start) |
| 85 | + .margin({ left: 16 }) | ||
| 83 | 86 | ||
| 84 | OperationListView() | 87 | OperationListView() |
| 85 | .width(48) | 88 | .width(48) |
| @@ -135,6 +138,8 @@ export struct PlayerTitleComment { | @@ -135,6 +138,8 @@ export struct PlayerTitleComment { | ||
| 135 | .fontSize(14) | 138 | .fontSize(14) |
| 136 | .maxLines(1) | 139 | .maxLines(1) |
| 137 | .layoutWeight(1) | 140 | .layoutWeight(1) |
| 141 | + .backgroundColor('#ccc') | ||
| 142 | + .borderRadius(2) | ||
| 138 | }.alignItems(VerticalAlign.Center) | 143 | }.alignItems(VerticalAlign.Center) |
| 139 | } | 144 | } |
| 140 | .width('100%') | 145 | .width('100%') |
| @@ -2,7 +2,7 @@ import { BusinessError } from '@ohos.base' | @@ -2,7 +2,7 @@ import { BusinessError } from '@ohos.base' | ||
| 2 | import { Logger, ToastUtils } from 'wdKit' | 2 | import { Logger, ToastUtils } from 'wdKit' |
| 3 | import { ResponseDTO } from 'wdNetwork' | 3 | import { ResponseDTO } from 'wdNetwork' |
| 4 | import { ContentDetailRequest } from 'wdDetailPlayApi' | 4 | import { ContentDetailRequest } from 'wdDetailPlayApi' |
| 5 | -import { ContentDetailDTO } from 'wdBean' | 5 | +import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean' |
| 6 | 6 | ||
| 7 | const TAG = 'PlayViewModel'; | 7 | const TAG = 'PlayViewModel'; |
| 8 | 8 | ||
| @@ -12,8 +12,11 @@ export class PlayViewModel { | @@ -12,8 +12,11 @@ export class PlayViewModel { | ||
| 12 | relId: string | 12 | relId: string |
| 13 | relType: string | 13 | relType: string |
| 14 | newsSourceName?: string | 14 | newsSourceName?: string |
| 15 | - title?: string | 15 | + newsTitle?: string |
| 16 | + editorName?: string | ||
| 16 | newsSummary?: string | 17 | newsSummary?: string |
| 18 | + rmhInfo?: RmhInfoDTO | ||
| 19 | + userInfo?: UserInfoDTO | ||
| 17 | url?: string | 20 | url?: string |
| 18 | // 视频朝向, | 21 | // 视频朝向, |
| 19 | // 横屏视频:1(进入竖屏,立即展示半屏播放窗口,当切换横屏时,再展示全部播放窗口;后续可再转换到竖屏): | 22 | // 横屏视频:1(进入竖屏,立即展示半屏播放窗口,当切换横屏时,再展示全部播放窗口;后续可再转换到竖屏): |
| @@ -59,14 +62,21 @@ export class PlayViewModel { | @@ -59,14 +62,21 @@ export class PlayViewModel { | ||
| 59 | Logger.error(TAG, `getContentDetailData then body is empty`); | 62 | Logger.error(TAG, `getContentDetailData then body is empty`); |
| 60 | return | 63 | return |
| 61 | } | 64 | } |
| 65 | + | ||
| 62 | let contentDetailDTO: ContentDetailDTO = resDTO.data[0] | 66 | let contentDetailDTO: ContentDetailDTO = resDTO.data[0] |
| 63 | - this.newsSourceName = contentDetailDTO.newsSourceName | ||
| 64 | - this.title = contentDetailDTO.newsTitle | 67 | + Logger.info(TAG, JSON.stringify(contentDetailDTO)) |
| 68 | + this.newsTitle = contentDetailDTO.newsTitle | ||
| 69 | + this.editorName = contentDetailDTO.editorName | ||
| 65 | this.newsSummary = contentDetailDTO.newsSummary | 70 | this.newsSummary = contentDetailDTO.newsSummary |
| 71 | + this.userInfo = contentDetailDTO.userInfo | ||
| 72 | + this.rmhInfo = contentDetailDTO.rmhInfo | ||
| 66 | if (contentDetailDTO.videoInfo?.length > 0) { | 73 | if (contentDetailDTO.videoInfo?.length > 0) { |
| 67 | this.url = contentDetailDTO.videoInfo[0].videoUrl | 74 | this.url = contentDetailDTO.videoInfo[0].videoUrl |
| 68 | this.videoLandScape = contentDetailDTO.videoInfo[0].videoLandScape | 75 | this.videoLandScape = contentDetailDTO.videoInfo[0].videoLandScape |
| 69 | } | 76 | } |
| 77 | + if (contentDetailDTO.authorList?.length > 0) { | ||
| 78 | + this.newsSourceName = contentDetailDTO.authorList[0].authorName | ||
| 79 | + } | ||
| 70 | this.canStart = true; | 80 | this.canStart = true; |
| 71 | this.message = ''; | 81 | this.message = ''; |
| 72 | }).catch((err: BusinessError) => { | 82 | }).catch((err: BusinessError) => { |
| 1 | import componentUtils from '@ohos.arkui.componentUtils'; | 1 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 2 | import { WDPlayerController } from '../controller/WDPlayerController' | 2 | import { WDPlayerController } from '../controller/WDPlayerController' |
| 3 | import { WindowModel } from 'wdKit'; | 3 | import { WindowModel } from 'wdKit'; |
| 4 | +import { Logger } from '../utils/Logger'; | ||
| 4 | 5 | ||
| 5 | class Size { | 6 | class Size { |
| 6 | width: Length = "100%"; | 7 | width: Length = "100%"; |
| @@ -13,6 +14,7 @@ class Size { | @@ -13,6 +14,7 @@ class Size { | ||
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | let insIndex: number = 0; | 16 | let insIndex: number = 0; |
| 17 | +const TAG = 'WDPlayerRenderView' | ||
| 16 | 18 | ||
| 17 | class MGPlayRenderViewIns { | 19 | class MGPlayRenderViewIns { |
| 18 | static intCount: number = 0; | 20 | static intCount: number = 0; |
| @@ -24,7 +26,7 @@ class MGPlayRenderViewIns { | @@ -24,7 +26,7 @@ class MGPlayRenderViewIns { | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | static del() { | 28 | static del() { |
| 27 | - console.log("add-- -1") | 29 | + console.log("del-- -1") |
| 28 | MGPlayRenderViewIns.intCount--; | 30 | MGPlayRenderViewIns.intCount--; |
| 29 | if (MGPlayRenderViewIns.intCount <= 0) { | 31 | if (MGPlayRenderViewIns.intCount <= 0) { |
| 30 | WindowModel.shared.setWindowKeepScreenOn(false); | 32 | WindowModel.shared.setWindowKeepScreenOn(false); |
| @@ -35,7 +37,6 @@ class MGPlayRenderViewIns { | @@ -35,7 +37,6 @@ class MGPlayRenderViewIns { | ||
| 35 | /** | 37 | /** |
| 36 | * 播放窗口组件 | 38 | * 播放窗口组件 |
| 37 | */ | 39 | */ |
| 38 | -@Entry | ||
| 39 | @Component | 40 | @Component |
| 40 | export struct WDPlayerRenderView { | 41 | export struct WDPlayerRenderView { |
| 41 | private playerController?: WDPlayerController; | 42 | private playerController?: WDPlayerController; |
| @@ -49,14 +50,15 @@ export struct WDPlayerRenderView { | @@ -49,14 +50,15 @@ export struct WDPlayerRenderView { | ||
| 49 | aboutToAppear() { | 50 | aboutToAppear() { |
| 50 | MGPlayRenderViewIns.add(); | 51 | MGPlayRenderViewIns.add(); |
| 51 | 52 | ||
| 53 | + console.log('playerController', this.playerController) | ||
| 52 | insIndex++; | 54 | insIndex++; |
| 53 | - | ||
| 54 | if (!this.playerController) { | 55 | if (!this.playerController) { |
| 55 | return | 56 | return |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | this.playerController.onVideoSizeChange = (width: number, height: number) => { | 59 | this.playerController.onVideoSizeChange = (width: number, height: number) => { |
| 59 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | 60 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) |
| 61 | + Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 60 | this.videoWidth = width; | 62 | this.videoWidth = width; |
| 61 | this.videoHeight = height; | 63 | this.videoHeight = height; |
| 62 | this.updateLayout() | 64 | this.updateLayout() |
| @@ -64,6 +66,7 @@ export struct WDPlayerRenderView { | @@ -64,6 +66,7 @@ export struct WDPlayerRenderView { | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | aboutToDisappear() { | 68 | aboutToDisappear() { |
| 69 | + Logger.info(TAG, `aboutToDisappear`) | ||
| 67 | MGPlayRenderViewIns.del(); | 70 | MGPlayRenderViewIns.del(); |
| 68 | } | 71 | } |
| 69 | 72 | ||
| @@ -76,6 +79,7 @@ export struct WDPlayerRenderView { | @@ -76,6 +79,7 @@ export struct WDPlayerRenderView { | ||
| 76 | controller: this.xComponentController | 79 | controller: this.xComponentController |
| 77 | }) | 80 | }) |
| 78 | .onLoad(async (event) => { | 81 | .onLoad(async (event) => { |
| 82 | + Logger.info(TAG, 'onLoad') | ||
| 79 | this.xComponentController.setXComponentSurfaceSize({ | 83 | this.xComponentController.setXComponentSurfaceSize({ |
| 80 | surfaceWidth: 1920, | 84 | surfaceWidth: 1920, |
| 81 | surfaceHeight: 1080 | 85 | surfaceHeight: 1080 |
-
Please register or login to post a comment