Showing
19 changed files
with
155 additions
and
170 deletions
| 1 | -import { Logger, NumberFormatterUtils } from 'wdKit'; | 1 | +import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit'; |
| 2 | import { | 2 | import { |
| 3 | Action, | 3 | Action, |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 15 | import router from '@ohos.router'; | 15 | import router from '@ohos.router'; |
| 16 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 17 | -import { CommonConstants } from 'wdConstant' | 17 | +import { CommonConstants } from 'wdConstant'; |
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 22 | -import { detailedSkeleton } from './skeleton/detailSkeleton' | 22 | +import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 23 | +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | ||
| 23 | 24 | ||
| 24 | const TAG = 'ImageAndTextPageComponent' | 25 | const TAG = 'ImageAndTextPageComponent' |
| 25 | - | ||
| 26 | @Component | 26 | @Component |
| 27 | export struct ImageAndTextPageComponent { | 27 | export struct ImageAndTextPageComponent { |
| 28 | scroller: Scroller = new Scroller(); | 28 | scroller: Scroller = new Scroller(); |
| @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { | @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { | ||
| 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | @State isPageEnd: boolean = false | 34 | @State isPageEnd: boolean = false |
| 35 | - | 35 | + @State publishTime: string = '' |
| 36 | build() { | 36 | build() { |
| 37 | Column() { | 37 | Column() { |
| 38 | if (!this.isPageEnd) { | 38 | if (!this.isPageEnd) { |
| @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { | @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { | ||
| 40 | } else { | 40 | } else { |
| 41 | // 发布时间 | 41 | // 发布时间 |
| 42 | Row() { | 42 | Row() { |
| 43 | - Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 44 | - .width(70) | 43 | + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) |
| 44 | + .width(80) | ||
| 45 | .height(28) | 45 | .height(28) |
| 46 | - Text(this.contentDetailData[0]?.publishTime) | 46 | + Text(this.publishTime) |
| 47 | .fontColor($r('app.color.color_B0B0B0')) | 47 | .fontColor($r('app.color.color_B0B0B0')) |
| 48 | .fontSize($r('app.float.font_size_13')) | 48 | .fontSize($r('app.float.font_size_13')) |
| 49 | .height('100%') | 49 | .height('100%') |
| @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { | @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { | ||
| 151 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 151 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 152 | if (detailBeans && detailBeans.length > 0) { | 152 | if (detailBeans && detailBeans.length > 0) { |
| 153 | this.contentDetailData = detailBeans; | 153 | this.contentDetailData = detailBeans; |
| 154 | + let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | ||
| 155 | + this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN) | ||
| 154 | if (this.contentDetailData[0]?.recommendShow === 1) { | 156 | if (this.contentDetailData[0]?.recommendShow === 1) { |
| 155 | this.getRecommend() | 157 | this.getRecommend() |
| 156 | } | 158 | } |
| @@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit'; | @@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit'; | ||
| 7 | import fs from '@ohos.file.fs'; | 7 | import fs from '@ohos.file.fs'; |
| 8 | 8 | ||
| 9 | const PERMISSIONS: Array<Permissions> = [ | 9 | const PERMISSIONS: Array<Permissions> = [ |
| 10 | - 'ohos.permission.READ_MEDIA', | ||
| 11 | - 'ohos.permission.WRITE_MEDIA' | 10 | + 'ohos.permission.READ_IMAGEVIDEO', |
| 11 | + 'ohos.permission.WRITE_IMAGEVIDEO' | ||
| 12 | ]; | 12 | ]; |
| 13 | 13 | ||
| 14 | +/* | ||
| 15 | + * saveButton参考文档 | ||
| 16 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677 | ||
| 17 | + * */ | ||
| 14 | @Component | 18 | @Component |
| 15 | export struct ImageDownloadComponent { | 19 | export struct ImageDownloadComponent { |
| 16 | @State image: PixelMap | undefined = undefined; | 20 | @State image: PixelMap | undefined = undefined; |
| @@ -20,12 +24,8 @@ export struct ImageDownloadComponent { | @@ -20,12 +24,8 @@ export struct ImageDownloadComponent { | ||
| 20 | 24 | ||
| 21 | build() { | 25 | build() { |
| 22 | Column() { | 26 | Column() { |
| 23 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 24 | - .width(24) | ||
| 25 | - .height(24) | ||
| 26 | - .aspectRatio(1) | ||
| 27 | - .interpolation(ImageInterpolation.High) | ||
| 28 | - .rotate({ angle: -90 }) | 27 | + SaveButton({ icon: SaveIconStyle.LINES }) |
| 28 | + .iconColor(Color.White) | ||
| 29 | .onClick(async () => { | 29 | .onClick(async () => { |
| 30 | console.info(`cj2024 onClick ${this.imageBuffer}`) | 30 | console.info(`cj2024 onClick ${this.imageBuffer}`) |
| 31 | if (this.imageBuffer !== undefined) { | 31 | if (this.imageBuffer !== undefined) { |
| @@ -15,7 +15,7 @@ export struct CardSourceInfo { | @@ -15,7 +15,7 @@ export struct CardSourceInfo { | ||
| 15 | .margin({ right: 2 }) | 15 | .margin({ right: 2 }) |
| 16 | } | 16 | } |
| 17 | if (this.contentDTO.rmhPlatform === 1) { | 17 | if (this.contentDTO.rmhPlatform === 1) { |
| 18 | - Text(this.contentDTO.rmhInfo.rmhName) | 18 | + Text(this.contentDTO.rmhInfo?.rmhName) |
| 19 | .fontSize($r("app.float.font_size_12")) | 19 | .fontSize($r("app.float.font_size_12")) |
| 20 | .fontColor($r("app.color.color_B0B0B0")) | 20 | .fontColor($r("app.color.color_B0B0B0")) |
| 21 | .maxLines(1) | 21 | .maxLines(1) |
| @@ -287,16 +287,6 @@ struct ChannelDialog { | @@ -287,16 +287,6 @@ struct ChannelDialog { | ||
| 287 | .height('100%') | 287 | .height('100%') |
| 288 | .justifyContent(FlexAlign.Center) | 288 | .justifyContent(FlexAlign.Center) |
| 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') | 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') |
| 290 | - .onClick(() => { | ||
| 291 | - if (this.isEditIng) { | ||
| 292 | - if (item.delPermitted === 1) { | ||
| 293 | - this.delChannelItem(index) | ||
| 294 | - } | ||
| 295 | - } else { | ||
| 296 | - this.confirm(index) | ||
| 297 | - this.controller?.close() | ||
| 298 | - } | ||
| 299 | - }) | ||
| 300 | } | 290 | } |
| 301 | .width('23%') | 291 | .width('23%') |
| 302 | .height(40) | 292 | .height(40) |
| @@ -307,31 +297,40 @@ struct ChannelDialog { | @@ -307,31 +297,40 @@ struct ChannelDialog { | ||
| 307 | }) | 297 | }) |
| 308 | .zIndex(this.dragItem == item.num ? 1 : 0) | 298 | .zIndex(this.dragItem == item.num ? 1 : 0) |
| 309 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) | 299 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) |
| 310 | - | ||
| 311 | .gesture( | 300 | .gesture( |
| 312 | - GestureGroup(GestureMode.Sequence, | ||
| 313 | - PanGesture({ fingers: 1, direction: null, distance: 0 }) | ||
| 314 | - .onActionStart((event: GestureEvent) => { | ||
| 315 | - this.dragItem = item.num | ||
| 316 | - this.dragRefOffsetX = 0 | ||
| 317 | - this.dragRefOffsetY = 0 | ||
| 318 | - }) | ||
| 319 | - .onActionUpdate((event: GestureEvent) => { | ||
| 320 | - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 321 | - this.handleAnimationTo(item, event) | ||
| 322 | - }) | ||
| 323 | - }) | ||
| 324 | - .onActionEnd((event: GestureEvent) => { | ||
| 325 | - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 326 | - this.dragItem = -1 | ||
| 327 | - this.offsetX = 0 | ||
| 328 | - this.offsetY = 0 | 301 | + GestureGroup(GestureMode.Sequence, |
| 302 | + TapGesture() | ||
| 303 | + .onAction((event?: GestureEvent) => { | ||
| 304 | + if (this.isEditIng) { | ||
| 305 | + if (item.delPermitted === 1) { | ||
| 306 | + this.delChannelItem(index) | ||
| 307 | + } | ||
| 308 | + } else { | ||
| 309 | + this.confirm(index) | ||
| 310 | + this.controller?.close() | ||
| 311 | + } | ||
| 312 | + }), | ||
| 313 | + PanGesture({ fingers: 1, direction: null, distance: 0 }) | ||
| 314 | + .onActionStart((event: GestureEvent) => { | ||
| 315 | + this.dragItem = item.num | ||
| 329 | this.dragRefOffsetX = 0 | 316 | this.dragRefOffsetX = 0 |
| 330 | this.dragRefOffsetY = 0 | 317 | this.dragRefOffsetY = 0 |
| 331 | }) | 318 | }) |
| 332 | - }) | ||
| 333 | - ) | ||
| 334 | - .onCancel(() => { | 319 | + .onActionUpdate((event: GestureEvent) => { |
| 320 | + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 321 | + this.handleAnimationTo(item, event) | ||
| 322 | + }) | ||
| 323 | + }) | ||
| 324 | + .onActionEnd((event: GestureEvent) => { | ||
| 325 | + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 326 | + this.dragItem = -1 | ||
| 327 | + this.offsetX = 0 | ||
| 328 | + this.offsetY = 0 | ||
| 329 | + this.dragRefOffsetX = 0 | ||
| 330 | + this.dragRefOffsetY = 0 | ||
| 331 | + }) | ||
| 332 | + }) | ||
| 333 | + ).onCancel(() => { | ||
| 335 | animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | 334 | animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { |
| 336 | this.dragItem = -1 | 335 | this.dragItem = -1 |
| 337 | this.offsetX = 0 | 336 | this.offsetX = 0 |
| @@ -339,8 +338,8 @@ struct ChannelDialog { | @@ -339,8 +338,8 @@ struct ChannelDialog { | ||
| 339 | this.dragRefOffsetX = 0 | 338 | this.dragRefOffsetX = 0 |
| 340 | this.dragRefOffsetY = 0 | 339 | this.dragRefOffsetY = 0 |
| 341 | }) | 340 | }) |
| 342 | - })) | ||
| 343 | - | 341 | + }) |
| 342 | + ) | ||
| 344 | }, (item: TopNavDTO) => JSON.stringify(item)) | 343 | }, (item: TopNavDTO) => JSON.stringify(item)) |
| 345 | } | 344 | } |
| 346 | .width('100%') | 345 | .width('100%') |
| @@ -66,15 +66,16 @@ struct MyCollectionListPage { | @@ -66,15 +66,16 @@ struct MyCollectionListPage { | ||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | if (this.isEditState){ | 68 | if (this.isEditState){ |
| 69 | - CustomBottomFuctionUI({ | ||
| 70 | - selectAllCallback:(isAllSelect)=>{ | ||
| 71 | - this.allSelectDatas(isAllSelect) | ||
| 72 | - }, | ||
| 73 | - confirmCallback:()=>{ | ||
| 74 | - this.deleteDatas() | ||
| 75 | - } | ||
| 76 | - }) | ||
| 77 | - .position({y:'92%'}) | 69 | + Stack(){ |
| 70 | + CustomBottomFuctionUI({ | ||
| 71 | + selectAllCallback:(isAllSelect)=>{ | ||
| 72 | + this.allSelectDatas(isAllSelect) | ||
| 73 | + }, | ||
| 74 | + confirmCallback:()=>{ | ||
| 75 | + this.deleteDatas() | ||
| 76 | + } | ||
| 77 | + }) | ||
| 78 | + }.position({y:'92%'}) | ||
| 78 | } | 79 | } |
| 79 | } | 80 | } |
| 80 | .width(CommonConstants.FULL_WIDTH) | 81 | .width(CommonConstants.FULL_WIDTH) |
| @@ -119,15 +120,21 @@ struct MyCollectionListPage { | @@ -119,15 +120,21 @@ struct MyCollectionListPage { | ||
| 119 | MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | 120 | MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { |
| 120 | if(resolve) resolve('刷新成功') | 121 | if(resolve) resolve('刷新成功') |
| 121 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 122 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 122 | - if (this.currentPage === 1) this.allDatas = [] | ||
| 123 | - this.allDatas = this.allDatas.concat(...collectionItem.list) | ||
| 124 | - if (collectionItem.totalCount === this.allDatas.length) { | 123 | + if (this.currentPage === 1) { |
| 124 | + this.allDatas = [] | ||
| 125 | + this.allDatas.push(...collectionItem.list) | ||
| 126 | + }else { | ||
| 127 | + this.allDatas = this.allDatas.concat(...collectionItem.list) | ||
| 128 | + } | ||
| 129 | + if (collectionItem.hasNext === 0) { | ||
| 125 | this.browSingModel.hasMore = false; | 130 | this.browSingModel.hasMore = false; |
| 126 | } else { | 131 | } else { |
| 127 | this.browSingModel.hasMore = true; | 132 | this.browSingModel.hasMore = true; |
| 128 | } | 133 | } |
| 129 | } else { | 134 | } else { |
| 130 | - this.browSingModel.viewType = ViewType.EMPTY; | 135 | + if (this.currentPage === 1) { |
| 136 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 137 | + } | ||
| 131 | } | 138 | } |
| 132 | }) | 139 | }) |
| 133 | } | 140 | } |
| 1 | import { CommonConstants } from 'wdConstant' | 1 | import { CommonConstants } from 'wdConstant' |
| 2 | -import { ContentDTO,CompDTO } from 'wdBean' | 2 | +import { ContentDTO, CompDTO } from 'wdBean' |
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | 6 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { |
| @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 59 | .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) | 60 | .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) |
| 60 | // .offset({x:16}) | 61 | // .offset({x:16}) |
| 61 | .onClick(() => { | 62 | .onClick(() => { |
| 62 | - if (item.objectType != '0') { | ||
| 63 | - console.log(item.objectId) | ||
| 64 | - } | 63 | + ProcessUtils.processPage(item) |
| 65 | }) | 64 | }) |
| 66 | }) | 65 | }) |
| 67 | 66 | ||
| 68 | }.listDirection(Axis.Horizontal) | 67 | }.listDirection(Axis.Horizontal) |
| 68 | + .scrollBar(BarState.Off) | ||
| 69 | .width('100%') | 69 | .width('100%') |
| 70 | 70 | ||
| 71 | // .backgroundColor($r("app.color.color_FE4B05")) | 71 | // .backgroundColor($r("app.color.color_FE4B05")) |
| @@ -16,6 +16,12 @@ export class ContentConstants { | @@ -16,6 +16,12 @@ export class ContentConstants { | ||
| 16 | * 5:专题详情 | 16 | * 5:专题详情 |
| 17 | */ | 17 | */ |
| 18 | static readonly TYPE_SPECIAL_TOPIC: string = "5"; | 18 | static readonly TYPE_SPECIAL_TOPIC: string = "5"; |
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 6:链接 | ||
| 22 | + */ | ||
| 23 | + static readonly TYPE_LINK: string = "6"; | ||
| 24 | + | ||
| 19 | /** | 25 | /** |
| 20 | * 8:图文详情,这里是h5页面 | 26 | * 8:图文详情,这里是h5页面 |
| 21 | */ | 27 | */ |
| @@ -43,6 +43,9 @@ export class ProcessUtils { | @@ -43,6 +43,9 @@ export class ProcessUtils { | ||
| 43 | // 图文详情,跳转h5 | 43 | // 图文详情,跳转h5 |
| 44 | ProcessUtils.gotoWeb(content); | 44 | ProcessUtils.gotoWeb(content); |
| 45 | break; | 45 | break; |
| 46 | + case ContentConstants.TYPE_LINK: | ||
| 47 | + ProcessUtils.gotoDefaultWeb(content); | ||
| 48 | + break; | ||
| 46 | //图集详情页 | 49 | //图集详情页 |
| 47 | case ContentConstants.TYPE_NINE: | 50 | case ContentConstants.TYPE_NINE: |
| 48 | ProcessUtils.gotoAtlasDetailPage(content); | 51 | ProcessUtils.gotoAtlasDetailPage(content); |
| @@ -53,6 +56,7 @@ export class ProcessUtils { | @@ -53,6 +56,7 @@ export class ProcessUtils { | ||
| 53 | break; | 56 | break; |
| 54 | //动态详情页(动态图文) | 57 | //动态详情页(动态图文) |
| 55 | case ContentConstants.TYPE_FOURTEEN: | 58 | case ContentConstants.TYPE_FOURTEEN: |
| 59 | + break; | ||
| 56 | //动态详情页(动态视频) | 60 | //动态详情页(动态视频) |
| 57 | case ContentConstants.TYPE_FIFTEEN: | 61 | case ContentConstants.TYPE_FIFTEEN: |
| 58 | ProcessUtils.gotoDynamicDetailPage(content); | 62 | ProcessUtils.gotoDynamicDetailPage(content); |
| @@ -113,6 +117,17 @@ export class ProcessUtils { | @@ -113,6 +117,17 @@ export class ProcessUtils { | ||
| 113 | WDRouterRule.jumpWithAction(taskAction) | 117 | WDRouterRule.jumpWithAction(taskAction) |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 120 | + private static gotoDefaultWeb(content: ContentDTO) { | ||
| 121 | + let taskAction: Action = { | ||
| 122 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 123 | + params: { | ||
| 124 | + url: content.linkUrl, | ||
| 125 | + } as Params, | ||
| 126 | + }; | ||
| 127 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 128 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | ||
| 129 | + } | ||
| 130 | + | ||
| 116 | private static gotoWeb(content: ContentDTO) { | 131 | private static gotoWeb(content: ContentDTO) { |
| 117 | // // topicId | 132 | // // topicId |
| 118 | // content.channelId; | 133 | // content.channelId; |
| @@ -19,7 +19,8 @@ export struct DetailPlayVLivePage { | @@ -19,7 +19,8 @@ export struct DetailPlayVLivePage { | ||
| 19 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 19 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 20 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean | 20 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean |
| 21 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean | 21 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean |
| 22 | - @Provide isMenuVisible: boolean = false | 22 | + @Provide isShowControl: boolean = false |
| 23 | + @Provide liveState: string = '' | ||
| 23 | @State relId: string = '' | 24 | @State relId: string = '' |
| 24 | @State contentId: string = '' | 25 | @State contentId: string = '' |
| 25 | @State relType: string = '' | 26 | @State relType: string = '' |
| @@ -52,7 +53,7 @@ export struct DetailPlayVLivePage { | @@ -52,7 +53,7 @@ export struct DetailPlayVLivePage { | ||
| 52 | playerController: this.playerController | 53 | playerController: this.playerController |
| 53 | }) | 54 | }) |
| 54 | .onClick(() => { | 55 | .onClick(() => { |
| 55 | - this.isMenuVisible = !this.isMenuVisible | 56 | + this.isShowControl = !this.isShowControl |
| 56 | }) | 57 | }) |
| 57 | 58 | ||
| 58 | PlayerInfoComponent({ | 59 | PlayerInfoComponent({ |
| @@ -79,16 +80,13 @@ export struct DetailPlayVLivePage { | @@ -79,16 +80,13 @@ export struct DetailPlayVLivePage { | ||
| 79 | .width('100%') | 80 | .width('100%') |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | - onPageShow(): void { | ||
| 83 | - | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | getLiveDetails() { | 83 | getLiveDetails() { |
| 87 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) | 84 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) |
| 88 | .then( | 85 | .then( |
| 89 | (data) => { | 86 | (data) => { |
| 90 | if (data.length > 0) { | 87 | if (data.length > 0) { |
| 91 | this.liveDetailsBean = data[0] | 88 | this.liveDetailsBean = data[0] |
| 89 | + this.liveState = this.liveDetailsBean.liveInfo?.liveState | ||
| 92 | console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) | 90 | console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) |
| 93 | } | 91 | } |
| 94 | }, | 92 | }, |
| @@ -6,6 +6,7 @@ import { NumberFormatterUtils } from 'wdKit/Index' | @@ -6,6 +6,7 @@ import { NumberFormatterUtils } from 'wdKit/Index' | ||
| 6 | export struct PlayerTitleComponent { | 6 | export struct PlayerTitleComponent { |
| 7 | @Consume liveDetailsBean: LiveDetailsBean | 7 | @Consume liveDetailsBean: LiveDetailsBean |
| 8 | @Consume liveRoomDataBean: LiveRoomDataBean | 8 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 9 | + @Consume liveState: string | ||
| 9 | 10 | ||
| 10 | build() { | 11 | build() { |
| 11 | Column() { | 12 | Column() { |
| @@ -38,8 +39,9 @@ export struct PlayerTitleComponent { | @@ -38,8 +39,9 @@ export struct PlayerTitleComponent { | ||
| 38 | Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') | 39 | Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') |
| 39 | .width(24) | 40 | .width(24) |
| 40 | .aspectRatio(1) | 41 | .aspectRatio(1) |
| 41 | - .borderRadius('50%') | 42 | + .borderRadius(12) |
| 42 | .fillColor(Color.Transparent) | 43 | .fillColor(Color.Transparent) |
| 44 | + | ||
| 43 | Text(this.liveDetailsBean.rmhInfo?.rmhName || '') | 45 | Text(this.liveDetailsBean.rmhInfo?.rmhName || '') |
| 44 | .fontSize(12) | 46 | .fontSize(12) |
| 45 | .fontWeight(500) | 47 | .fontWeight(500) |
| @@ -53,19 +55,20 @@ export struct PlayerTitleComponent { | @@ -53,19 +55,20 @@ export struct PlayerTitleComponent { | ||
| 53 | } | 55 | } |
| 54 | .backgroundColor('#4D000000') | 56 | .backgroundColor('#4D000000') |
| 55 | .borderRadius(2) | 57 | .borderRadius(2) |
| 58 | + .borderRadius({ topLeft: 12, bottomLeft: 12 }) | ||
| 56 | .margin({ right: 8 }) | 59 | .margin({ right: 8 }) |
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | 62 | ||
| 60 | Row() { | 63 | Row() { |
| 61 | - if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | 64 | + if (this.liveState == 'running') { |
| 62 | Image($r('app.media.icon_live_status_running')) | 65 | Image($r('app.media.icon_live_status_running')) |
| 63 | .width(22) | 66 | .width(22) |
| 64 | .height(18) | 67 | .height(18) |
| 65 | .margin({ right: 1 }) | 68 | .margin({ right: 1 }) |
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | - Text(this.liveDetailsBean.liveInfo?.liveState == 'running' ? '直播中' : '回看') | 71 | + Text(this.liveState == 'running' ? '直播中' : '回看') |
| 69 | .fontSize(11) | 72 | .fontSize(11) |
| 70 | .fontWeight(400) | 73 | .fontWeight(400) |
| 71 | .fontColor(Color.White) | 74 | .fontColor(Color.White) |
| @@ -79,6 +82,6 @@ export struct PlayerTitleComponent { | @@ -79,6 +82,6 @@ export struct PlayerTitleComponent { | ||
| 79 | } | 82 | } |
| 80 | .backgroundColor('#4D000000') | 83 | .backgroundColor('#4D000000') |
| 81 | .borderRadius(2) | 84 | .borderRadius(2) |
| 82 | - .padding(this.liveDetailsBean.liveInfo?.liveState == 'running' ? { left: 0, right: 4, top: 0, bottom: 0 } : 4) | 85 | + .padding(this.liveState == 'running' ? { left: 0, right: 4, top: 0, bottom: 0 } : 4) |
| 83 | } | 86 | } |
| 84 | } | 87 | } |
| @@ -6,13 +6,17 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | @@ -6,13 +6,17 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | ||
| 6 | @Component | 6 | @Component |
| 7 | export struct PlayerUIComponent { | 7 | export struct PlayerUIComponent { |
| 8 | private playerController?: WDPlayerController | 8 | private playerController?: WDPlayerController |
| 9 | + @Consume liveState: string | ||
| 9 | 10 | ||
| 10 | build() { | 11 | build() { |
| 11 | Column() { | 12 | Column() { |
| 12 | PlayerTitleComponent() | 13 | PlayerTitleComponent() |
| 13 | Blank() | 14 | Blank() |
| 14 | // PlayerCommentComponent().layoutWeight(1) | 15 | // PlayerCommentComponent().layoutWeight(1) |
| 15 | - PlayerVideoControlComponent({ playerController: this.playerController }) | 16 | + if (this.liveState === 'end') { |
| 17 | + PlayerVideoControlComponent({ playerController: this.playerController }) | ||
| 18 | + } | ||
| 19 | + | ||
| 16 | } | 20 | } |
| 17 | .height('100%') | 21 | .height('100%') |
| 18 | .width('100%') | 22 | .width('100%') |
| @@ -42,39 +42,36 @@ export struct PlayerVideoControlComponent { | @@ -42,39 +42,36 @@ export struct PlayerVideoControlComponent { | ||
| 42 | @Builder | 42 | @Builder |
| 43 | getBottomUIComponent() { | 43 | getBottomUIComponent() { |
| 44 | Row() { | 44 | Row() { |
| 45 | - if (this.liveDetailsBean?.liveInfo?.liveState == 'end') { | ||
| 46 | - this.playOrPauseBtn() | ||
| 47 | - Text(this.currentTime) | ||
| 48 | - .fontColor(Color.White) | ||
| 49 | - .fontWeight(600) | ||
| 50 | - .fontSize('12fp') | ||
| 51 | - .margin({ | ||
| 52 | - left: 16 | ||
| 53 | - }) | 45 | + this.playOrPauseBtn() |
| 46 | + Text(this.currentTime) | ||
| 47 | + .fontColor(Color.White) | ||
| 48 | + .fontWeight(600) | ||
| 49 | + .fontSize('12fp') | ||
| 50 | + .margin({ | ||
| 51 | + left: 16 | ||
| 52 | + }) | ||
| 54 | 53 | ||
| 55 | - this.playProgressView() | 54 | + this.playProgressView() |
| 56 | 55 | ||
| 57 | - Text(this.totalTime) | ||
| 58 | - .fontColor(Color.White) | ||
| 59 | - .fontWeight(600) | ||
| 60 | - .fontSize('12fp') | ||
| 61 | - .margin({ | ||
| 62 | - right: 16 | ||
| 63 | - }) | ||
| 64 | - } else { | ||
| 65 | - Blank() | ||
| 66 | - } | ||
| 67 | - Image($r('app.media.icon_live_player_full_screen')) | ||
| 68 | - .width(24) | ||
| 69 | - .height(24) | ||
| 70 | - .onClick(() => { | ||
| 71 | - this.isFullScreen = !this.isFullScreen | ||
| 72 | - WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 73 | - devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | 56 | + Text(this.totalTime) |
| 57 | + .fontColor(Color.White) | ||
| 58 | + .fontWeight(600) | ||
| 59 | + .fontSize('12fp') | ||
| 60 | + .margin({ | ||
| 61 | + right: 16 | ||
| 74 | }) | 62 | }) |
| 63 | + | ||
| 64 | + // Image($r('app.media.icon_live_player_full_screen')) | ||
| 65 | + // .width(24) | ||
| 66 | + // .height(24) | ||
| 67 | + // .onClick(() => { | ||
| 68 | + // this.isFullScreen = !this.isFullScreen | ||
| 69 | + // WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 70 | + // devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 71 | + // }) | ||
| 75 | } | 72 | } |
| 76 | .alignItems(VerticalAlign.Center) | 73 | .alignItems(VerticalAlign.Center) |
| 77 | - .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 74 | + // .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
| 78 | .width('100%') | 75 | .width('100%') |
| 79 | .padding({ | 76 | .padding({ |
| 80 | left: 10, | 77 | left: 10, |
| @@ -168,17 +168,15 @@ export struct DetailPlayShortVideoPage { | @@ -168,17 +168,15 @@ export struct DetailPlayShortVideoPage { | ||
| 168 | WDPlayerRenderView({ | 168 | WDPlayerRenderView({ |
| 169 | playerController: this.playerController, | 169 | playerController: this.playerController, |
| 170 | onLoad: async () => { | 170 | onLoad: async () => { |
| 171 | - // console.log('onload==', this.index) | ||
| 172 | - // if (this.index === 0) { | ||
| 173 | - | ||
| 174 | if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) { | 171 | if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) { |
| 175 | this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl); | 172 | this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl); |
| 176 | } | 173 | } |
| 177 | - // } | ||
| 178 | } | 174 | } |
| 179 | }) | 175 | }) |
| 180 | .height('100%') | 176 | .height('100%') |
| 181 | .width('100%') | 177 | .width('100%') |
| 178 | + .margin({ top: this.videoLandScape === 1 ? 218 : 0 }) | ||
| 179 | + .align(this.videoLandScape === 1 ? Alignment.Top : Alignment.Start) | ||
| 182 | .onClick(() => { | 180 | .onClick(() => { |
| 183 | console.error('WDPlayerRenderView=== onClick') | 181 | console.error('WDPlayerRenderView=== onClick') |
| 184 | this.playerController?.switchPlayOrPause(); | 182 | this.playerController?.switchPlayOrPause(); |
| @@ -195,14 +193,13 @@ export struct DetailPlayShortVideoPage { | @@ -195,14 +193,13 @@ export struct DetailPlayShortVideoPage { | ||
| 195 | 193 | ||
| 196 | @Builder | 194 | @Builder |
| 197 | detailContainerBuilder() { | 195 | detailContainerBuilder() { |
| 198 | - // DetailTabBarPageComponent({ pageId: this.pageId }).backgroundColor(Color.Black) | ||
| 199 | DetailContainer({ | 196 | DetailContainer({ |
| 200 | playerController: this.playerController | 197 | playerController: this.playerController |
| 201 | }) | 198 | }) |
| 202 | } | 199 | } |
| 203 | 200 | ||
| 204 | build() { | 201 | build() { |
| 205 | - Row() { | 202 | + Column() { |
| 206 | PlayerDetailContainer({ | 203 | PlayerDetailContainer({ |
| 207 | playerView: () => { | 204 | playerView: () => { |
| 208 | this.playerViewContainerBuilder() | 205 | this.playerViewContainerBuilder() |
| @@ -212,17 +209,8 @@ export struct DetailPlayShortVideoPage { | @@ -212,17 +209,8 @@ export struct DetailPlayShortVideoPage { | ||
| 212 | this.detailContainerBuilder() | 209 | this.detailContainerBuilder() |
| 213 | } | 210 | } |
| 214 | }) | 211 | }) |
| 215 | - .height('100%') | ||
| 216 | - .width('100%') | ||
| 217 | - .onClick(() => { | ||
| 218 | - console.error('PlayerDetailContainer=== onClick') | ||
| 219 | - this.playerController?.switchPlayOrPause(); | ||
| 220 | - }) | ||
| 221 | - } | ||
| 222 | - .height('100%') | 212 | + }.height('100%') |
| 223 | .width('100%') | 213 | .width('100%') |
| 224 | - .backgroundColor(Color.Black) | ||
| 225 | - // 扩展至所有非安全区域 | ||
| 226 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 214 | + |
| 227 | } | 215 | } |
| 228 | } | 216 | } |
| @@ -45,7 +45,7 @@ export struct DetailDialog { | @@ -45,7 +45,7 @@ export struct DetailDialog { | ||
| 45 | } | 45 | } |
| 46 | .width('100%') | 46 | .width('100%') |
| 47 | .alignItems(HorizontalAlign.Start) | 47 | .alignItems(HorizontalAlign.Start) |
| 48 | - .backgroundColor(Color.Gray) | 48 | + .backgroundColor('#80000000') |
| 49 | // .linearGradient({ | 49 | // .linearGradient({ |
| 50 | // direction: GradientDirection.Top, // 渐变方向 | 50 | // direction: GradientDirection.Top, // 渐变方向 |
| 51 | // repeating: false, // 渐变颜色是否重复 | 51 | // repeating: false, // 渐变颜色是否重复 |
| @@ -60,52 +60,14 @@ export struct PlayerDetailContainer { | @@ -60,52 +60,14 @@ export struct PlayerDetailContainer { | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | build() { | 62 | build() { |
| 63 | - RelativeContainer() { | ||
| 64 | - Row() { | ||
| 65 | - Stack() { | ||
| 66 | - Row() { | ||
| 67 | - this.playerView() | ||
| 68 | - } | ||
| 69 | - .height('100%') | ||
| 70 | - .width('100%') | ||
| 71 | - .zIndex(0) | ||
| 72 | - .margin({ top: this.videoLandScape === 1 ? 218 : 0 }) | ||
| 73 | - | ||
| 74 | - Row() { | ||
| 75 | - this.playControlView() | ||
| 76 | - } | ||
| 77 | - .height('100%') | ||
| 78 | - .width('100%') | ||
| 79 | - .zIndex(1) | ||
| 80 | - } | ||
| 81 | - .width('100%') | ||
| 82 | - .height('100%') | ||
| 83 | - // .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大 | ||
| 84 | - // .height(this.isFullScreen ? '100%' : this.buildVideoHeight()) | ||
| 85 | - // .margin({ top: this.isFullScreen ? 0 : this.buildVideoTo() }) | ||
| 86 | - // .margin({ bottom: this.isFullScreen ? 0 : this.buildVideoBottom() }) | ||
| 87 | - .alignRules({ | ||
| 88 | - top: { anchor: '__container__', align: VerticalAlign.Top }, | ||
| 89 | - // middle: { anchor: '__container__', align: HorizontalAlign.Center } | ||
| 90 | - }) | ||
| 91 | - .id('stk_player_container') | ||
| 92 | - }.height('100%').layoutWeight(1) | ||
| 93 | - | ||
| 94 | - if (this.isShowBottomView()) { | ||
| 95 | - Row() { | ||
| 96 | - this.detailView() | ||
| 97 | - } | ||
| 98 | - .width('100%') | ||
| 99 | - // .opacity(0.3) | ||
| 100 | - .alignRules({ | ||
| 101 | - bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 102 | - // middle: { anchor: '__container__', align: HorizontalAlign.Center } | ||
| 103 | - }) | ||
| 104 | - .id('row_bottomView') | ||
| 105 | - } | 63 | + Stack() { |
| 64 | + this.playerView() | ||
| 65 | + this.detailView() | ||
| 106 | } | 66 | } |
| 107 | .width('100%') | 67 | .width('100%') |
| 108 | .height('100%') | 68 | .height('100%') |
| 109 | 69 | ||
| 70 | + // .backgroundColor(Color.Black) // 扩展至所有非安全区域 | ||
| 71 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 110 | } | 72 | } |
| 111 | } | 73 | } |
| @@ -140,7 +140,11 @@ export struct PlayerTitleComment { | @@ -140,7 +140,11 @@ export struct PlayerTitleComment { | ||
| 140 | .width(48) | 140 | .width(48) |
| 141 | } | 141 | } |
| 142 | .width('100%') | 142 | .width('100%') |
| 143 | + .layoutWeight(1) | ||
| 143 | .alignItems(VerticalAlign.Bottom) | 144 | .alignItems(VerticalAlign.Bottom) |
| 145 | + .onClick(() => { | ||
| 146 | + this.playerController?.switchPlayOrPause() | ||
| 147 | + }) | ||
| 144 | 148 | ||
| 145 | Row() { | 149 | Row() { |
| 146 | Column() { | 150 | Column() { |
| @@ -194,9 +198,10 @@ export struct PlayerTitleComment { | @@ -194,9 +198,10 @@ export struct PlayerTitleComment { | ||
| 194 | }.backgroundColor(Color.Black) | 198 | }.backgroundColor(Color.Black) |
| 195 | 199 | ||
| 196 | } | 200 | } |
| 201 | + .height('100%') | ||
| 197 | .width('100%') | 202 | .width('100%') |
| 198 | - // .height('40%') | ||
| 199 | - .alignItems(HorizontalAlign.Start) | 203 | + .alignItems(HorizontalAlign.End) |
| 204 | + .align(Alignment.End) | ||
| 200 | .opacity(this.isOpen ? 0 : 1) | 205 | .opacity(this.isOpen ? 0 : 1) |
| 201 | .animation({ duration: 200 }) | 206 | .animation({ duration: 200 }) |
| 202 | } | 207 | } |
-
Please register or login to post a comment