Showing
5 changed files
with
8 additions
and
4 deletions
| @@ -5,7 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil'; | @@ -5,7 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil'; | ||
| 5 | import { Message } from '../bean/Message'; | 5 | import { Message } from '../bean/Message'; |
| 6 | import { CallBackMessage } from '../bean/CallBackMessage'; | 6 | import { CallBackMessage } from '../bean/CallBackMessage'; |
| 7 | import { StringUtils } from '../utils/StringUtils'; | 7 | import { StringUtils } from '../utils/StringUtils'; |
| 8 | -import { hilog } from '@kit.PerformanceAnalysisKit'; | 8 | +import hilog from '@ohos.hilog'; |
| 9 | + | ||
| 10 | +// import { hilog } from '@kit.PerformanceAnalysisKit'; | ||
| 9 | 11 | ||
| 10 | const TAG = 'BridgeWebViewControl'; | 12 | const TAG = 'BridgeWebViewControl'; |
| 11 | 13 |
| @@ -8,7 +8,7 @@ export class NumberFormatterUtils { | @@ -8,7 +8,7 @@ export class NumberFormatterUtils { | ||
| 8 | */ | 8 | */ |
| 9 | static formatNumberWithWan(inputNumber: number | String): string { | 9 | static formatNumberWithWan(inputNumber: number | String): string { |
| 10 | const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber); | 10 | const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber); |
| 11 | - if (isNaN(num) || num < 10000) { | 11 | + if (Number.isNaN(num) || num < 10000) { |
| 12 | return num.toString(); | 12 | return num.toString(); |
| 13 | } else { | 13 | } else { |
| 14 | const wanUnit = num / 10000; | 14 | const wanUnit = num / 10000; |
| @@ -10,7 +10,7 @@ export class H5CallNativeType { | @@ -10,7 +10,7 @@ export class H5CallNativeType { | ||
| 10 | static jsCall_callAppService = 'jsCall_callAppService' | 10 | static jsCall_callAppService = 'jsCall_callAppService' |
| 11 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 11 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 12 | 12 | ||
| 13 | - static { | 13 | + static init() { |
| 14 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) | 14 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) |
| 15 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) | 15 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) |
| 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) | 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) |
| @@ -89,7 +89,7 @@ export struct WdWebComponent { | @@ -89,7 +89,7 @@ export struct WdWebComponent { | ||
| 89 | // },500) | 89 | // },500) |
| 90 | // }) | 90 | // }) |
| 91 | // this.onPageBegin(event?.url) | 91 | // this.onPageBegin(event?.url) |
| 92 | - this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36') | 92 | + // this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36') |
| 93 | }) | 93 | }) |
| 94 | .onLoadIntercept((event) => { | 94 | .onLoadIntercept((event) => { |
| 95 | let url: string = event.data.getRequestUrl().toString() | 95 | let url: string = event.data.getRequestUrl().toString() |
| @@ -75,6 +75,8 @@ export struct WdWebLocalComponent { | @@ -75,6 +75,8 @@ export struct WdWebLocalComponent { | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | private registerHandlers(): void { | 77 | private registerHandlers(): void { |
| 78 | + // TODO 待优化 | ||
| 79 | + H5CallNativeType.init(); | ||
| 78 | // 注册h5调用js相关 | 80 | // 注册h5调用js相关 |
| 79 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | 81 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { |
| 80 | let handleName = H5CallNativeType.JsCallTypeList[i]; | 82 | let handleName = H5CallNativeType.JsCallTypeList[i]; |
-
Please register or login to post a comment