Showing
21 changed files
with
536 additions
and
4 deletions
| @@ -73,6 +73,8 @@ export function registerRouter() { | @@ -73,6 +73,8 @@ export function registerRouter() { | ||
| 73 | return WDRouterPage.morningEveningPaperPage | 73 | return WDRouterPage.morningEveningPaperPage |
| 74 | } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL") { | 74 | } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL") { |
| 75 | return WDRouterPage.imageTextDetailPage | 75 | return WDRouterPage.imageTextDetailPage |
| 76 | + } else if (action.params?.pageID == "BroadcastPage") { | ||
| 77 | + return WDRouterPage.broadcastPage | ||
| 76 | } | 78 | } |
| 77 | return undefined | 79 | return undefined |
| 78 | }) | 80 | }) |
| @@ -83,4 +83,7 @@ export class WDRouterPage { | @@ -83,4 +83,7 @@ export class WDRouterPage { | ||
| 83 | 83 | ||
| 84 | 84 | ||
| 85 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 85 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 86 | + | ||
| 87 | + //播报页面 | ||
| 88 | + static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); | ||
| 86 | } | 89 | } |
| 1 | import { Group } from './Group'; | 1 | import { Group } from './Group'; |
| 2 | import { TopicInfo } from './TopicInfo'; | 2 | import { TopicInfo } from './TopicInfo'; |
| 3 | - | 3 | +import { ChannelInfo } from './ChannelInfo' |
| 4 | export interface PageInfoBean { | 4 | export interface PageInfoBean { |
| 5 | backIconUrl: string; | 5 | backIconUrl: string; |
| 6 | backgroundColor: string; | 6 | backgroundColor: string; |
| @@ -8,7 +8,7 @@ export interface PageInfoBean { | @@ -8,7 +8,7 @@ export interface PageInfoBean { | ||
| 8 | baselineColor: string; | 8 | baselineColor: string; |
| 9 | baselineCopywriting: string; | 9 | baselineCopywriting: string; |
| 10 | baselineShow: number; | 10 | baselineShow: number; |
| 11 | - // channelInfo?: any; | 11 | + channelInfo?: ChannelInfo; |
| 12 | // cornersAdv?: any; | 12 | // cornersAdv?: any; |
| 13 | // cornersAdv2: any[]; | 13 | // cornersAdv2: any[]; |
| 14 | description: string; | 14 | description: string; |
| @@ -55,3 +55,6 @@ export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayo | @@ -55,3 +55,6 @@ export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayo | ||
| 55 | export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" | 55 | export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" |
| 56 | 56 | ||
| 57 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" | 57 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" |
| 58 | + | ||
| 59 | +export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" | ||
| 60 | + |
sight_harmony/features/wdComponent/src/main/ets/components/broadcast/BroadcastPageComponent.ets
0 → 100644
| 1 | +import router from '@ohos.router'; | ||
| 2 | +import { Params } from 'wdBean' | ||
| 3 | +import { RecommendHeader } from './RecommendHeader'; | ||
| 4 | +import { RecommendTitle } from './RecommendTitle'; | ||
| 5 | +import { RecommendLists } from './RecommendLists' | ||
| 6 | +import { SelectedColumns } from './SelectedColumns' | ||
| 7 | +import { CompList, PageInfoBean, CompInfoBean } from 'wdBean'; | ||
| 8 | +import { DateTimeUtils, Logger } from 'wdKit/Index'; | ||
| 9 | +import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; | ||
| 10 | +import { BroadcastViewModel } from '../../viewmodel/BroadcastViewModel'; | ||
| 11 | +import { DateFormatUtil, PlayerConstants, WDPlayerController } from 'wdPlayer'; | ||
| 12 | +import { AudioDataList } from 'wdBean/src/main/ets/bean/morningevening/AudioDataList'; | ||
| 13 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 14 | + | ||
| 15 | +const TAG = 'BroadcastPageComponent'; | ||
| 16 | + | ||
| 17 | +@Entry | ||
| 18 | +@Component | ||
| 19 | +export struct BroadcastPageComponent { | ||
| 20 | + @State params:Params = router.getParams() as Params; | ||
| 21 | + | ||
| 22 | + @State pageInfoBean: PageInfoBean = {} as PageInfoBean // 播报页面信息 | ||
| 23 | + @State compInfoBean: CompInfoBean = {} as CompInfoBean // 组件信息 | ||
| 24 | + @State recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐播报组件信息 | ||
| 25 | + @State columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息 | ||
| 26 | + | ||
| 27 | + @State compListItem: CompList = {} as CompList | ||
| 28 | + @State audioPlayUrl: string = "" | ||
| 29 | + @Provide title: string = '' | ||
| 30 | + @Provide subTitle: string = '' | ||
| 31 | + @Provide isAudioPlaying: boolean = false | ||
| 32 | + @Provide status: number = PlayerConstants.STATUS_START; | ||
| 33 | + @Provide currentTime: string = "00:00"; | ||
| 34 | + @Provide totalTime: string = "00:00"; | ||
| 35 | + @Provide progressVal: number = 0; | ||
| 36 | + private audioDataList: AudioDataList[] = [] | ||
| 37 | + private playerController: WDPlayerController = new WDPlayerController(); | ||
| 38 | + simpleAudioDialog: CustomDialogController = new CustomDialogController({ | ||
| 39 | + builder: PaperReaderSimpleDialog({ | ||
| 40 | + cancel: this.onCancel, | ||
| 41 | + confirm: this.onConfirm, | ||
| 42 | + playerController: this.playerController | ||
| 43 | + }), | ||
| 44 | + autoCancel: false, | ||
| 45 | + customStyle: true, | ||
| 46 | + alignment: DialogAlignment.CenterStart, | ||
| 47 | + offset: { dx: 12, dy: -150 }, | ||
| 48 | + }) | ||
| 49 | + | ||
| 50 | + onCancel() { | ||
| 51 | + Logger.info(TAG, "cj2024 onCancel = ") | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 回调无用 | ||
| 56 | + **/ | ||
| 57 | + onConfirm() { | ||
| 58 | + Logger.info(TAG, "cj2024 onConfirm = ") | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + // 续播判断 | ||
| 62 | + changeContinue() { | ||
| 63 | + Logger.info(TAG, "cj2024 changeContinue = 1") | ||
| 64 | + this.playerController.continue = () => { | ||
| 65 | + Logger.info(TAG, "cj2024 changeContinue = 2") | ||
| 66 | + this.playerController?.stop(); | ||
| 67 | + } | ||
| 68 | + return; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + async aboutToAppear() { | ||
| 72 | + Logger.debug(TAG, `about1ToAppear`, router.getParams().toString()) | ||
| 73 | + const currentTime = new Date().getTime() | ||
| 74 | + try { | ||
| 75 | + // 获取页面信息 | ||
| 76 | + Logger.warn('获取页面信息') | ||
| 77 | + let pageInfoBean = await BroadcastViewModel.getBroadcastViewPageInfo('21003') | ||
| 78 | + Logger.warn('pageInfoBean-') | ||
| 79 | + Logger.warn(pageInfoBean.groups[0].blockDesc) | ||
| 80 | + | ||
| 81 | + this.pageInfoBean = pageInfoBean; | ||
| 82 | + //TODO 根据页面中组件信息。现在默认认为后端只返回2个。第一个是播报,第二个是精选栏目 | ||
| 83 | + const pageId = pageInfoBean.id, | ||
| 84 | + groupId_0 = pageInfoBean.groups[0]?.id, | ||
| 85 | + refreshTime = currentTime + "", | ||
| 86 | + topicId = pageInfoBean?.topicInfo?.topicId || '', | ||
| 87 | + channelId = pageInfoBean?.channelInfo?.channelId || '' | ||
| 88 | + if(pageInfoBean.groups[0]) { | ||
| 89 | + this.recommendCompInfoBean = await BroadcastViewModel.getBroadcastCompInfo(pageId, groupId_0, refreshTime, topicId, channelId) | ||
| 90 | + } | ||
| 91 | + if(pageInfoBean.groups[1]) { | ||
| 92 | + const groupId_1 = pageInfoBean.groups[1]?.id | ||
| 93 | + this.columnsCompInfoBean = await BroadcastViewModel.getBroadcastCompInfo(pageId, groupId_1, refreshTime, topicId, channelId) | ||
| 94 | + } | ||
| 95 | + } catch (exception) { | ||
| 96 | + | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + onPageShow() { | ||
| 100 | + Logger.debug(TAG, `onPageShow--`, JSON.stringify(router.getParams())) | ||
| 101 | + } | ||
| 102 | + onPageHide() { | ||
| 103 | + this.status = PlayerConstants.STATUS_PAUSE; | ||
| 104 | + this.playerController?.pause(); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + build() { | ||
| 108 | + Column() { | ||
| 109 | + // 顶部标题 | ||
| 110 | + RecommendHeader() | ||
| 111 | + List() { | ||
| 112 | + ListItem(){ | ||
| 113 | + RecommendTitle() | ||
| 114 | + } | ||
| 115 | + if(this.pageInfoBean.groups && this.pageInfoBean.groups[0] && this.recommendCompInfoBean.compList) { | ||
| 116 | + ListItem(){ | ||
| 117 | + RecommendLists({ | ||
| 118 | + recommendCompInfoBean: this.recommendCompInfoBean | ||
| 119 | + }) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + if(this.pageInfoBean.groups && this.pageInfoBean.groups[1] && this.columnsCompInfoBean.compList) { | ||
| 123 | + ListItem() { | ||
| 124 | + SelectedColumns({ | ||
| 125 | + columnsCompTitle: this.pageInfoBean.groups[1].blockDesc, | ||
| 126 | + columnsCompInfoBean: this.columnsCompInfoBean | ||
| 127 | + }) | ||
| 128 | + .margin({ top: 12 }) | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + .layoutWeight(1) | ||
| 133 | + // @ts-ignore | ||
| 134 | + .onScrollFrameBegin((offset, state) => { | ||
| 135 | + console.log('ccc',String(offset), state) | ||
| 136 | + }) | ||
| 137 | + .onReachStart(() => { | ||
| 138 | + console.log('onReachStart----->',) | ||
| 139 | + }) | ||
| 140 | + } | ||
| 141 | + .width(CommonConstants.FULL_WIDTH) | ||
| 142 | + .backgroundImage($r('app.media.broadcast_bg')) | ||
| 143 | + .backgroundImageSize({width: '100%', height: '100%'}) | ||
| 144 | + } | ||
| 145 | +} |
| 1 | +import router from '@ohos.router'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 今日推荐顶部标题--fixed标题 | ||
| 6 | + */ | ||
| 7 | +@Entry | ||
| 8 | +@Component | ||
| 9 | +export struct RecommendHeader { | ||
| 10 | + build() { | ||
| 11 | + Stack() { | ||
| 12 | + Image($r('app.media.icon_arrow_down_black')) | ||
| 13 | + .height($r('app.float.top_arrow_size')) | ||
| 14 | + .width($r('app.float.top_arrow_size')) | ||
| 15 | + .onClick((event: ClickEvent) => { | ||
| 16 | + router.back() | ||
| 17 | + }) | ||
| 18 | + .zIndex(1) | ||
| 19 | + Text('今日推荐') | ||
| 20 | + .margin({ left: 5 }) | ||
| 21 | + .fontSize($r('app.float.selected_text_size')) | ||
| 22 | + .fontColor($r('app.color.color_222222')) | ||
| 23 | + .width(CommonConstants.FULL_WIDTH) | ||
| 24 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 25 | + .textAlign(TextAlign.Center) | ||
| 26 | + } | ||
| 27 | + .height($r('app.float.top_bar_height')) | ||
| 28 | + .padding({left: 16, right: 16}) | ||
| 29 | + .alignContent(Alignment.Start) | ||
| 30 | + } | ||
| 31 | +} |
| 1 | +import { CompInfoBean, CompDTO } from 'wdBean' | ||
| 2 | +import { CommonConstants } from 'wdConstant'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 播报--今日推荐列表 | ||
| 7 | + */ | ||
| 8 | +@Entry | ||
| 9 | +@Component | ||
| 10 | +export struct RecommendLists { | ||
| 11 | + @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息 | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + Column(){ | ||
| 15 | + ForEach(this.recommendCompInfoBean.compList.slice(0,3), (item: CompDTO) => { | ||
| 16 | + this.recommendTop3Item(item) | ||
| 17 | + }) | ||
| 18 | + // 查看更多 | ||
| 19 | + if(this.recommendCompInfoBean.compList.length > 3) { | ||
| 20 | + Row() { | ||
| 21 | + Text("查看全部") | ||
| 22 | + .fontSize($r("app.float.font_size_12")) | ||
| 23 | + .fontColor($r("app.color.color_222222")) | ||
| 24 | + .margin({ right: 1 }) | ||
| 25 | + Image($r("app.media.more")) | ||
| 26 | + .width(14) | ||
| 27 | + .height(14) | ||
| 28 | + } | ||
| 29 | + .width(CommonConstants.FULL_WIDTH) | ||
| 30 | + .height(40) | ||
| 31 | + .borderRadius(3) | ||
| 32 | + .justifyContent(FlexAlign.Center) | ||
| 33 | + .margin({top: 5}) | ||
| 34 | + .onClick(() => { | ||
| 35 | + // console.log(1) | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + .margin({left: 16, right: 16}) | ||
| 40 | + .padding({left: 16, right: 16}) | ||
| 41 | + .backgroundColor($r('app.color.color_fff')) | ||
| 42 | + .borderRadius(5) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Builder | ||
| 46 | + recommendTop3Item(item: CompDTO) { | ||
| 47 | + Row(){ | ||
| 48 | + Image($r('app.media.broadcast_pause')) | ||
| 49 | + .width(24) | ||
| 50 | + .height(24) | ||
| 51 | + .margin({right:12}) | ||
| 52 | + Text(item.operDataList[0].newsTitle) | ||
| 53 | + .fontSize($r('app.float.font_size_16')) | ||
| 54 | + .fontColor($r('app.color.color_212228')) | ||
| 55 | + .maxLines(1) | ||
| 56 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 57 | + .layoutWeight(1) | ||
| 58 | + } | ||
| 59 | + .width(CommonConstants.FULL_WIDTH) | ||
| 60 | + .padding({top: 12, bottom: 12}) | ||
| 61 | + .onClick(() => { | ||
| 62 | + ProcessUtils.processPage(item.operDataList[0]) | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Builder | ||
| 67 | + recommendListItem() { | ||
| 68 | + | ||
| 69 | + } | ||
| 70 | +} |
| 1 | +import { CommonConstants } from 'wdConstant/Index' | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 播报标题描述 | ||
| 5 | + */ | ||
| 6 | +@Entry | ||
| 7 | +@Component | ||
| 8 | +export struct RecommendTitle { | ||
| 9 | + build() { | ||
| 10 | + Row(){ | ||
| 11 | + // 左边 | ||
| 12 | + Column(){ | ||
| 13 | + Text('每日最动听的声音') | ||
| 14 | + .fontSize($r('app.float.font_size_14')) | ||
| 15 | + .fontColor($r('app.color.color_222222')) | ||
| 16 | + .alignSelf(ItemAlign.Start) | ||
| 17 | + Image($r('app.media.broadcast_line')) | ||
| 18 | + .width(147) | ||
| 19 | + .margin({ | ||
| 20 | + top: 8, bottom: 8 | ||
| 21 | + }) | ||
| 22 | + Row(){ | ||
| 23 | + Column(){ | ||
| 24 | + Text('今推') | ||
| 25 | + .fontSize($r('app.float.font_size_24')) | ||
| 26 | + .fontColor($r('app.color.color_222222')) | ||
| 27 | + .fontWeight(600) | ||
| 28 | + Text('日荐') | ||
| 29 | + .fontSize($r('app.float.font_size_24')) | ||
| 30 | + .fontColor($r('app.color.color_222222')) | ||
| 31 | + .fontWeight(600) | ||
| 32 | + } | ||
| 33 | + .margin({right: 8}) | ||
| 34 | + .alignSelf(ItemAlign.Start) | ||
| 35 | + Column() { | ||
| 36 | + Text('正月二十八') | ||
| 37 | + .fontSize($r('app.float.font_size_14')) | ||
| 38 | + .fontColor($r('app.color.color_222222')) | ||
| 39 | + Text('02/28') | ||
| 40 | + .fontSize($r('app.float.font_size_24')) | ||
| 41 | + .fontColor($r('app.color.color_222222')) | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + .alignSelf(ItemAlign.Start) | ||
| 45 | + } | ||
| 46 | + Blank() | ||
| 47 | + Image($r('app.media.broadcast_pause')) | ||
| 48 | + .width(90) | ||
| 49 | + .height(90) | ||
| 50 | + .margin({ | ||
| 51 | + right: 9 | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + .width(CommonConstants.FULL_WIDTH) | ||
| 55 | + .padding({left: 16, right: 16}) | ||
| 56 | + .margin({bottom: 12}) | ||
| 57 | + } | ||
| 58 | +} |
| 1 | +import { CompInfoBean, CompDTO } from 'wdBean' | ||
| 2 | +import { DateTimeUtils } from 'wdKit/Index' | ||
| 3 | +import { CommonConstants } from 'wdConstant'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | +/** | ||
| 6 | + * 精选栏目 | ||
| 7 | + */ | ||
| 8 | +@Entry | ||
| 9 | +@Component | ||
| 10 | +export struct SelectedColumns { | ||
| 11 | + @Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息 | ||
| 12 | + @Prop columnsCompTitle: string = '' | ||
| 13 | + build() { | ||
| 14 | + Column(){ | ||
| 15 | + Text(this.columnsCompTitle) | ||
| 16 | + .fontSize($r('app.float.selected_text_size')) | ||
| 17 | + .fontColor($r('app.color.color_222222')) | ||
| 18 | + .fontWeight(500) | ||
| 19 | + .width(CommonConstants.FULL_WIDTH) | ||
| 20 | + ForEach(this.columnsCompInfoBean.compList, (item: CompDTO) => { | ||
| 21 | + this.SelectedColumnsItem(item) | ||
| 22 | + }) | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + .padding({left: 16,top: 12, right: 16}) | ||
| 26 | + .backgroundColor($r('app.color.white')) | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Builder | ||
| 30 | + SelectedColumnsItem(item: CompDTO) { | ||
| 31 | + Row() { | ||
| 32 | + Image(item.operDataList[0].coverUrl) | ||
| 33 | + .height(53) | ||
| 34 | + .width(80) | ||
| 35 | + .objectFit(ImageFit.Cover) | ||
| 36 | + .margin({right: 12}) | ||
| 37 | + Column({space: 4}){ | ||
| 38 | + Text(item.operDataList[0].newsTitle) | ||
| 39 | + .fontSize($r('app.float.font_size_16')) | ||
| 40 | + .fontColor($r('app.color.color_222222')) | ||
| 41 | + .width(CommonConstants.FULL_WIDTH) | ||
| 42 | + .maxLines(1) | ||
| 43 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 44 | + Text(item.operDataList[0].newsSummary) | ||
| 45 | + .fontSize($r('app.float.font_size_12')) | ||
| 46 | + .fontColor($r('app.color.color_999999')) | ||
| 47 | + .width(CommonConstants.FULL_WIDTH) | ||
| 48 | + .maxLines(1) | ||
| 49 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 50 | + Row(){ | ||
| 51 | + Image($r('app.media.broadcast_clock')) | ||
| 52 | + .width(12) | ||
| 53 | + .height(12) | ||
| 54 | + .margin({right: 4}) | ||
| 55 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.operDataList[0].publishTime))) | ||
| 56 | + .fontSize($r('app.float.font_size_12')) | ||
| 57 | + .fontColor($r('app.color.color_999999')) | ||
| 58 | + .margin({ right :24 }) | ||
| 59 | + Image($r('app.media.broadcast_listen')) | ||
| 60 | + .width(12) | ||
| 61 | + .height(12) | ||
| 62 | + .margin({right: 4}) | ||
| 63 | + Text('0') | ||
| 64 | + .fontSize($r('app.float.font_size_12')) | ||
| 65 | + .fontColor($r('app.color.color_999999')) | ||
| 66 | + .margin({ right :24}) | ||
| 67 | + } | ||
| 68 | + .width(CommonConstants.FULL_WIDTH) | ||
| 69 | + } | ||
| 70 | + .layoutWeight(1) | ||
| 71 | + } | ||
| 72 | + .onClick((event: ClickEvent) => { | ||
| 73 | + // TODO 跳转到音频专题页 | ||
| 74 | + }) | ||
| 75 | + .width(CommonConstants.FULL_WIDTH) | ||
| 76 | + .height(73) | ||
| 77 | + } | ||
| 78 | +} |
| @@ -213,4 +213,29 @@ export class PageRepository { | @@ -213,4 +213,29 @@ export class PageRepository { | ||
| 213 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 213 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 214 | return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers) | 214 | return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers) |
| 215 | }; | 215 | }; |
| 216 | -} | ||
| 216 | + | ||
| 217 | + /** | ||
| 218 | + * 获取播报pageInfo | ||
| 219 | + * */ | ||
| 220 | + static fetchBroadcastPageInfo(pageId: string) { | ||
| 221 | + let url = PageRepository.getMorningEveningPageInfoUrl(pageId) | ||
| 222 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 223 | + return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) | ||
| 224 | + }; | ||
| 225 | + | ||
| 226 | + /** | ||
| 227 | + * 获取播报compInfo | ||
| 228 | + * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/compInfo | ||
| 229 | + * @param params | ||
| 230 | + * @returns | ||
| 231 | + * */ | ||
| 232 | + static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: | ||
| 233 | + string, channelId: string) { | ||
| 234 | + HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV | ||
| 235 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; | ||
| 236 | + url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}` | ||
| 237 | + Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) | ||
| 238 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 239 | + return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers) | ||
| 240 | + }; | ||
| 241 | +} |
| 1 | +import { CompInfoBean, PageInfoBean } from 'wdBean/Index'; | ||
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 5 | + | ||
| 6 | +const TAG = 'BroadcastViewModel' | ||
| 7 | + | ||
| 8 | +export class BroadcastViewModel { | ||
| 9 | + static async getBroadcastViewPageInfo(pageId: string): Promise<PageInfoBean> { | ||
| 10 | + return new Promise<PageInfoBean>((success, error) => { | ||
| 11 | + Logger.info(TAG, `getBroadcastViewPageInfo pageInfo start`); | ||
| 12 | + PageRepository.fetchMorningEveningPageInfo(pageId).then((resDTO: ResponseDTO<PageInfoBean>) => { | ||
| 13 | + if (!resDTO || !resDTO.data) { | ||
| 14 | + Logger.error(TAG, 'getBroadcastViewPageInfo then navResDTO is empty'); | ||
| 15 | + error('resDTO is empty'); | ||
| 16 | + return | ||
| 17 | + } | ||
| 18 | + if (resDTO.code != 0) { | ||
| 19 | + Logger.error(TAG, `getBroadcastViewPageInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 20 | + error('resDTO Response Code is failure'); | ||
| 21 | + return | ||
| 22 | + } | ||
| 23 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 24 | + Logger.info(TAG, "getBroadcastViewPageInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 25 | + success(resDTO.data); | ||
| 26 | + }).catch((err: Error) => { | ||
| 27 | + Logger.error(TAG, `getBroadcastViewPageInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 28 | + error(err); | ||
| 29 | + }) | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + // 获取播报组件信息:https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/compInfo?topicId=& | ||
| 34 | + // channelStrategy=2&groupId=30113&refreshTime=1712023953772&pageSize=50&recommend=0&pageId=21003&loadStrategy=first_load&pageNum=1&channelId=2066 | ||
| 35 | + static async getBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, channelId: string): Promise<CompInfoBean> { | ||
| 36 | + return new Promise<CompInfoBean>((success, error) => { | ||
| 37 | + Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 38 | + PageRepository.fetchBroadcastCompInfo(pageId, groupId, refreshTime, topicId, channelId) | ||
| 39 | + .then((resDTO: ResponseDTO<CompInfoBean>) => { | ||
| 40 | + if (!resDTO || !resDTO.data) { | ||
| 41 | + Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty'); | ||
| 42 | + error('resDTO is empty'); | ||
| 43 | + return | ||
| 44 | + } | ||
| 45 | + if (resDTO.code != 0) { | ||
| 46 | + Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 47 | + error('resDTO Response Code is failure'); | ||
| 48 | + return | ||
| 49 | + } | ||
| 50 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 51 | + Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 52 | + success(resDTO.data); | ||
| 53 | + }) | ||
| 54 | + .catch((err: Error) => { | ||
| 55 | + Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 56 | + error(err); | ||
| 57 | + }) | ||
| 58 | + }) | ||
| 59 | + } | ||
| 60 | +} |
96.1 KB
1.74 KB
132 Bytes
1.39 KB
19.1 KB
19 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_arrow_down_black.png
0 → 100644
334 Bytes
| 1 | +import { BroadcastPageComponent } from 'wdComponent'; | ||
| 2 | +import { Logger } from 'wdKit'; | ||
| 3 | + | ||
| 4 | +const TAG = 'BroadcastPageComponent'; | ||
| 5 | + | ||
| 6 | +@Entry | ||
| 7 | +@Component | ||
| 8 | +struct BroadcastPage { | ||
| 9 | + build() { | ||
| 10 | + Column() { | ||
| 11 | + BroadcastPageComponent() | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + pageTransition() { | ||
| 16 | + // 定义页面进入时的效果,从底侧滑入 | ||
| 17 | + PageTransitionEnter({ type: RouteType.None, duration: 300 }) | ||
| 18 | + .slide(SlideEffect.Bottom) | ||
| 19 | + // 定义页面退出时的效果,向底侧滑出 | ||
| 20 | + PageTransitionExit({ type: RouteType.None, duration: 300 }) | ||
| 21 | + .slide(SlideEffect.Bottom) | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + aboutToAppear() { | ||
| 25 | + Logger.info(TAG, 'aboutToAppear'); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + aboutToDisappear() { | ||
| 29 | + Logger.info(TAG, 'aboutToDisappear'); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + onPageShow() { | ||
| 33 | + Logger.info(TAG, 'onPageShow'); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + onPageHide() { | ||
| 37 | + Logger.info(TAG, 'onPageHide'); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + onBackPress() { | ||
| 41 | + Logger.info(TAG, 'onBackPress'); | ||
| 42 | + } | ||
| 43 | +} |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | "pages/detail/MultiPictureDetailPage", | 9 | "pages/detail/MultiPictureDetailPage", |
| 10 | "pages/launchPage/PrivacyPage", | 10 | "pages/launchPage/PrivacyPage", |
| 11 | "pages/launchPage/LaunchPage", | 11 | "pages/launchPage/LaunchPage", |
| 12 | - "pages/launchPage/LaunchAdvertisingPage" | 12 | + "pages/launchPage/LaunchAdvertisingPage", |
| 13 | + "pages/broadcast/BroadcastPage" | ||
| 13 | ] | 14 | ] |
| 14 | } | 15 | } |
-
Please register or login to post a comment