Showing
2 changed files
with
22 additions
and
2 deletions
| @@ -26,7 +26,7 @@ export class ResourcesUtils { | @@ -26,7 +26,7 @@ export class ResourcesUtils { | ||
| 26 | try { | 26 | try { |
| 27 | let text = buffer.from(content).toString("utf8"); | 27 | let text = buffer.from(content).toString("utf8"); |
| 28 | if (text) { | 28 | if (text) { |
| 29 | - Logger.info(TAG, "getResourcesText then text:" + text); | 29 | + // Logger.info(TAG, "getResourcesText then text:" + text); |
| 30 | success(text); | 30 | success(text); |
| 31 | } else { | 31 | } else { |
| 32 | Logger.warn(TAG, "getResourcesText then text is empty"); | 32 | Logger.warn(TAG, "getResourcesText then text is empty"); |
| @@ -4,6 +4,8 @@ import { Logger } from 'wdKit'; | @@ -4,6 +4,8 @@ import { Logger } from 'wdKit'; | ||
| 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 5 | import { WDRouterRule } from '../router/WDRouterRule'; | 5 | import { WDRouterRule } from '../router/WDRouterRule'; |
| 6 | import { ContentConstants } from 'wdConstant'; | 6 | import { ContentConstants } from 'wdConstant'; |
| 7 | +import { common, Want } from '@kit.AbilityKit'; | ||
| 8 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 7 | 9 | ||
| 8 | // import { LiveModel } from '../viewmodel/LiveModel'; | 10 | // import { LiveModel } from '../viewmodel/LiveModel'; |
| 9 | 11 | ||
| @@ -213,4 +215,22 @@ export class ProcessUtils { | @@ -213,4 +215,22 @@ export class ProcessUtils { | ||
| 213 | WDRouterRule.jumpWithAction(taskAction) | 215 | WDRouterRule.jumpWithAction(taskAction) |
| 214 | Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | 216 | Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); |
| 215 | } | 217 | } |
| 216 | -} | ||
| 218 | +} | ||
| 219 | + /** | ||
| 220 | + * 打开外链 | ||
| 221 | + * @param url 外链地址 | ||
| 222 | + */ | ||
| 223 | + public static jumpExternalWebPage(url: string) { | ||
| 224 | + let context = getContext() as common.UIAbilityContext; | ||
| 225 | + let wantInfo: Want = { | ||
| 226 | + action: 'ohos.want.action.viewData', | ||
| 227 | + entities: ['entity.system.browsable'], | ||
| 228 | + uri: url | ||
| 229 | + } | ||
| 230 | + context.startAbility(wantInfo).then(() => { | ||
| 231 | + Logger.debug(TAG, 'jumpExternalWebPage success') | ||
| 232 | + }).catch((err: BusinessError) => { | ||
| 233 | + Logger.error(TAG, 'jumpExternalWebPage success, error: ' + JSON.stringify(err)) | ||
| 234 | + }) | ||
| 235 | + } | ||
| 236 | +} |
-
Please register or login to post a comment