feat: 优化工程页面的用户体验,包括删除一些不必要的元素,同时使用storage保存一些界面参数方便用户体验

This commit is contained in:
2025-07-12 18:24:42 +08:00
parent e25f08739a
commit 28af2df093
5 changed files with 387 additions and 474 deletions

View File

@@ -5,17 +5,24 @@
id="splitter-group-v"
direction="vertical"
class="w-full h-full"
@layout="handleVerticalSplitterResize"
>
<SplitterPanel id="splitter-group-v-panel-project">
<!-- 使用 v-show 替代 v-if -->
<SplitterPanel
v-show="!isBottomBarFullscreen"
id="splitter-group-v-panel-project"
:default-size="verticalSplitterSize"
>
<SplitterGroup
id="splitter-group-h"
direction="horizontal"
class="w-full h-full"
@layout="handleHorizontalSplitterResize"
>
<!-- 左侧图形化区域 -->
<SplitterPanel
id="splitter-group-h-panel-canvas"
:default-size="60"
:default-size="horizontalSplitterSize"
:min-size="30"
class="relative bg-base-200 overflow-hidden h-full"
>
@@ -60,7 +67,9 @@
</SplitterGroup>
</SplitterPanel>
<!-- 分割线也使用 v-show -->
<SplitterResizeHandle
v-show="!isBottomBarFullscreen"
id="splitter-group-v-resize-handle"
class="h-2 bg-base-100 hover:bg-primary hover:opacity-70 transition-colors"
/>
@@ -68,11 +77,14 @@
<!-- 功能底栏 -->
<SplitterPanel
id="splitter-group-v-panel-bar"
:default-size="20"
:min-size="15"
class="w-full overflow-hidden"
:default-size="isBottomBarFullscreen ? 100 : (100 - verticalSplitterSize)"
:min-size="isBottomBarFullscreen ? 100 : 15"
class="w-full overflow-hidden px-5 pt-3"
>
<BottomBar class="mx-4 mt-1" />
<BottomBar
:isFullscreen="isBottomBarFullscreen"
@toggle-fullscreen="handleToggleBottomBarFullscreen"
/>
</SplitterPanel>
</SplitterGroup>
</div>
@@ -97,6 +109,7 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
import { useLocalStorage } from '@vueuse/core'; // 添加VueUse导入
import { SplitterGroup, SplitterPanel, SplitterResizeHandle } from "reka-ui";
import DiagramCanvas from "@/components/LabCanvas/DiagramCanvas.vue";
import ComponentSelector from "@/components/LabCanvas/ComponentSelector.vue";
@@ -123,11 +136,37 @@ const equipments = useEquipments();
const alert = useAlertStore();
// --- 使用VueUse保存分栏状态 ---
// 左右分栏比例默认60%
const horizontalSplitterSize = useLocalStorage('project-horizontal-splitter-size', 60);
// 上下分栏比例默认80%
const verticalSplitterSize = useLocalStorage('project-vertical-splitter-size', 80);
// 底栏全屏状态
const isBottomBarFullscreen = useLocalStorage('project-bottom-bar-fullscreen', false);
// 文档面板显示状态
const showDocPanel = useLocalStorage('project-show-doc-panel', false);
function handleToggleBottomBarFullscreen() {
isBottomBarFullscreen.value = !isBottomBarFullscreen.value;
}
// --- 处理分栏大小变化 ---
function handleHorizontalSplitterResize(sizes: number[]) {
if (sizes && sizes.length > 0) {
horizontalSplitterSize.value = sizes[0];
}
}
function handleVerticalSplitterResize(sizes: number[]) {
if (sizes && sizes.length > 0) {
verticalSplitterSize.value = sizes[0];
}
}
// --- 实验板申请对话框 ---
const showRequestBoardDialog = ref(false);
// --- 文档面板控制 ---
const showDocPanel = ref(false);
const documentContent = ref("");
// 切换文档面板和属性面板