Showing
8 changed files
with
243 additions
and
113 deletions
| @@ -16,6 +16,7 @@ interface dataObject { | @@ -16,6 +16,7 @@ interface dataObject { | ||
| 16 | operateType?: string | 16 | operateType?: string |
| 17 | webViewHeight?: string | 17 | webViewHeight?: string |
| 18 | dataJson?: string | 18 | dataJson?: string |
| 19 | + appInnerLink?: string | ||
| 19 | } | 20 | } |
| 20 | /** | 21 | /** |
| 21 | * 消息Message | 22 | * 消息Message |
| @@ -138,7 +138,7 @@ export class ProcessUtils { | @@ -138,7 +138,7 @@ export class ProcessUtils { | ||
| 138 | * 动态详情页(动态视频/动态图片) | 138 | * 动态详情页(动态视频/动态图片) |
| 139 | * @param content | 139 | * @param content |
| 140 | * */ | 140 | * */ |
| 141 | - private static gotoDynamicDetailPage(content: ContentDTO) { | 141 | + public static gotoDynamicDetailPage(content: ContentDTO) { |
| 142 | let taskAction: Action = { | 142 | let taskAction: Action = { |
| 143 | type: 'JUMP_DETAIL_PAGE', | 143 | type: 'JUMP_DETAIL_PAGE', |
| 144 | params: { | 144 | params: { |
| @@ -172,7 +172,7 @@ export class ProcessUtils { | @@ -172,7 +172,7 @@ export class ProcessUtils { | ||
| 172 | Logger.debug(TAG, `gotoMultiPictureListPage`); | 172 | Logger.debug(TAG, `gotoMultiPictureListPage`); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | - private static gotoSpecialTopic(content: ContentDTO) { | 175 | + public static gotoSpecialTopic(content: ContentDTO) { |
| 176 | let taskAction: Action = { | 176 | let taskAction: Action = { |
| 177 | type: 'JUMP_INNER_NEW_PAGE', | 177 | type: 'JUMP_INNER_NEW_PAGE', |
| 178 | params: { | 178 | params: { |
| @@ -183,7 +183,7 @@ export class ProcessUtils { | @@ -183,7 +183,7 @@ export class ProcessUtils { | ||
| 183 | WDRouterRule.jumpWithAction(taskAction) | 183 | WDRouterRule.jumpWithAction(taskAction) |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | - private static gotoDefaultWeb(content: ContentDTO) { | 186 | + public static gotoDefaultWeb(content: ContentDTO) { |
| 187 | let taskAction: Action = { | 187 | let taskAction: Action = { |
| 188 | type: 'JUMP_H5_BY_WEB_VIEW', | 188 | type: 'JUMP_H5_BY_WEB_VIEW', |
| 189 | params: { | 189 | params: { |
| @@ -212,7 +212,7 @@ export class ProcessUtils { | @@ -212,7 +212,7 @@ export class ProcessUtils { | ||
| 212 | Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`); | 212 | Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | - private static gotoWeb(content: ContentDTO) { | 215 | + public static gotoWeb(content: ContentDTO) { |
| 216 | let taskAction: Action = { | 216 | let taskAction: Action = { |
| 217 | type: 'JUMP_INNER_NEW_PAGE', | 217 | type: 'JUMP_INNER_NEW_PAGE', |
| 218 | params: { | 218 | params: { |
| @@ -231,7 +231,7 @@ export class ProcessUtils { | @@ -231,7 +231,7 @@ export class ProcessUtils { | ||
| 231 | Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | 231 | Logger.debug(TAG, `gotoWeb, ${content.objectId}`); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | - private static gotoVod(content: ContentDTO) { | 234 | + public static gotoVod(content: ContentDTO) { |
| 235 | let taskAction: Action = { | 235 | let taskAction: Action = { |
| 236 | type: 'JUMP_DETAIL_PAGE', | 236 | type: 'JUMP_DETAIL_PAGE', |
| 237 | params: { | 237 | params: { |
| @@ -247,7 +247,7 @@ export class ProcessUtils { | @@ -247,7 +247,7 @@ export class ProcessUtils { | ||
| 247 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); | 247 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | - private static async gotoLive(content: ContentDTO) { | 250 | + public static async gotoLive(content: ContentDTO) { |
| 251 | let taskAction: Action = { | 251 | let taskAction: Action = { |
| 252 | type: 'JUMP_DETAIL_PAGE', | 252 | type: 'JUMP_DETAIL_PAGE', |
| 253 | params: { | 253 | params: { |
| @@ -263,7 +263,7 @@ export class ProcessUtils { | @@ -263,7 +263,7 @@ export class ProcessUtils { | ||
| 263 | Logger.debug(TAG, `gotoLive, ${content.objectId}`); | 263 | Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | - private static gotoAudio(content: ContentDTO) { | 266 | + public static gotoAudio(content: ContentDTO) { |
| 267 | let taskAction: Action = { | 267 | let taskAction: Action = { |
| 268 | type: 'JUMP_DETAIL_PAGE', | 268 | type: 'JUMP_DETAIL_PAGE', |
| 269 | params: { | 269 | params: { |
| @@ -283,7 +283,7 @@ export class ProcessUtils { | @@ -283,7 +283,7 @@ export class ProcessUtils { | ||
| 283 | * 金刚位聚合页 | 283 | * 金刚位聚合页 |
| 284 | * @param content | 284 | * @param content |
| 285 | * */ | 285 | * */ |
| 286 | - private static gotoThemeListPage(content: ContentDTO) { | 286 | + public static gotoThemeListPage(content: ContentDTO) { |
| 287 | let taskAction: Action = { | 287 | let taskAction: Action = { |
| 288 | type: 'JUMP_DETAIL_PAGE', | 288 | type: 'JUMP_DETAIL_PAGE', |
| 289 | params: { | 289 | params: { |
| @@ -303,7 +303,7 @@ export class ProcessUtils { | @@ -303,7 +303,7 @@ export class ProcessUtils { | ||
| 303 | * 图片预览页 | 303 | * 图片预览页 |
| 304 | * @param content | 304 | * @param content |
| 305 | * */ | 305 | * */ |
| 306 | - private static gotoAtlasDetailPage(content: ContentDTO) { | 306 | + public static gotoAtlasDetailPage(content: ContentDTO) { |
| 307 | let taskAction: Action = { | 307 | let taskAction: Action = { |
| 308 | type: 'JUMP_DETAIL_PAGE', | 308 | type: 'JUMP_DETAIL_PAGE', |
| 309 | params: { | 309 | params: { |
| @@ -351,5 +351,43 @@ export class ProcessUtils { | @@ -351,5 +351,43 @@ export class ProcessUtils { | ||
| 351 | WDRouterRule.jumpWithAction(taskAction) | 351 | WDRouterRule.jumpWithAction(taskAction) |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | + /** | ||
| 355 | + * 打开早晚报 | ||
| 356 | + */ | ||
| 357 | + public static gotoMorningEveningPaper() { | ||
| 358 | + let taskAction: Action = { | ||
| 359 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 360 | + params: { | ||
| 361 | + pageID: 'MorningEveningPaper' | ||
| 362 | + } as Params, | ||
| 363 | + }; | ||
| 364 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + /** | ||
| 368 | + * 打开电子报 | ||
| 369 | + */ | ||
| 370 | + public static gotoENewsPaper() { | ||
| 371 | + let taskAction: Action = { | ||
| 372 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 373 | + params: { | ||
| 374 | + pageID: 'E_NEWSPAPER' | ||
| 375 | + } as Params, | ||
| 376 | + }; | ||
| 377 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 378 | + } | ||
| 354 | 379 | ||
| 380 | + /** | ||
| 381 | + * 打开播报 | ||
| 382 | + */ | ||
| 383 | + public static gotoBroadcastPage(pageId: number) { | ||
| 384 | + let taskAction: Action = { | ||
| 385 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 386 | + params: { | ||
| 387 | + pageID: 'BroadcastPage', | ||
| 388 | + id: pageId | ||
| 389 | + } as Params, | ||
| 390 | + }; | ||
| 391 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 392 | + } | ||
| 355 | } | 393 | } |
| 1 | +export class H5OperateType { | ||
| 2 | + /* jsCall_currentPageOperate#operateType | ||
| 3 | + 1、关闭页面 | ||
| 4 | + 2、页面reload, | ||
| 5 | + 3、返回上一级历史, | ||
| 6 | + 4、允许蜂窝网络播放视频 | ||
| 7 | + 5、邮件订阅关闭事件 | ||
| 8 | + 6、H5进入沉浸式播放 (android) | ||
| 9 | + 7、H5退出沉浸式播放(andriod) | ||
| 10 | + 8、WebView高度更新 | ||
| 11 | + 9、App播放视频 | ||
| 12 | + 10、H5开始播放音频 (处理音视频互斥问题) | ||
| 13 | + 12、关闭 App原生默认顶部导航,并通顶显示Webview (专题页使用) | ||
| 14 | + 13、显示 App原生默认顶部导航,支持返回按钮和标题显示(专题页使用,默认不用设置) | ||
| 15 | + 14、关闭 底部评论交互BAR (专题页使用,默认不用设置) | ||
| 16 | + 15、显示 底部评论交互BAR(专题页使用) | ||
| 17 | + 16、显示 顶导分享按钮(专题页使用,针对默认顶导情况) | ||
| 18 | + 17、关闭 顶导分享按钮(专题页使用,针对默认顶导情况) | ||
| 19 | + 18、设置页面标题 (专题页使用,针对默认顶导情况) | ||
| 20 | + 19、设置页面状态栏颜色(专题页使用,针对默认顶导情况) | ||
| 21 | + 20、设置页面底部蒙层效果显示(专题页使用,针对默认顶导情况) | ||
| 22 | + 21、设置页面底部蒙层效果 隐藏(专题页使用,针对默认顶导情况) | ||
| 23 | + 22、页面加载失败后重试操作 | ||
| 24 | + 23、开启H5自己的返回操作(默认关闭,当开启后 App返回/物理按键返回 都需要调用H5的返回方法,参见:jsCall_appNotifyEvent) | ||
| 25 | + 24、号主关注操作 状态更新 | ||
| 26 | + 30、关闭当前页面左滑事件 | ||
| 27 | + 31、打开当前页面左滑事件 | ||
| 28 | + 32、开始弹全局弹框事件(原生代码确保Webview底部到底) | ||
| 29 | + 33、结束全局弹框事件(原生代码确保Webview正常恢复) | ||
| 30 | + 40、抽奖 阅读、评论、点赞、关注等任务--跳首页 (默认) | ||
| 31 | + 41、抽奖 签到任务–-跳积分中心签到 | ||
| 32 | + 42、抽奖 意见反馈–跳意见反馈页面 | ||
| 33 | + 43、抽奖 关注号主任务–跳关注列表页 | ||
| 34 | + 44、抽奖 创作者认证 页面,H5 直接跳人民号申请页? | ||
| 35 | + 45、打开APP直接使用goBack(安卓使用,使用场景:h5页面跳转新页面,但url没有变化,不能返回上一级页面) | ||
| 36 | + 46、关闭APP直接使用goBack(安卓使用) | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | + // 1、关闭页面 | ||
| 40 | + static readonly TYPE_ONE: string = "1"; | ||
| 41 | +} |
| @@ -2,11 +2,22 @@ import { Callback } from 'wdJsBridge'; | @@ -2,11 +2,22 @@ import { Callback } from 'wdJsBridge'; | ||
| 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { H5CallNativeType } from './H5CallNativeType'; | 4 | import { H5CallNativeType } from './H5CallNativeType'; |
| 5 | -import { ContentDTO } from 'wdBean'; | ||
| 6 | -import { ProcessUtils } from 'wdRouter/src/main/ets/utils/ProcessUtils'; | 5 | +import { H5OperateType } from './H5OperateType'; |
| 6 | +import { ContentConstants } from 'wdConstant'; | ||
| 7 | +import { ProcessUtils } from 'wdRouter'; | ||
| 8 | +import router from '@ohos.router'; | ||
| 9 | +import Url from '@ohos.url' | ||
| 10 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 7 | 11 | ||
| 8 | const TAG = 'JsBridgeBiz' | 12 | const TAG = 'JsBridgeBiz' |
| 9 | 13 | ||
| 14 | +class AppInfo { | ||
| 15 | + plat: string = '' | ||
| 16 | + system: string = '' | ||
| 17 | + networkStatus: number = 1 | ||
| 18 | + // TODO 完善 | ||
| 19 | +} | ||
| 20 | + | ||
| 10 | /** | 21 | /** |
| 11 | * h5调用native代码 | 22 | * h5调用native代码 |
| 12 | * @param data | 23 | * @param data |
| @@ -17,6 +28,7 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -17,6 +28,7 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 17 | 28 | ||
| 18 | switch (data.handlerName) { | 29 | switch (data.handlerName) { |
| 19 | case H5CallNativeType.jsCall_currentPageOperate: | 30 | case H5CallNativeType.jsCall_currentPageOperate: |
| 31 | + handleJsCallCurrentPageOperate(data) | ||
| 20 | break; | 32 | break; |
| 21 | case H5CallNativeType.jsCall_getAppPublicInfo: | 33 | case H5CallNativeType.jsCall_getAppPublicInfo: |
| 22 | // h5获取app配置信息 | 34 | // h5获取app配置信息 |
| @@ -33,27 +45,25 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -33,27 +45,25 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 33 | case H5CallNativeType.jsCall_appInnerLinkMethod: | 45 | case H5CallNativeType.jsCall_appInnerLinkMethod: |
| 34 | handleJsCallAppInnerLinkMethod(data) | 46 | handleJsCallAppInnerLinkMethod(data) |
| 35 | break; | 47 | break; |
| 36 | - case 'changeNativeMessage': | ||
| 37 | - call("this is change Web Message") | ||
| 38 | - break; | ||
| 39 | default: | 48 | default: |
| 40 | - call("this is def value") | 49 | + break; |
| 41 | } | 50 | } |
| 42 | - | ||
| 43 | } | 51 | } |
| 44 | 52 | ||
| 45 | -class AppInfo { | ||
| 46 | - plat: string = '' | ||
| 47 | - system: string = '' | ||
| 48 | - networkStatus: number = 1 | ||
| 49 | - // TODO 完善 | 53 | +function handleJsCallCurrentPageOperate(data: Message) { |
| 54 | + switch (data?.data?.operateType) { | ||
| 55 | + case H5OperateType.TYPE_ONE: | ||
| 56 | + router.back() | ||
| 57 | + break; | ||
| 58 | + default: | ||
| 59 | + break; | ||
| 60 | + } | ||
| 50 | } | 61 | } |
| 51 | 62 | ||
| 52 | /** | 63 | /** |
| 53 | * 获取App公共信息 | 64 | * 获取App公共信息 |
| 54 | */ | 65 | */ |
| 55 | function getAppPublicInfo(): string { | 66 | function getAppPublicInfo(): string { |
| 56 | - | ||
| 57 | let info = new AppInfo() | 67 | let info = new AppInfo() |
| 58 | info.plat = 'Phone' | 68 | info.plat = 'Phone' |
| 59 | // 直接用Android,后续适配再新增鸿蒙 | 69 | // 直接用Android,后续适配再新增鸿蒙 |
| @@ -73,7 +83,6 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -73,7 +83,6 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 73 | } | 83 | } |
| 74 | break; | 84 | break; |
| 75 | default: | 85 | default: |
| 76 | - | ||
| 77 | break; | 86 | break; |
| 78 | } | 87 | } |
| 79 | } | 88 | } |
| @@ -83,5 +92,61 @@ function handleJsCallCallAppService(data: Message) { | @@ -83,5 +92,61 @@ function handleJsCallCallAppService(data: Message) { | ||
| 83 | } | 92 | } |
| 84 | 93 | ||
| 85 | function handleJsCallAppInnerLinkMethod(data: Message) { | 94 | function handleJsCallAppInnerLinkMethod(data: Message) { |
| 86 | -} | 95 | + let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); |
| 96 | + let urlParams = new Url.URLParams(urlObject.search); | ||
| 97 | + console.log('urlObject:', `${JSON.stringify(urlParams)}`) | ||
| 98 | + let content: ContentDTO = { | ||
| 99 | + objectId: urlParams.get('contentId') || '', | ||
| 100 | + relId: urlParams.get('relId') || '', | ||
| 101 | + relType: urlParams.get('relType') || '', | ||
| 102 | + pageId:urlParams.get('pageId') || '', | ||
| 103 | + objectType: '' | ||
| 104 | + } as ContentDTO | ||
| 105 | + if (urlParams.get('skipType') === '1') { | ||
| 87 | 106 | ||
| 107 | + switch (urlParams.get('type')) { | ||
| 108 | + case 'video': | ||
| 109 | + content.objectType = ContentConstants.TYPE_VOD | ||
| 110 | + ProcessUtils.processPage(content) | ||
| 111 | + break; | ||
| 112 | + case 'live': | ||
| 113 | + content.objectType = ContentConstants.TYPE_LIVE | ||
| 114 | + ProcessUtils.processPage(content) | ||
| 115 | + break; | ||
| 116 | + case 'article': | ||
| 117 | + content.objectType = ContentConstants.TYPE_TELETEXT | ||
| 118 | + ProcessUtils.processPage(content) | ||
| 119 | + break; | ||
| 120 | + case 'picture': | ||
| 121 | + content.objectType = ContentConstants.TYPE_NINE | ||
| 122 | + ProcessUtils.processPage(content) | ||
| 123 | + break; | ||
| 124 | + case 'audio': | ||
| 125 | + content.objectType = ContentConstants.TYPE_AUDIO | ||
| 126 | + ProcessUtils.processPage(content) | ||
| 127 | + break; | ||
| 128 | + case 'h5': | ||
| 129 | + content.objectType = ContentConstants.TYPE_LINK | ||
| 130 | + ProcessUtils.processPage(content) | ||
| 131 | + break; | ||
| 132 | + case 'topic': | ||
| 133 | + if(urlParams.get('subType') === 'h5'){ | ||
| 134 | + content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC | ||
| 135 | + ProcessUtils.processPage(content) | ||
| 136 | + } | ||
| 137 | + if(urlParams.get('subType') === 'moring_evening_news'){ | ||
| 138 | + ProcessUtils.gotoMorningEveningPaper() | ||
| 139 | + } | ||
| 140 | + if(urlParams.get('subType') === 'electronic_newspapers'){ | ||
| 141 | + ProcessUtils.gotoENewsPaper() | ||
| 142 | + } | ||
| 143 | + break; | ||
| 144 | + case 'dynamic': | ||
| 145 | + content.objectType = ContentConstants.TYPE_FOURTEEN | ||
| 146 | + ProcessUtils.processPage(content) | ||
| 147 | + break; | ||
| 148 | + default: | ||
| 149 | + break; | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | +} |
| @@ -20,9 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -20,9 +20,11 @@ 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 | + | ||
| 23 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 24 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 24 | 25 | ||
| 25 | const TAG = 'ImageAndTextPageComponent' | 26 | const TAG = 'ImageAndTextPageComponent' |
| 27 | + | ||
| 26 | @Component | 28 | @Component |
| 27 | export struct ImageAndTextPageComponent { | 29 | export struct ImageAndTextPageComponent { |
| 28 | scroller: Scroller = new Scroller(); | 30 | scroller: Scroller = new Scroller(); |
| @@ -33,39 +35,35 @@ export struct ImageAndTextPageComponent { | @@ -33,39 +35,35 @@ export struct ImageAndTextPageComponent { | ||
| 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 35 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | @State isPageEnd: boolean = false | 36 | @State isPageEnd: boolean = false |
| 35 | @State publishTime: string = '' | 37 | @State publishTime: string = '' |
| 38 | + | ||
| 36 | build() { | 39 | build() { |
| 37 | Column() { | 40 | Column() { |
| 38 | - if (!this.isPageEnd) { | ||
| 39 | - detailedSkeleton() | ||
| 40 | - } else { | ||
| 41 | - // 发布时间 | ||
| 42 | - Row() { | ||
| 43 | - Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 44 | - .width(80) | ||
| 45 | - .height(28) | ||
| 46 | - Text(this.publishTime) | ||
| 47 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 48 | - .fontSize($r('app.float.font_size_13')) | ||
| 49 | - .height('100%') | ||
| 50 | - .align(Alignment.End) | ||
| 51 | - } | ||
| 52 | - .width(CommonConstants.FULL_WIDTH) | ||
| 53 | - .height(32) | ||
| 54 | - .padding({ left: 15, right: 15, }) | ||
| 55 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 56 | - .backgroundColor(Color.White) | ||
| 57 | - | ||
| 58 | - Row() { | ||
| 59 | - Image($r('app.media.line')) | ||
| 60 | - .width('100%') | ||
| 61 | - .height(6) | ||
| 62 | - .objectFit(ImageFit.Cover) | ||
| 63 | - .margin({ top: 10 }) | ||
| 64 | - } | ||
| 65 | - .padding({ left: 15, right: 15 }) | ||
| 66 | - .backgroundColor(Color.White) | 41 | + // 发布时间 |
| 42 | + Row() { | ||
| 43 | + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 44 | + .width(80) | ||
| 45 | + .height(28) | ||
| 46 | + Text(this.publishTime) | ||
| 47 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 48 | + .fontSize($r('app.float.font_size_13')) | ||
| 49 | + .height('100%') | ||
| 50 | + .align(Alignment.End) | ||
| 67 | } | 51 | } |
| 52 | + .width(CommonConstants.FULL_WIDTH) | ||
| 53 | + .height(32) | ||
| 54 | + .padding({ left: 15, right: 15, }) | ||
| 55 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 56 | + .backgroundColor(Color.White) | ||
| 68 | 57 | ||
| 58 | + Row() { | ||
| 59 | + Image($r('app.media.line')) | ||
| 60 | + .width('100%') | ||
| 61 | + .height(6) | ||
| 62 | + .objectFit(ImageFit.Cover) | ||
| 63 | + .margin({ top: 10 }) | ||
| 64 | + } | ||
| 65 | + .padding({ left: 15, right: 15 }) | ||
| 66 | + .backgroundColor(Color.White) | ||
| 69 | 67 | ||
| 70 | Stack({ alignContent: Alignment.Bottom }) { | 68 | Stack({ alignContent: Alignment.Bottom }) { |
| 71 | Scroll(this.scroller) { | 69 | Scroll(this.scroller) { |
| @@ -88,6 +86,10 @@ export struct ImageAndTextPageComponent { | @@ -88,6 +86,10 @@ export struct ImageAndTextPageComponent { | ||
| 88 | .padding({ bottom: 76 }) | 86 | .padding({ bottom: 76 }) |
| 89 | .scrollBar(BarState.Off) | 87 | .scrollBar(BarState.Off) |
| 90 | 88 | ||
| 89 | + if (!this.isPageEnd) { | ||
| 90 | + detailedSkeleton() | ||
| 91 | + } | ||
| 92 | + | ||
| 91 | //底部交互区 | 93 | //底部交互区 |
| 92 | Row() { | 94 | Row() { |
| 93 | Image($r('app.media.icon_arrow_left')) | 95 | Image($r('app.media.icon_arrow_left')) |
| @@ -126,6 +128,7 @@ export struct ImageAndTextPageComponent { | @@ -126,6 +128,7 @@ export struct ImageAndTextPageComponent { | ||
| 126 | .justifyContent(FlexAlign.SpaceBetween) | 128 | .justifyContent(FlexAlign.SpaceBetween) |
| 127 | .backgroundColor(Color.White) | 129 | .backgroundColor(Color.White) |
| 128 | } | 130 | } |
| 131 | + | ||
| 129 | } | 132 | } |
| 130 | .width(CommonConstants.FULL_WIDTH) | 133 | .width(CommonConstants.FULL_WIDTH) |
| 131 | .height(CommonConstants.FULL_HEIGHT) | 134 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -152,7 +155,7 @@ export struct ImageAndTextPageComponent { | @@ -152,7 +155,7 @@ export struct ImageAndTextPageComponent { | ||
| 152 | if (detailBeans && detailBeans.length > 0) { | 155 | if (detailBeans && detailBeans.length > 0) { |
| 153 | this.contentDetailData = detailBeans; | 156 | this.contentDetailData = detailBeans; |
| 154 | let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | 157 | let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); |
| 155 | - this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN) | 158 | + this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 156 | if (this.contentDetailData[0]?.recommendShow === 1) { | 159 | if (this.contentDetailData[0]?.recommendShow === 1) { |
| 157 | this.getRecommend() | 160 | this.getRecommend() |
| 158 | } | 161 | } |
| 1 | import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; | 1 | import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; |
| 2 | import { LazyDataSource, Logger } from 'wdKit'; | 2 | import { LazyDataSource, Logger } from 'wdKit'; |
| 3 | -import { WDRouterRule } from 'wdRouter'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { PageComponent } from './PageComponent'; | 4 | import { PageComponent } from './PageComponent'; |
| 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; |
| 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; |
| @@ -135,16 +135,6 @@ export struct TopNavigationComponent { | @@ -135,16 +135,6 @@ export struct TopNavigationComponent { | ||
| 135 | return item.name === '版面' | 135 | return item.name === '版面' |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | - jumpToENewPaper() { | ||
| 139 | - let taskAction: Action = { | ||
| 140 | - type: 'JUMP_INNER_NEW_PAGE', | ||
| 141 | - params: { | ||
| 142 | - pageID: 'E_NEWSPAPER' | ||
| 143 | - } as Params, | ||
| 144 | - }; | ||
| 145 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | build() { | 138 | build() { |
| 149 | Column() { | 139 | Column() { |
| 150 | // 顶部搜索、日报logo、早晚报 | 140 | // 顶部搜索、日报logo、早晚报 |
| @@ -156,7 +146,7 @@ export struct TopNavigationComponent { | @@ -156,7 +146,7 @@ export struct TopNavigationComponent { | ||
| 156 | .width(72) | 146 | .width(72) |
| 157 | .height(29) | 147 | .height(29) |
| 158 | .onClick(() => { | 148 | .onClick(() => { |
| 159 | - this.jumpToENewPaper() | 149 | + ProcessUtils.gotoENewsPaper() |
| 160 | }) | 150 | }) |
| 161 | Stack({ alignContent: Alignment.Center }) { | 151 | Stack({ alignContent: Alignment.Center }) { |
| 162 | Image($r('app.media.background_read_paper_home')) | 152 | Image($r('app.media.background_read_paper_home')) |
| @@ -177,13 +167,7 @@ export struct TopNavigationComponent { | @@ -177,13 +167,7 @@ export struct TopNavigationComponent { | ||
| 177 | .height(30) | 167 | .height(30) |
| 178 | .width(124) | 168 | .width(124) |
| 179 | .onClick(() => { | 169 | .onClick(() => { |
| 180 | - let taskAction: Action = { | ||
| 181 | - type: 'JUMP_INNER_NEW_PAGE', | ||
| 182 | - params: { | ||
| 183 | - pageID: 'MorningEveningPaper' | ||
| 184 | - } as Params, | ||
| 185 | - }; | ||
| 186 | - WDRouterRule.jumpWithAction(taskAction) | 170 | + ProcessUtils.gotoMorningEveningPaper() |
| 187 | }) | 171 | }) |
| 188 | }.width('100%') | 172 | }.width('100%') |
| 189 | .justifyContent(FlexAlign.SpaceBetween) | 173 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -236,18 +220,11 @@ export struct TopNavigationComponent { | @@ -236,18 +220,11 @@ export struct TopNavigationComponent { | ||
| 236 | } | 220 | } |
| 237 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | 221 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { |
| 238 | // 跳转到播报页面 | 222 | // 跳转到播报页面 |
| 239 | - let taskAction: Action = { | ||
| 240 | - type: 'JUMP_INNER_NEW_PAGE', | ||
| 241 | - params: { | ||
| 242 | - pageID: 'BroadcastPage', | ||
| 243 | - id: this.myChannelList[index].pageId | ||
| 244 | - } as Params, | ||
| 245 | - }; | ||
| 246 | - WDRouterRule.jumpWithAction(taskAction) | 223 | + ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) |
| 247 | this.tabsController.changeIndex(this.currentTopNavSelectedIndex) | 224 | this.tabsController.changeIndex(this.currentTopNavSelectedIndex) |
| 248 | } | 225 | } |
| 249 | if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | 226 | if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { |
| 250 | - this.jumpToENewPaper() | 227 | + ProcessUtils.gotoENewsPaper() |
| 251 | this.tabsController.changeIndex(this.currentTopNavSelectedIndex) | 228 | this.tabsController.changeIndex(this.currentTopNavSelectedIndex) |
| 252 | } | 229 | } |
| 253 | }) | 230 | }) |
| @@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
| 15 | "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", | 15 | "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", |
| 16 | "wdRouter": "file:../../commons/wdRouter", | 16 | "wdRouter": "file:../../commons/wdRouter", |
| 17 | "wdNetwork": "file:../../commons/wdNetwork", | 17 | "wdNetwork": "file:../../commons/wdNetwork", |
| 18 | - "wdHwAbility": "file:../../features/wdHwAbility" | 18 | + "wdHwAbility": "file:../../features/wdHwAbility", |
| 19 | + "wdJsBridge": "file:../../commons/wdJsBridge" | ||
| 19 | } | 20 | } |
| 20 | } | 21 | } |
| 1 | -import router from '@ohos.router'; | ||
| 2 | import { Action } from 'wdBean'; | 1 | import { Action } from 'wdBean'; |
| 3 | -import { Logger } from 'wdKit'; | ||
| 4 | import { WdWebComponent } from 'wdWebComponent'; | 2 | import { WdWebComponent } from 'wdWebComponent'; |
| 5 | - | ||
| 6 | -const TAG = 'DefaultWebPage'; | ||
| 7 | - | 3 | +import router from '@ohos.router'; |
| 4 | +import { CommonConstants } from 'wdConstant' | ||
| 5 | +import { BridgeWebViewControl } from 'wdJsBridge'; | ||
| 6 | +import { detailedSkeleton } from 'wdComponent/src/main/ets/components/skeleton/detailSkeleton' | ||
| 7 | +const TAG = 'DefaultWebPage' | ||
| 8 | @Entry | 8 | @Entry |
| 9 | @Component | 9 | @Component |
| 10 | struct DefaultWebPage { | 10 | struct DefaultWebPage { |
| 11 | - private url?: string; | ||
| 12 | - @State reload: number = 0; | ||
| 13 | - @State isPageEnd : boolean = false | ||
| 14 | - aboutToAppear() { | ||
| 15 | - let action: Action = router.getParams() as Action | ||
| 16 | - if (action) { | ||
| 17 | - this.url = action.params?.url | ||
| 18 | - } | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - onPageShow() { | ||
| 22 | - Logger.info(TAG, `DefaultWebPage# onPageShow:::refresh`); | ||
| 23 | - this.reload = ++this.reload | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - onPageHide() { | ||
| 27 | - this.reload = 0 | ||
| 28 | - } | 11 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 12 | + scroller: Scroller = new Scroller(); | ||
| 13 | + action: Action = {} as Action | ||
| 14 | + @State webUrl: string = ''; | ||
| 15 | + @State isPageEnd: boolean = false | ||
| 29 | 16 | ||
| 30 | build() { | 17 | build() { |
| 31 | Column() { | 18 | Column() { |
| 32 | - WdWebComponent({ | ||
| 33 | - webUrl: this.url, | ||
| 34 | - backVisibility: false, | ||
| 35 | - // reload: this.reload, | ||
| 36 | - isPageEnd:$isPageEnd | ||
| 37 | - }) | 19 | + if (!this.isPageEnd) { |
| 20 | + detailedSkeleton() | ||
| 21 | + } | ||
| 22 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 23 | + Column() { | ||
| 24 | + WdWebComponent({ | ||
| 25 | + webviewControl: this.webviewControl, | ||
| 26 | + webUrl: this.webUrl, | ||
| 27 | + backVisibility: false, | ||
| 28 | + isPageEnd: $isPageEnd | ||
| 29 | + }) | ||
| 30 | + } | ||
| 31 | + .padding({ bottom: 56 }) | ||
| 32 | + .width(CommonConstants.FULL_WIDTH) | ||
| 33 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 34 | + } | ||
| 35 | + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + aboutToAppear() { | ||
| 39 | + let action: Action = router.getParams() as Action | ||
| 40 | + if (action) { | ||
| 41 | + this.webUrl = action.params?.url || '' | ||
| 38 | } | 42 | } |
| 39 | } | 43 | } |
| 40 | -} | 44 | +} |
-
Please register or login to post a comment