Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
chenquansheng
2024-09-18 19:13:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
82909d12e0688e7f90c716b9298ce31139625702
82909d12
1 parent
be0f143b
fix |> 添加返回到稿件详情页刷新页面逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
2 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/EmitterEventId.ts
sight_harmony/commons/wdWebComponent/src/main/ets/pages/NativeCallH5Type.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
sight_harmony/products/phone/src/main/ets/pages/ImageAndTextDetailPage.ets
sight_harmony/commons/wdKit/src/main/ets/utils/EmitterEventId.ts
View file @
82909d1
...
...
@@ -49,5 +49,10 @@ export enum EmitterEventId {
// 全屏
FULL_SCREEN
=
14
,
// app页面显示
APP_PAGE_SHOW
=
102
,
// app页面隐藏
APP_PAGE_HIDDEN
=
103
,
}
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/NativeCallH5Type.ets
View file @
82909d1
export interface eventParams {
event: string;
}
export const enum NativeCallH5Event {
NativeCallH5EventPageWillAppear = '1',
NativeCallH5EventPageWillDisAppear = '2',
NativeCallH5EventAppWillEnterForeground = '3',
NativeCallH5EventAppEnterBackground = '4',
NativeCallH5EventAppPlayingAudio = '5',
NativeCallH5EventUpdateBrowseCount = '6',
NativeCallH5EventStartLoadingOnReuse = '7',
NativeCallH5EventNightModel = '9',
NativeCallH5EventFontSizesChange = '10',
NativeCallH5EventFollowEvent = '11',
NativeCallH5EventLikeEvent = '12'
}
/**
* native调用h5,事件id枚举
* app主动调用h5方法
*/
export const enum NativeCallH5Type {
jsCall_receiveAppData = 'jsCall_receiveAppData',
jsCall_appNotifyEvent = 'jsCall_appNotifyEvent',
// TODO 业务自行新增类型,自行调用,例:
// TODO this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,xxxx)
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
View file @
82909d1
...
...
@@ -4,8 +4,9 @@ import { Logger, WindowModel } from 'wdKit/Index';
import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { DateTimeUtils } from 'wdKit'
import { DateTimeUtils
,EmitterUtils,EmitterEventId
} from 'wdKit'
import { window } from '@kit.ArkUI';
import { NativeCallH5Type,NativeCallH5Event,eventParams } from './NativeCallH5Type';
const TAG = 'WdWebLocalComponent';
...
...
@@ -183,6 +184,7 @@ export struct WdWebLocalComponent {
private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
performJSCallNative(data, f)
}
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
...
...
@@ -228,6 +230,17 @@ export struct WdWebLocalComponent {
}
}
aboutToAppear(): void {
EmitterUtils.receiveEvent(EmitterEventId.APP_PAGE_SHOW, () => {
Logger.info(TAG, 'APP_PAGE_SHOW');
let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams;
let jsonString = JSON.stringify(params);
this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => {
Logger.debug(TAG, "from js data = " + data);
})
})
}
@Builder
videoComp(){
Video({
...
...
sight_harmony/products/phone/src/main/ets/pages/ImageAndTextDetailPage.ets
View file @
82909d1
import { Action } from 'wdBean';
import { ImageAndTextPageComponent } from 'wdComponent'
import { Logger } from 'wdKit'
import { Logger
,EmitterUtils,EmitterEventId
} from 'wdKit'
import router from '@ohos.router';
import { TrackConstants } from 'wdTracking/Index';
...
...
@@ -47,6 +47,7 @@ struct ImageAndTextDetailPage {
onPageShow() {
this.pageShow = Math.random()
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_PAGE_SHOW)
Logger.info(TAG, 'onPageShow');
}
...
...
Please
register
or
login
to post a comment