Showing
6 changed files
with
259 additions
and
2 deletions
| @@ -22,3 +22,6 @@ export { ScreenType } from './src/main/ets/enum/ScreenType'; | @@ -22,3 +22,6 @@ export { ScreenType } from './src/main/ets/enum/ScreenType'; | ||
| 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; | 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; |
| 23 | 23 | ||
| 24 | export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; | 24 | export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; |
| 25 | + | ||
| 26 | +export { ContentConstants } from './src/main/ets/constants/ContentConstants'; | ||
| 27 | + |
| 1 | +export class ContentConstants { | ||
| 2 | + /* content#objectType,跳转类型:0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 */ | ||
| 3 | + /** | ||
| 4 | + * 0:不跳转 | ||
| 5 | + */ | ||
| 6 | + static readonly TYPE_NONE: string = "0"; | ||
| 7 | + /** | ||
| 8 | + * 1:点播 | ||
| 9 | + */ | ||
| 10 | + static readonly TYPE_VOD: string = "1"; | ||
| 11 | + /** | ||
| 12 | + * 2:直播 | ||
| 13 | + */ | ||
| 14 | + static readonly TYPE_LIVE: string = "2"; | ||
| 15 | + /** | ||
| 16 | + * 5:专题详情 | ||
| 17 | + */ | ||
| 18 | + static readonly TYPE_SPECIAL_TOPIC: string = "5"; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 6:链接 | ||
| 22 | + */ | ||
| 23 | + static readonly TYPE_LINK: string = "6"; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 8:图文详情,这里是h5页面 | ||
| 27 | + */ | ||
| 28 | + static readonly TYPE_TELETEXT: string = "8"; | ||
| 29 | + /** | ||
| 30 | + * 9:图集 | ||
| 31 | + */ | ||
| 32 | + static readonly TYPE_NINE: string = "9"; | ||
| 33 | + /** | ||
| 34 | + * 13:音频详情 | ||
| 35 | + */ | ||
| 36 | + static readonly TYPE_AUDIO: string = "13"; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 14:动态图文 | ||
| 40 | + */ | ||
| 41 | + static readonly TYPE_FOURTEEN: string = "14"; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 15:动态视频 | ||
| 45 | + */ | ||
| 46 | + static readonly TYPE_FIFTEEN: string = "15"; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +} |
| @@ -3,3 +3,5 @@ export { WDRouterRule } from './src/main/ets/router/WDRouterRule' | @@ -3,3 +3,5 @@ export { WDRouterRule } from './src/main/ets/router/WDRouterRule' | ||
| 3 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' | 3 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' |
| 4 | 4 | ||
| 5 | export { registerRouter } from './src/main/ets/router/Action2Page' | 5 | export { registerRouter } from './src/main/ets/router/Action2Page' |
| 6 | + | ||
| 7 | +export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "wdKit": "file:../wdKit", | 10 | "wdKit": "file:../wdKit", |
| 11 | "wdBean": "file:../../features/wdBean", | 11 | "wdBean": "file:../../features/wdBean", |
| 12 | - "wdNetwork": "file:../../commons/wdNetwork" | 12 | + "wdNetwork": "file:../../commons/wdNetwork", |
| 13 | + "wdConstant": "file:../../commons/wdConstant" | ||
| 13 | } | 14 | } |
| 14 | } | 15 | } |
| 1 | +import { Action, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | ||
| 5 | +import { WDRouterRule } from '../router/WDRouterRule'; | ||
| 6 | +import { ContentConstants } from 'wdConstant'; | ||
| 7 | +// import { LiveModel } from '../viewmodel/LiveModel'; | ||
| 8 | + | ||
| 9 | +const TAG = 'ProcessUtils'; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 页面跳转业务封装 | ||
| 13 | + */ | ||
| 14 | +export class ProcessUtils { | ||
| 15 | + /** | ||
| 16 | + * 页面跳转 | ||
| 17 | + */ | ||
| 18 | + static processPage(content: ContentDTO) { | ||
| 19 | + if (content == null) { | ||
| 20 | + Logger.error(TAG, "processPage, content is null"); | ||
| 21 | + return; | ||
| 22 | + } | ||
| 23 | + if (StringUtils.isEmpty(content.objectType)) { | ||
| 24 | + Logger.error(TAG, "processPage, objectType is empty"); | ||
| 25 | + return; | ||
| 26 | + } | ||
| 27 | + let type = content.objectType; | ||
| 28 | + console.log(TAG,'objectType',`${JSON.stringify(content)}`); | ||
| 29 | + switch (type) { | ||
| 30 | + case ContentConstants.TYPE_NONE: | ||
| 31 | + Logger.debug(TAG, "processPage, do nothing"); | ||
| 32 | + break; | ||
| 33 | + case ContentConstants.TYPE_VOD: | ||
| 34 | + Logger.debug(TAG, "processPage, nonsupport!!!"); | ||
| 35 | + ProcessUtils.gotoVod(content) | ||
| 36 | + break; | ||
| 37 | + case ContentConstants.TYPE_LIVE: | ||
| 38 | + ProcessUtils.gotoLive(content) | ||
| 39 | + break | ||
| 40 | + case ContentConstants.TYPE_AUDIO: | ||
| 41 | + ProcessUtils.gotoAudio(content) | ||
| 42 | + break; | ||
| 43 | + case ContentConstants.TYPE_TELETEXT: | ||
| 44 | + // 图文详情,跳转h5 | ||
| 45 | + ProcessUtils.gotoWeb(content); | ||
| 46 | + break; | ||
| 47 | + case ContentConstants.TYPE_LINK: | ||
| 48 | + ProcessUtils.gotoDefaultWeb(content); | ||
| 49 | + break; | ||
| 50 | + //图集详情页 | ||
| 51 | + case ContentConstants.TYPE_NINE: | ||
| 52 | + ProcessUtils.gotoAtlasDetailPage(content); | ||
| 53 | + break; | ||
| 54 | + case ContentConstants.TYPE_SPECIAL_TOPIC: | ||
| 55 | + // 专题详情,跳转h5 | ||
| 56 | + ProcessUtils.gotoSpecialTopic(content); | ||
| 57 | + break; | ||
| 58 | + //动态详情页(动态图文) | ||
| 59 | + case ContentConstants.TYPE_FOURTEEN: | ||
| 60 | + break; | ||
| 61 | + //动态详情页(动态视频) | ||
| 62 | + case ContentConstants.TYPE_FIFTEEN: | ||
| 63 | + ProcessUtils.gotoWeb(content); | ||
| 64 | + break; | ||
| 65 | + default: | ||
| 66 | + break; | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 动态详情页(动态视频/动态图片) | ||
| 72 | + * @param content | ||
| 73 | + * */ | ||
| 74 | + private static gotoDynamicDetailPage(content: ContentDTO) { | ||
| 75 | + let taskAction: Action = { | ||
| 76 | + type: 'JUMP_DETAIL_PAGE', | ||
| 77 | + params: { | ||
| 78 | + detailPageType: 14, | ||
| 79 | + contentID: content?.objectId, | ||
| 80 | + extra: { | ||
| 81 | + relType: content?.relType, | ||
| 82 | + relId: content?.relId, | ||
| 83 | + } as ExtraDTO | ||
| 84 | + } as Params, | ||
| 85 | + }; | ||
| 86 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 87 | + Logger.debug(TAG, `gotoDynamicDetailPage, ${content.objectId}`); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 图集详情页 | ||
| 92 | + * @param content | ||
| 93 | + * */ | ||
| 94 | + private static gotoAtlasDetailPage(content: ContentDTO) { | ||
| 95 | + let taskAction: Action = { | ||
| 96 | + type: 'JUMP_DETAIL_PAGE', | ||
| 97 | + params: { | ||
| 98 | + detailPageType: 17, | ||
| 99 | + contentID: content?.objectId, | ||
| 100 | + extra: { | ||
| 101 | + relType: content?.relType, | ||
| 102 | + relId: content?.relId, | ||
| 103 | + } as ExtraDTO | ||
| 104 | + } as Params, | ||
| 105 | + }; | ||
| 106 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 107 | + Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + private static gotoSpecialTopic(content: ContentDTO) { | ||
| 111 | + let taskAction: Action = { | ||
| 112 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 113 | + params: { | ||
| 114 | + url: content.linkUrl, | ||
| 115 | + pageID: 'SPACIAL_TOPIC_PAGE', | ||
| 116 | + } as Params, | ||
| 117 | + }; | ||
| 118 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + private static gotoDefaultWeb(content: ContentDTO) { | ||
| 122 | + let taskAction: Action = { | ||
| 123 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 124 | + params: { | ||
| 125 | + url: content.linkUrl, | ||
| 126 | + } as Params, | ||
| 127 | + }; | ||
| 128 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 129 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + private static gotoWeb(content: ContentDTO) { | ||
| 133 | + let taskAction: Action = { | ||
| 134 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 135 | + params: { | ||
| 136 | + contentID: content?.objectId, | ||
| 137 | + pageID: 'IMAGE_TEXT_DETAIL', | ||
| 138 | + extra: { | ||
| 139 | + relType: content?.relType, | ||
| 140 | + relId: content?.relId, | ||
| 141 | + channelId: content?.channelId, | ||
| 142 | + sourcePage: '5' | ||
| 143 | + } as ExtraDTO | ||
| 144 | + } as Params, | ||
| 145 | + }; | ||
| 146 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 147 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + private static gotoVod(content: ContentDTO) { | ||
| 151 | + let taskAction: Action = { | ||
| 152 | + type: 'JUMP_DETAIL_PAGE', | ||
| 153 | + params: { | ||
| 154 | + detailPageType: 7, | ||
| 155 | + contentID: content?.objectId, | ||
| 156 | + extra: { | ||
| 157 | + relType: content?.relType, | ||
| 158 | + relId: content?.relId, | ||
| 159 | + } as ExtraDTO | ||
| 160 | + } as Params, | ||
| 161 | + }; | ||
| 162 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 163 | + Logger.debug(TAG, `gotoVod, ${content.objectId}`); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + private static async gotoLive(content: ContentDTO) { | ||
| 167 | + // const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 168 | + // const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 169 | + // const liveState = liveDetail[0].liveInfo.liveState | ||
| 170 | + let taskAction: Action = { | ||
| 171 | + type: 'JUMP_DETAIL_PAGE', | ||
| 172 | + params: { | ||
| 173 | + detailPageType: 2, | ||
| 174 | + contentID: content?.objectId, | ||
| 175 | + // liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 176 | + liveStyle: 0 , | ||
| 177 | + extra: { | ||
| 178 | + relType: content?.relType, | ||
| 179 | + relId: content?.relId, | ||
| 180 | + } as ExtraDTO | ||
| 181 | + } as Params, | ||
| 182 | + }; | ||
| 183 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 184 | + Logger.debug(TAG, `gotoLive, ${content.objectId}`); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + private static gotoAudio(content: ContentDTO) { | ||
| 188 | + let taskAction: Action = { | ||
| 189 | + type: 'JUMP_DETAIL_PAGE', | ||
| 190 | + params: { | ||
| 191 | + detailPageType: 13, | ||
| 192 | + contentID: content?.objectId, | ||
| 193 | + extra: { | ||
| 194 | + relType: content?.relType, | ||
| 195 | + relId: content?.relId, | ||
| 196 | + } as ExtraDTO | ||
| 197 | + } as Params, | ||
| 198 | + }; | ||
| 199 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 200 | + Logger.debug(TAG, `gotoAudio, ${content.objectId}`); | ||
| 201 | + } | ||
| 202 | +} |
| @@ -7,7 +7,7 @@ import { performJSCallNative } from './JsBridgeBiz'; | @@ -7,7 +7,7 @@ import { performJSCallNative } from './JsBridgeBiz'; | ||
| 7 | import { H5CallNativeType } from './H5CallNativeType'; | 7 | import { H5CallNativeType } from './H5CallNativeType'; |
| 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 9 | 9 | ||
| 10 | -const TAG = 'WdWebLocalComponent'; | 10 | +const TAG = 'WdWebComponent'; |
| 11 | 11 | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebComponent { | 13 | export struct WdWebComponent { |
-
Please register or login to post a comment