From 3f62c0885d38ed904cee46b4c5bc31fb3735236f Mon Sep 17 00:00:00 2001 From: JackLee <809262979@qq.com> Date: Fri, 10 Apr 2026 20:50:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E6=8E=92=E7=89=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/pages/CustomController/Button.ets | 55 +++++++++---------- .../ets/pages/CustomController/ComboBox.ets | 11 ++-- .../main/ets/pages/CustomController/Menu.ets | 3 +- entry/src/main/ets/pages/Index.ets | 20 +++---- .../ets/pages/LeftSideLayout/LeftSideTab.ets | 8 +-- entry/src/main/ets/pages/ModelViewTab.ets | 14 ++--- .../pages/RightSideLayout/RightSideTab.ets | 3 - .../ets/pages/TitleLayout/TitleColumnSub.ets | 7 ++- .../main/ets/pages/TitleLayout/TitleTab.ets | 55 ++++++++++++------- .../ets/pages/TitleLayout/TitleTabContent.ets | 16 +++--- 10 files changed, 94 insertions(+), 98 deletions(-) diff --git a/entry/src/main/ets/pages/CustomController/Button.ets b/entry/src/main/ets/pages/CustomController/Button.ets index 2cf4788d..d8c9c167 100644 --- a/entry/src/main/ets/pages/CustomController/Button.ets +++ b/entry/src/main/ets/pages/CustomController/Button.ets @@ -64,7 +64,6 @@ export struct EventBtn { .width('auto') .textAlign(TextAlign.Center) .backgroundColor(Color.Transparent) - .fontColor($r('sys.color.font_emphasize')) } }.padding(1) } @@ -92,7 +91,6 @@ export struct MenuBtn { } }) }.fontSize(20) - .fontColor($r('sys.color.font_emphasize')) } build() { @@ -101,33 +99,32 @@ export struct MenuBtn { Button() .width(ebWidth) .height(ebHeigth) + .backgroundColor(Color.Transparent) .backgroundImage($r('app.media.' + this.menus[this.curtIndex].eIcon)) .backgroundImagePosition({ x: '5%', y: '5%' }) - .backgroundColor(Color.Transparent) .backgroundImageSize({ width: '90%', // 图片宽度占满按钮 height: '90%' // 图片高度占满按钮 }).onClick(()=> { ExecuteCommand((this.menus as Array)[this.curtIndex] as TitleButton); }) - Button() - .bindMenu(this.BaseMenu) - .type(ButtonType.Normal) - .width(ebWidth) - .height(edHeigth) - .backgroundImage($r('app.media.base_chevron_down')) - .backgroundImagePosition({ x: '35%', y: '0%' }) - .backgroundColor(Color.Transparent) - Text((this.menus[this.curtIndex].eName)) - .bindMenu(this.BaseMenu) - .fontSize(16) - .width('auto') - .textAlign(TextAlign.Center) - .backgroundColor(Color.Transparent) - .fontColor($r('sys.color.font_emphasize')) + + Button(){ + Column(){ + Image($r('app.media.base_chevron_down')).scale({ centerX: '50%', centerY: '50%' }) + .height(edHeigth) + Text((this.menus[this.curtIndex].eName)) + .fontSize(16) + .textAlign(TextAlign.Center) + }.height('100%') + .align(Alignment.Center) + }.constraintSize({ minWidth: ebWidth }) + .height(mwInfo.width*0.01) + .backgroundColor(Color.Transparent) + .bindMenu(this.BaseMenu) + .type(ButtonType.Normal) } - } - .padding(1) + }.padding(1) } } @@ -154,7 +151,6 @@ export struct SubColumnMenu { .size({ height: ebWidth }) }) }.fontSize(20) - .fontColor($r('sys.color.font_emphasize')) } @Builder BaseMenu (){ @@ -177,7 +173,6 @@ export struct SubColumnMenu { } }) }.fontSize(20) - .fontColor($r('sys.color.font_emphasize')) } build(){ @@ -185,17 +180,17 @@ export struct SubColumnMenu { Button(){ Row(){ Image($r('app.media.'+(this.icon!=undefined ? this.icon:(this.menus[this.curtIndex]as TitleButton).eIcon))) - .height(mwInfo.width*0.01) + .width(mwInfo.width*0.015) + .scale({ centerX: '50%', centerY: '50%' }) if(this.name!=undefined){ Text(this.name) .fontSize(16) - .fontColor($r('sys.color.font_emphasize')) } - } - }.height(mwInfo.width*0.01) - .backgroundColor(Color.Transparent) - .bindMenu(this.BaseMenu) - .type(ButtonType.Normal) - }.width(this.name!=undefined ?mwInfo.width*0.02:mwInfo.width*0.01) + }.width('auto') + }.constraintSize({ minWidth: mwInfo.width*0.015 }) + .backgroundColor(Color.Transparent) + .bindMenu(this.BaseMenu) + .type(ButtonType.Normal) + } } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/CustomController/ComboBox.ets b/entry/src/main/ets/pages/CustomController/ComboBox.ets index 3aa738dc..bc34aadb 100644 --- a/entry/src/main/ets/pages/CustomController/ComboBox.ets +++ b/entry/src/main/ets/pages/CustomController/ComboBox.ets @@ -30,12 +30,12 @@ export struct TextComboBox { Text(this.name!=undefined?this.name:'') .fontSize(16) Text(this.menu[this.selectIndex].eName) + .height('90%') .bindMenu(this.EventMenu) .fontSize(16) - .backgroundColor('#ffe6e6e3') - .height(mwInfo.height*0.02) - }.height(mwInfo.width*0.01) - .justifyContent(FlexAlign.Start) + .backgroundColor($r('sys.color.search_container_focus_color')) + .borderRadius(8) + }.justifyContent(FlexAlign.Start) } } @ComponentV2 @@ -59,6 +59,7 @@ export struct TextInputComboBox { TextInput({placeholder:this.selectIndex.toString()}) .bindMenu(this.EventMenu) .type(InputType.Number) - }.height(mwInfo.width*0.01) + .height('90%') + } } } diff --git a/entry/src/main/ets/pages/CustomController/Menu.ets b/entry/src/main/ets/pages/CustomController/Menu.ets index ae2c657a..8845e62e 100644 --- a/entry/src/main/ets/pages/CustomController/Menu.ets +++ b/entry/src/main/ets/pages/CustomController/Menu.ets @@ -63,12 +63,12 @@ export struct GroupTextEventMenu { Blank().width('auto') Text(this.grpEvent.grpName) .fontSize(16) - .fontColor($r('sys.color.font_emphasize')) Blank().width('auto') Button() .height(mwInfo.width*0.005) .width(mwInfo.width*0.005) .padding(1) + .backgroundColor(Color.Transparent) .backgroundImage($r('app.media.base_seetings')) .backgroundImagePosition({ x: '5%', y: '5%' }) .backgroundImageSize({ @@ -76,7 +76,6 @@ export struct GroupTextEventMenu { height: '90%' // 图片高度占满按钮 }) .bindMenu(BaseMenu(this.argsMenu)) - .backgroundColor(Color.Transparent) } }.align(Alignment.BottomEnd) } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 91ad9005..ce0537ef 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -18,18 +18,16 @@ struct Index { @Provider('RightSideWidth') rightSideWidth:number=mwInfo.width * 0.1; build() { //OpenCAX主界面整体布局,采用多行布局 - Column({ space: 0 }) { + Column() { //头部导航功能区 - TitleTab() + TitleTab().height('15%') //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) //工具栏 Row() { - TitleColumnSub(); - Blank().layoutWeight(1) - } - .height(mwInfo.height * 0.02) - .align(Alignment.Start) + TitleColumnSub() + }.height('5%') + .align(Alignment.Start) //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) @@ -79,8 +77,7 @@ struct Index { }) //右侧边导航区 RightSideTab() - }.width('100%') - .height(mwInfo.height * 0.39) + }.height('75%') //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) ///状态栏 @@ -90,7 +87,8 @@ struct Index { .align(Alignment.End) .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) - .height(25) - }.margin({ top:0, left: 0, bottom: 0, right: 0 }) + .height('5%') + }.width('100%') + .height('100%') } } diff --git a/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets b/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets index 1e00d85a..3a0a8a8a 100644 --- a/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets +++ b/entry/src/main/ets/pages/LeftSideLayout/LeftSideTab.ets @@ -13,9 +13,6 @@ export struct LeftSideTab { Row() { Column({space:1}){ Button() - .borderWidth(1) - .borderColor(Color.Grey) - .borderRadius(5) .backgroundImagePosition({ x: '5%', y: '5%' }) .backgroundColor(Color.Transparent) .backgroundImageSize({ @@ -35,9 +32,6 @@ export struct LeftSideTab { Column({ space: 5 }) { ForEach(LeftSideBars, (item: TitleButton, index: number) => { Button() - .borderWidth(1) - .borderColor(Color.Grey) - .borderRadius(5) .backgroundImagePosition({ x: '5%', y: '5%' }) .backgroundColor(Color.Transparent) .backgroundImageSize({ @@ -54,7 +48,7 @@ export struct LeftSideTab { this.leftSideBarFocusIndex = index; }) })} - Blank().height('95%') + Blank().layoutWeight(1) } } .align(Alignment.Start) diff --git a/entry/src/main/ets/pages/ModelViewTab.ets b/entry/src/main/ets/pages/ModelViewTab.ets index 2f4af4b6..79d833b4 100644 --- a/entry/src/main/ets/pages/ModelViewTab.ets +++ b/entry/src/main/ets/pages/ModelViewTab.ets @@ -60,7 +60,6 @@ export struct ModelViewTab { .barHeight(0) .height('auto') .barMode(BarMode.Fixed) - .barPosition(BarPosition.Start) .backgroundBlurStyle(BlurStyle.COMPONENT_THIN) .fadingEdge(true) @@ -69,15 +68,10 @@ export struct ModelViewTab { .divider({ strokeWidth: '1px', color: $r('sys.color.comp_divider') }) }else{ Image($r('app.media.base_background')) + .width('100%') + .height('100%') } - - }//.borderWidth('1') - //.borderColor(Color.Grey) - //.height('auto') - //.backgroundColor('#f3f3f0') - - .padding($r('sys.float.padding_level1')) - .backgroundImageSize({ width: '100%', height: '100%' }) - .borderRadius($r('sys.float.corner_radius_level8')) + }.width('100%') + .height('100%') } } diff --git a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets index 366b9ed7..c9a97559 100644 --- a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets +++ b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets @@ -20,9 +20,6 @@ export struct RightSideTab { }.width(this.isExpanded?this.rightSideWidth:0) Column({space:1}){ Button() - .borderWidth(1) - .borderColor(Color.Grey) - .borderRadius(5) .backgroundImagePosition({ x: '5%', y: '5%' }) .backgroundColor(Color.Transparent) .backgroundImageSize({ diff --git a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets index 809850ef..3b29472a 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets @@ -52,8 +52,8 @@ export struct TitleColumnSub { this.viewDialog=this.ViewDialog(); } this.viewDialog.open(); - }).width(mwInfo.width*0.01) - .height(mwInfo.width*0.01) + }).width(mwInfo.width*0.015) + .height(mwInfo.width*0.015) .backgroundColor(Color.Transparent) .backgroundImage($r('app.media.' + SwitchView[0].eIcon)) .backgroundImageSize({ @@ -61,6 +61,7 @@ export struct TitleColumnSub { height: '100%' // 图片高度占满按钮 }) SubColumnMenu({menus:DisplayMode}) - }.margin({ top: 1, left: 1, bottom: 1, right: 1 }) + }.width('100%') + .height('100%') } } \ 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 ffaa08f4..8ee7437d 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleTab.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleTab.ets @@ -23,31 +23,45 @@ export struct TitleTab { Scroll() { Row({space:0}) { Button((FileMenuData.aMenus[0] as TitleButton).eName) - .fontSize(16) - .fontColor(Color.Black) - .height(mwInfo.height*0.025) + .width('7%') + .fontSize(18) + .fontColor($r('sys.color.font')) .bindMenu(BaseMenu(FileMenuData)) .type(ButtonType.Normal) - .backgroundColor($r('sys.color.background_secondary')) - .fontColor($r('sys.color.font_emphasize')) + .backgroundColor(Color.Transparent) ForEach(this.curtModel, (item: TitleModel, index: number) => { - Button(item.cmName) - .fontSize(16) - .fontColor(Color.Black) - .fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal) - .height(mwInfo.height*0.025) - .type(ButtonType.Normal) - .backgroundColor($r('sys.color.background_secondary')) - .fontColor($r('sys.color.font_emphasize')) - .onClick(() => { - this.titleBarTabs.changeIndex(index); - this.titleBarFocusIndex = index; - }) + Button(){ + Column(){ + Text(item.cmName) + .height('95%') + .fontSize(18) + .fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal) + .backgroundColor(Color.Transparent) + + Divider() + .height('5%') + .vertical(false) + .strokeWidth(2) + .lineCap(LineCapStyle.Round) + .color(Color.Grey) + .align(Alignment.Top) + .visibility(index === this.titleBarFocusIndex?Visibility.Visible:Visibility.Hidden) + }.width('100%') + .height('100%') + } + .width('7%') + .backgroundColor(index === this.titleBarFocusIndex ? $r('sys.color.container_modal_button_normal_baseboard') : Color.Transparent) + .type(ButtonType.Normal) + .onClick(() => { + this.titleBarTabs.changeIndex(index); + this.titleBarFocusIndex = index; + }) }) Blank().layoutWeight(1) } } + .height('25%') .align(Alignment.Start) .scrollable(ScrollDirection.Horizontal) .scrollBar(BarState.Off) @@ -66,10 +80,11 @@ export struct TitleTab { TitleTabContent({curtLayout:item}) } }) - }.scrollable(true) + } + .height('75%') + .scrollable(true) .barHeight(0) .barMode(BarMode.Fixed) - }.width('100%') - .height(mwInfo.height * 0.08) + }.margin({ top:0, left: 0, bottom: 0, right: 0 }) } } diff --git a/entry/src/main/ets/pages/TitleLayout/TitleTabContent.ets b/entry/src/main/ets/pages/TitleLayout/TitleTabContent.ets index f15217cb..21e64722 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleTabContent.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleTabContent.ets @@ -24,7 +24,7 @@ export struct TitleTabContent { }else if(row_item instanceof Array){ //Array //功能组,迭代多个功能组 ForEach(row_item, (group_item: TitleGroup, index: number) =>{ - Column({ space:10 }){ + Column({ space:5 }){ Row({ space: 1 }){ ForEach(group_item.grpBtn, (btn_item: TitleButton|Array, index: number) =>{ if(this.curtLayout?.cmName=='应用模块'){ @@ -41,13 +41,13 @@ export struct TitleTabContent { } } }) - }.margin({ top: 1,left:10,bottom:1,right:10}) + } //功能组名 Row(){ GroupTextEventMenu({grpEvent:group_item}) - }.margin({ top: 0,left:0,bottom:-5,right:0}) - } - Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('95%').backgroundColor(Color.Gray) + } + }.height('100%') + Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('90%').backgroundColor(Color.Grey) }) }else{ //菜单按钮 @@ -61,9 +61,11 @@ export struct TitleTabContent { } }) }.width('100%') + .height('100%') .align(Alignment.BottomEnd) - .borderColor(Color.Gray) + .borderColor(Color.Grey) }) - }.margin({ top: 5,left:1,bottom:1,right:1}) + }.width('100%') + .height('100%') } } \ No newline at end of file