From deb0edcc0d3ed9507b9dc759587d8fcd3019f057 Mon Sep 17 00:00:00 2001 From: JackLee <809262979@qq.com> Date: Wed, 15 Apr 2026 16:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E8=80=A6=E4=BA=8B=E4=BB=B6,=E6=8A=8A?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=88=86=E4=B8=BAPage?= =?UTF-8?q?=E5=92=8CEvent.=20Page=E4=B8=BB=E8=A6=81=E9=92=88=E5=AF=B9Arkui?= =?UTF-8?q?=E4=BE=A7=E7=9A=84=E5=AD=90=E7=AA=97=E5=8F=A3=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=20Event=E4=B8=BB=E8=A6=81=E9=92=88=E5=AF=B9Native=E4=BE=A7?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后续考虑解耦为如下: Arkui_Page(主要针对子窗口归一化调用) Arkui_Event(主要针对arkui侧的归一化动态组件操作) Native_Page(主要针对Native侧对Arkui侧的页面数据更新和回调) Native_Event(主要针对单一从Aarkui侧调用Native指令) 本次更新后btnEvent中增加了page地址和args.可以在预置功能中预置命令和参数. --- .../main/ets/entryability/EntryAbility.ets | 2 +- .../src/main/ets/pages/EventSubWin/SWBase.ets | 2 +- entry/src/main/ets/pages/Index.ets | 132 +++++++++--------- .../ets/pages/LeftSideLayout/LeftSideTab.ets | 1 - entry/src/main/ets/pages/ModelViewTab.ets | 2 - .../pages/RightSideLayout/RightSideTab.ets | 2 - .../ets/pages/TitleLayout/TitleColumnSub.ets | 2 + .../main/ets/pages/TitleLayout/TitleTab.ets | 5 +- 8 files changed, 76 insertions(+), 72 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index ac657779..48493455 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -48,6 +48,7 @@ export default class EntryAbility extends UIAbility { //InitFont->Copy Res/resfile/font to sandbox InitGlobalDisplayWindowInfo(windowStage); + //Get Main Window windowStage.getMainWindow((err, data) => { if (err.code) { @@ -76,7 +77,6 @@ export default class EntryAbility extends UIAbility { ChangeData.height); }); }); - //Load page windowStage.loadContent('pages/Index', (err) => { if (err.code) { diff --git a/entry/src/main/ets/pages/EventSubWin/SWBase.ets b/entry/src/main/ets/pages/EventSubWin/SWBase.ets index 1bf0eed4..4ac9a262 100644 --- a/entry/src/main/ets/pages/EventSubWin/SWBase.ets +++ b/entry/src/main/ets/pages/EventSubWin/SWBase.ets @@ -34,7 +34,7 @@ export async function CreateAndShowSubWindow(winInfo:WinInfo) { await mwsInfo.winStage.createSubWindowWithOptions('subWindow', options).then((data) => { subWindow = data; //子窗口创建成功后,设置子窗口的位置、大小及相关属性等。 - subWindow.moveWindowTo(25, 25) + subWindow.moveWindowTo(50, 50) //子窗口重置大小 console.info("页面路径:", winInfo.page); subWindow.resize(winInfo.width,winInfo.height); diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 7306e80b..39fa1be3 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -1,5 +1,5 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; -import { edgeColors, display, AppStorageV2 } from '@kit.ArkUI'; +import { OverlayManager } from '@kit.ArkUI'; import { TitleTab } from './TitleLayout/TitleTab' import { LeftSideTab } from './LeftSideLayout/LeftSideTab' import { RightSideTab } from './RightSideLayout/RightSideTab' @@ -16,31 +16,35 @@ struct Index { @Local isDragging:boolean=false; @Provider('LeftSideWidth') leftSideWidth:number=mwInfo.width * 0.1; @Provider('RightSideWidth') rightSideWidth:number=mwInfo.width * 0.1; + private uiContext: UIContext = this.getUIContext(); + private overlayManager: OverlayManager = this.uiContext.getOverlayManager(); + private componentContent: ComponentContent | null = null; + build() { //OpenCAX主界面整体布局,采用多行布局 - Column() { - //头部导航功能区 - TitleTab().height('15%') - //分割线 - Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) - //工具栏 - Row() { - TitleColumnSub() - }.height('4%') - .align(Alignment.Start) + Column() { + //头部导航功能区 + TitleTab().height('15%') + //分割线 + Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) + //工具栏 + Row() { + TitleColumnSub() + }.height('4%') + .align(Alignment.Start) - //分割线 - Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) - Row() { - //左侧边导航区 - LeftSideTab() - // 左拖拽手柄 - Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) - .onMouse((event) => { - if(event.button==MouseButton.Left&&event.action==MouseAction.Press){ - this.startX = event.screenX; // 记录起始坐标 - this.isDragging = true; - }else if(event.action==MouseAction.Move&&this.isDragging){ + //分割线 + Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) + Row() { + //左侧边导航区 + LeftSideTab() + // 左拖拽手柄 + Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) + .onMouse((event) => { + if(event.button==MouseButton.Left&&event.action==MouseAction.Press){ + this.startX = event.screenX; // 记录起始坐标 + this.isDragging = true; + }else if(event.action==MouseAction.Move&&this.isDragging){ // 计算新的宽度 let newWidth = this.leftSideWidth + (event.screenX - this.startX); // 添加最小宽度限制 @@ -48,47 +52,47 @@ struct Index { this.leftSideWidth = newWidth; // 更新起始坐标,实现连续拖动 this.startX = event.screenX; - }else if(event.action==MouseAction.Release){ - this.isDragging = false; - } - }) - //中间操作区域 - Row() { - ModelViewTab() - }.layoutWeight(1) - .align(Alignment.Center) - //右拖拽手柄 - Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) - .onMouse((event) => { - if(event.button==MouseButton.Left&&event.action==MouseAction.Press){ - this.startX = event.screenX; // 记录起始坐标 - this.isDragging = true; - }else if(event.action==MouseAction.Move&&this.isDragging){ - // 计算新的宽度 - let newWidth = this.rightSideWidth - (event.screenX - this.startX); - // 添加最小宽度限制 - newWidth = Math.max(newWidth, 0); - this.rightSideWidth = newWidth; - // 更新起始坐标,实现连续拖动 - this.startX = event.screenX; - }else if(event.action==MouseAction.Release){ - this.isDragging = false; - } - }) - //右侧边导航区 - RightSideTab() - }.height('77%') - //分割线 - Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) - ///状态栏 - Column() { - Text('状态栏').fontSize(16) + }else if(event.action==MouseAction.Release){ + this.isDragging = false; + } + }) + //中间操作区域 + Row() { + ModelViewTab() + }.layoutWeight(1) + .align(Alignment.Center) + //右拖拽手柄 + Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) + .onMouse((event) => { + if(event.button==MouseButton.Left&&event.action==MouseAction.Press){ + this.startX = event.screenX; // 记录起始坐标 + this.isDragging = true; + }else if(event.action==MouseAction.Move&&this.isDragging){ + // 计算新的宽度 + let newWidth = this.rightSideWidth - (event.screenX - this.startX); + // 添加最小宽度限制 + newWidth = Math.max(newWidth, 0); + this.rightSideWidth = newWidth; + // 更新起始坐标,实现连续拖动 + this.startX = event.screenX; + }else if(event.action==MouseAction.Release){ + this.isDragging = false; + } + }) + //右侧边导航区 + RightSideTab() + }.height('77%') + //分割线 + Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) + ///状态栏 + Column() { + Text('状态栏').fontSize(16) + }.width('100%') + .align(Alignment.End) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Center) + .height('4%') }.width('100%') - .align(Alignment.End) - .alignItems(HorizontalAlign.Start) - .justifyContent(FlexAlign.Center) - .height('4%') - }.width('100%') - .height('100%') + .height('100%') } } diff --git a/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets b/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets index 238184f7..d6be901f 100644 --- a/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets +++ b/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets @@ -69,6 +69,5 @@ export struct LeftSideTab { }.barHeight(0) }.width(this.isExpanded?this.leftSideWidth:0) }.width('auto') - .backgroundColor($r('sys.color.background_secondary')) } } diff --git a/entry/src/main/ets/pages/ModelViewTab.ets b/entry/src/main/ets/pages/ModelViewTab.ets index 79d833b4..03ecba20 100644 --- a/entry/src/main/ets/pages/ModelViewTab.ets +++ b/entry/src/main/ets/pages/ModelViewTab.ets @@ -61,10 +61,8 @@ export struct ModelViewTab { .height('auto') .barMode(BarMode.Fixed) .barPosition(BarPosition.Start) - .backgroundBlurStyle(BlurStyle.COMPONENT_THIN) .fadingEdge(true) .barMode(BarMode.Scrollable) - .backgroundColor($r('sys.color.comp_background_secondary')) .divider({ strokeWidth: '1px', color: $r('sys.color.comp_divider') }) }else{ Image($r('app.media.base_background')) diff --git a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets index c9a97559..1c0d7038 100644 --- a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets +++ b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets @@ -36,8 +36,6 @@ export struct RightSideTab { }).margin({ top: 2,left:1,bottom:0,right:2}) Blank().layoutWeight(1) }.borderWidth(1) - .borderColor(Color.Grey) }.width('auto') - .backgroundColor($r('sys.color.background_secondary')) } } diff --git a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets index bf4c4cea..8b019cf2 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets @@ -64,5 +64,7 @@ export struct TitleColumnSub { SubColumnMenu({menus:DisplayMode}) }.width('100%') .height('100%') + .backgroundBlurStyle(BlurStyle.Thin, + { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/TitleLayout/TitleTab.ets b/entry/src/main/ets/pages/TitleLayout/TitleTab.ets index b6797d35..eb797069 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleTab.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleTab.ets @@ -87,6 +87,9 @@ export struct TitleTab { .barHeight(0) .barMode(BarMode.Fixed) }.margin({ top:0, left: 0, bottom: 0, right: 0 }) - .backgroundColor($r('sys.color.background_secondary')) + //.backgroundColor($r('sys.color.background_secondary')) + .borderRadius(15) + .backgroundBlurStyle(BlurStyle.Thin, + { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 }) } }