From e74cb4ee1c08423306ef2495e7a3c5c7fe865627 Mon Sep 17 00:00:00 2001 From: JackLee <809262979@qq.com> Date: Wed, 29 Apr 2026 21:44:36 +0800 Subject: [PATCH] =?UTF-8?q?1-=E4=BF=AE=E5=A4=8D=E5=88=86=E5=B1=82=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E8=83=8C=E6=99=AF=E8=89=B2=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202-=E5=8F=B3=E4=BE=A7=E8=BE=B9=E6=A0=8F=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=85=B3=E9=97=AD=203-=E4=BF=AE=E5=A4=8D=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98=204-=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E4=B8=8B=E4=B8=80=E6=AC=A1push=E5=B0=86=E6=94=B9?= =?UTF-8?q?=E5=90=8D=E4=B8=BAINCAX(=E8=AF=A5=E6=AC=A1=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=E6=9C=80=E7=BB=88=E5=90=8D=E5=AD=97(=E5=89=8D?= =?UTF-8?q?=E6=8F=90=E5=95=86=E6=A0=87=E4=B8=8D=E8=A2=AB=E6=B3=A8=E5=86=8C?= =?UTF-8?q?))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Index.ets | 8 +++---- .../src/main/ets/pages/eventhub/EventBase.ets | 22 +++++++++++++------ .../main/ets/pages/leftside/LeftSideTab.ets | 11 +++++----- .../main/ets/pages/rightside/RightSideTab.ets | 10 ++++----- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 9d02ae4f..b8ad197d 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -5,7 +5,7 @@ import { RightSideTab } from './rightside/RightSideTab' import { View } from './view/View' import { TitleColumnSub } from './titletabs/TitleColumnSub' import { mdwInfo } from './dispwininfo/DispWinInfo' -import { uiMode } from './eventhub/EventBase' +import { sideState } from './eventhub/EventBase' const DOMAIN = 0x0000; //分割线类型,分左和右 @@ -71,7 +71,7 @@ struct Index { Column() { //头部导航功能区 //Blank().height(uiMode.state?mdwInfo.displayHeight*0.07:0) - TitleTab().height(uiMode.state?mdwInfo.displayHeight*0.075:0) + TitleTab().height(sideState.headSide?mdwInfo.displayHeight*0.075:0) //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) //工具栏 @@ -83,7 +83,7 @@ struct Index { Divider().vertical(false).strokeWidth(2).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) Row() { //左侧边导航区 - LeftSideTab().width(uiMode.state?this.leftSideWidth:'0%') + LeftSideTab().width(sideState.leftSide?this.leftSideWidth:mdwInfo.winWidth*0.013) // 左拖拽手柄 Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) .onMouse((event) => { @@ -106,7 +106,7 @@ struct Index { this.dividerChangeSize(event,DividerType.RightSide) }) //右侧边导航区 - RightSideTab().width(uiMode.state?this.rightSideWidth:'0%') + RightSideTab().width(sideState.rightSide?this.rightSideWidth:mdwInfo.winWidth*0.013) }.layoutWeight(1) //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) diff --git a/entry/src/main/ets/pages/eventhub/EventBase.ets b/entry/src/main/ets/pages/eventhub/EventBase.ets index 8a457aed..6137cc4f 100644 --- a/entry/src/main/ets/pages/eventhub/EventBase.ets +++ b/entry/src/main/ets/pages/eventhub/EventBase.ets @@ -35,17 +35,21 @@ export class SubWinInfo{ } @ObservedV2 -export class UIMode{ - @Trace public state?:boolean; - constructor(_uiModeState?:boolean,) +export class SideState{ + @Trace public headSide:boolean=true; + @Trace public leftSide:boolean=true; + @Trace public rightSide:boolean=false; + constructor(_headSide:boolean,_leftSide:boolean,_rightSide:boolean) { - this.state = _uiModeState; + this.headSide=_headSide; + this.leftSide = _leftSide; + this.rightSide = _rightSide; } } //窗体保存容器 export let subWins:Map=new Map; -export let uiMode:UIMode=new UIMode(true); +export let sideState:SideState=new SideState(true,true,false); //随机ID export function RndId(): string { // 获取当前时间戳(毫秒) @@ -127,9 +131,13 @@ export function EventExecute(event:TitleButton){ } if(event?.btnEvent.command=='MODE_PREVIEW'){ - uiMode.state=false; + sideState.headSide=false; + sideState.leftSide=false; + sideState.rightSide=false; }else if(event?.btnEvent.command=='MODE_EDIT'){ - uiMode.state=true; + sideState.headSide=true; + sideState.leftSide=true; + sideState.rightSide=true; } if(event?.btnEvent.command=='MODE_MOUSE'){ diff --git a/entry/src/main/ets/pages/leftside/LeftSideTab.ets b/entry/src/main/ets/pages/leftside/LeftSideTab.ets index 270f20dc..9d230294 100644 --- a/entry/src/main/ets/pages/leftside/LeftSideTab.ets +++ b/entry/src/main/ets/pages/leftside/LeftSideTab.ets @@ -2,11 +2,12 @@ import { TitleButton } from '../interface/Interface'; import {LeftSideBars} from '../layout/LeftSideBar' import { mdwInfo } from '../dispwininfo/DispWinInfo' import {LeftSideComponent} from './LeftSideComponent' +import { sideState } from '../eventhub/EventBase'; + @ComponentV2 export struct LeftSideTab { private leftSideBarTabs: TabsController = new TabsController(); @Local leftSideBarFocusIndex: number = 0; - @Local isExpanded:boolean=true; @Consumer('LeftSideWidth') leftSideWidth:number=mdwInfo.winWidth * 0.087; build() { @@ -19,13 +20,13 @@ export struct LeftSideTab { width: '90%', // 图片宽度占满按钮 height: '90%' // 图片高度占满按钮 }) - .backgroundImage(this.isExpanded ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off')) + .backgroundImage(sideState.leftSide ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off')) .type(ButtonType.Normal) .width(mdwInfo.winWidth*0.013) .height(mdwInfo.winWidth*0.013) .onClick(()=>{ - this.isExpanded = !this.isExpanded; - this.leftSideWidth=this.isExpanded?mdwInfo.winWidth * 0.087:mdwInfo.winWidth*0.013 + sideState.leftSide = !sideState.leftSide; + this.leftSideWidth=sideState.leftSide?mdwInfo.winWidth * 0.087:mdwInfo.winWidth*0.013 }).margin({ top: 2,left:1,bottom:0,right:2}) Scroll() { Flex({ direction: FlexDirection.Column}) { @@ -67,7 +68,7 @@ export struct LeftSideTab { } }) }.barHeight(0) - }.width(this.isExpanded?mdwInfo.winWidth * 0.087:0) + }.width(sideState.leftSide?mdwInfo.winWidth * 0.087:0) }.width('auto') } } diff --git a/entry/src/main/ets/pages/rightside/RightSideTab.ets b/entry/src/main/ets/pages/rightside/RightSideTab.ets index 05ecff6d..5d55d801 100644 --- a/entry/src/main/ets/pages/rightside/RightSideTab.ets +++ b/entry/src/main/ets/pages/rightside/RightSideTab.ets @@ -1,12 +1,12 @@ import { TitleButton } from '../interface/Interface'; import {LeftSideBars} from '../layout/LeftSideBar' import { mdwInfo } from '../dispwininfo/DispWinInfo' +import { sideState } from '../eventhub/EventBase'; @ComponentV2 export struct RightSideTab { private leftSideBarTabs: TabsController = new TabsController(); @Local leftSideBarFocusIndex: number = 0; - @Local isExpanded:boolean=true; @Consumer('RightSideWidth') rightSideWidth:number=mdwInfo.winWidth * 0.087; build() { @@ -17,7 +17,7 @@ export struct RightSideTab { } }.barHeight(0) - }.width(this.isExpanded?this.rightSideWidth-mdwInfo.winWidth*0.013:'0%') + }.width(sideState.rightSide?this.rightSideWidth-mdwInfo.winWidth*0.013:'0%') //右边按钮列 Column({space:1}){ Button() @@ -27,13 +27,13 @@ export struct RightSideTab { width: '90%', // 图片宽度占满按钮 height: '90%' // 图片高度占满按钮 }) - .backgroundImage(this.isExpanded ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off')) + .backgroundImage(sideState.rightSide ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off')) .type(ButtonType.Normal) .width(mdwInfo.winWidth*0.013) .height(mdwInfo.winWidth*0.013) .onClick(()=>{ - this.isExpanded = !this.isExpanded; - this.rightSideWidth=this.isExpanded?mdwInfo.winWidth * 0.087:mdwInfo.winWidth*0.013; + sideState.rightSide = !sideState.rightSide; + this.rightSideWidth=sideState.rightSide?mdwInfo.winWidth * 0.087:mdwInfo.winWidth*0.013; }).margin({ top: 2,left:1,bottom:0,right:2}) Blank().layoutWeight(1) }.borderWidth(1)