From e04bc02e9db07ed3fc5fef5188e842e1d74aa1b2 Mon Sep 17 00:00:00 2001 From: rex <1491721419@qq.com> Date: Mon, 13 Oct 2025 19:03:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?PerformanceAnalysis=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/components/ContinueModel.ts | 4 +-- .../main/ets/entryability/EntryAbility.ets | 2 +- .../entry/src/main/ets/pages/MainPage.ets | 35 ++++++++++++++++--- .../resources/base/profile/main_pages.json | 4 ++- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/ContinueModel.ts b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/ContinueModel.ts index d729aac5..0c30199d 100644 --- a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/ContinueModel.ts +++ b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/ContinueModel.ts @@ -46,12 +46,12 @@ export class ContinueModel { private initFromStorage(): void { try { - const savedTabIndex = AppStorage.get('mainTabIndex'); + const savedTabIndex: number = AppStorage.get('mainTabIndex'); if (savedTabIndex !== undefined) { this.data.mainTabIndex = Number(savedTabIndex); } - const darkMode = AppStorage.get('darkMode'); + const darkMode: boolean = AppStorage.get('darkMode'); if (darkMode !== undefined) { this.data.userPreferences.darkMode = Boolean(darkMode); } diff --git a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets index 664be58f..f6ae5bf2 100644 --- a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets +++ b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets @@ -33,7 +33,7 @@ export default class EntryAbility extends UIAbility { // Main window is created, set main page for this ability hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - windowStage.loadContent('pages/Index', (err) => { + windowStage.loadContent('pages/MainPage', (err) => { if (err.code) { hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); return; diff --git a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/pages/MainPage.ets b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/pages/MainPage.ets index 8efd9237..a44ae9c3 100644 --- a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/pages/MainPage.ets +++ b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/pages/MainPage.ets @@ -16,22 +16,46 @@ import { AudioPlayerService } from '../components/AudioPlayerService'; import { AudioPlayerStatus } from '../components/AudioPlayerStatus'; import { ContinueModel } from '../components/ContinueModel'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit'; @Entry @Component -struct Index { - @State message: string = 'Hello World'; +struct MainPage { @State currentIndex: number = 0; build() { - RelativeContainer() { + Column() { // [Start tabs] // products\phone\src\main\ets\pages\MainPage.ets Tabs({ index: this.currentIndex }) { - // ... + // [StartExclude tabs] + TabContent() { + Button('tabBar1') + .width('100%') + .onClick(() => { + this.getUIContext() + .getRouter() + .pushUrl({ + url: 'pages/page1' + }) + .then(() => { + hilog.info(0x000, 'testTag', `pushUrl succeed.`) + }) + .catch((err: BusinessError) => { + hilog.warn(0x000, 'testTag', `pushUrl failed. code=${err.code}, message=${err.message}`); + }) + }) + } + .tabBar('tabBar1') + + TabContent() { + Text('tabBar2 content') + } + .tabBar('tabBar2') + // [EndExclude tabs] } .layoutWeight(1) - .barHeight(0) .scrollable(false) .onChange((index) => { this.currentIndex = index; @@ -46,5 +70,6 @@ struct Index { } .height('100%') .width('100%') + .padding({ left: 12, right: 12 }) } } \ No newline at end of file diff --git a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/resources/base/profile/main_pages.json index f4241ef2..ae136709 100644 --- a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/resources/base/profile/main_pages.json +++ b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,7 @@ { "src": [ - "pages/MainPage" + "pages/MainPage", + "pages/page1", + "pages/page2" ] } -- Gitee From 4dfd504987729e3363983d8418faaead01f6e119 Mon Sep 17 00:00:00 2001 From: rex <1491721419@qq.com> Date: Mon, 13 Oct 2025 19:25:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9C=AA=E6=8D=95=E8=8E=B7=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/entryability/EntryAbility.ets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets index f6ae5bf2..b8a3bf61 100644 --- a/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets +++ b/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/entryability/EntryAbility.ets @@ -16,12 +16,18 @@ import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (error) { + let err = error as BusinessError; + hilog.warn(DOMAIN, 'testTag', `setColorMode failed. code=${err.code}, message=${err.message}`); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } -- Gitee