移除控制台日志语句
This commit is contained in:
13
.trae/rules/project_rules.md
Normal file
13
.trae/rules/project_rules.md
Normal file
@@ -0,0 +1,13 @@
|
||||
1. Android:这是安卓的库目录,包含了安卓库的代码和资源文件
|
||||
2. VUE:这是Vue的库目录,包含了Vue库的代码和资源文件
|
||||
3. AutoRobot:这是AutoRobot的项目目录
|
||||
4. AutoRobot\Android\Robot:这是AutoRobot项目的安卓端的子项目目录
|
||||
6. AutoRobot\Windows\Robot:这是AutoRobot项目的服务端的子项目目录,编译并运行:go run .\main.go
|
||||
7. AutoRobot\Windows\Robot\Web:这是AutoRobot项目的客户端的子项目目录,编译:npm run build
|
||||
8. 在执行git或svn操作时,需要切换代码页到 chcp 936, 执行其它命令时,请先切换回默认的代码页 chcp 65001
|
||||
9. Maven 仓库地址是 http://geek.cdjkt.com:30003/repository/maven-public,isAllowInsecureProtocol = true
|
||||
10. go 仓库的地址是 http://geek.cdjkt.com:30003/repository/go-public
|
||||
11. Nexus 仓库地址是:http://geek.cdjkt.com:30003,用户名:admin,密码:Access2cRte
|
||||
12. 当前终端是powershell,请注意命令的格式
|
||||
13. 当文件被修改时,需要暂停执行,待我接受或者拒绝修改后,再继续执行
|
||||
14. 不要自行提交git或svn,我让提交就只提交一次
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="dock-panel-container w-full h-full relative overflow-hidden bg-gray-100">
|
||||
<div ref="container" class="dock-panel-container w-full h-full relative overflow-hidden bg-gray-100">
|
||||
<!-- 主内容区域 -->
|
||||
<div class="flex flex-col h-full">
|
||||
<!-- 顶部面板区域 -->
|
||||
@@ -322,8 +322,16 @@ const container = ref(null);
|
||||
// 初始化Pinia store
|
||||
const store = useDockPanelStore();
|
||||
|
||||
// 初始化布局管理器
|
||||
const layoutManager = useLayoutManager(store);
|
||||
// 定义布局应用完成后的回调函数,用于刷新面板大小
|
||||
function handleLayoutApplied() {
|
||||
// 确保容器存在后调用refreshPanelSizes并传递容器元素
|
||||
if (container.value) {
|
||||
store.refreshPanelSizes(container.value);
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化布局管理器,传递布局应用完成后的回调函数
|
||||
const layoutManager = useLayoutManager(store, handleLayoutApplied);
|
||||
|
||||
// 拖拽状态
|
||||
const dragState = computed({
|
||||
|
||||
@@ -14,11 +14,12 @@ export class LayoutManager {
|
||||
* 构造函数
|
||||
* @param {Object} store - Pinia store实例
|
||||
*/
|
||||
constructor(store) {
|
||||
constructor(store, onLayoutApplied = null) {
|
||||
this.store = store;
|
||||
this.container = ref(null);
|
||||
this.layoutPersistence = null;
|
||||
this.resizeHandlers = null;
|
||||
this.onLayoutApplied = onLayoutApplied;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,9 +30,11 @@ export class LayoutManager {
|
||||
// 直接传入store对象,让LayoutPersistence能够访问最新的面板数据
|
||||
// 创建布局持久化实例
|
||||
// 优化:LayoutPersistence构造函数已简化,只需要store对象和storageKey
|
||||
// 传递onLayoutApplied回调,以便在布局应用完成后通知调用方
|
||||
this.layoutPersistence = new LayoutPersistence(
|
||||
this.store,
|
||||
'dockPanelLayout'
|
||||
'dockPanelLayout',
|
||||
this.onLayoutApplied
|
||||
);
|
||||
|
||||
// 创建调整大小处理器
|
||||
@@ -226,10 +229,11 @@ export class LayoutManager {
|
||||
/**
|
||||
* 创建LayoutManager的Vue组合式函数
|
||||
* @param {Object} store - Pinia store实例
|
||||
* @param {Function} onLayoutApplied - 布局应用完成后的回调函数
|
||||
* @returns {Object} LayoutManager实例及相关方法
|
||||
*/
|
||||
export function useLayoutManager(store) {
|
||||
const layoutManager = new LayoutManager(store);
|
||||
export function useLayoutManager(store, onLayoutApplied = null) {
|
||||
const layoutManager = new LayoutManager(store, onLayoutApplied);
|
||||
|
||||
onMounted(() => {
|
||||
layoutManager.initialize();
|
||||
|
||||
@@ -7,11 +7,12 @@ export class LayoutPersistence {
|
||||
* @param {Object} store - Pinia store实例,包含面板集合和布局状态信息
|
||||
* @param {string} storageKey - localStorage存储键名
|
||||
*/
|
||||
constructor(store, storageKey = 'dockPanelLayout') {
|
||||
constructor(store, storageKey = 'dockPanelLayout', onLayoutApplied = null) {
|
||||
// 完全简化参数,只需要store对象和可选的storageKey
|
||||
this.panelCollections = store;
|
||||
this.layoutState = store; // 统一使用store对象
|
||||
this.storageKey = storageKey;
|
||||
this.onLayoutApplied = onLayoutApplied;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,9 +131,7 @@ export class LayoutPersistence {
|
||||
const bottomPanelValue = this.panelCollections.bottomPanelArea || {};
|
||||
const centerPanelValue = this.panelCollections.centerPanelArea || {};
|
||||
|
||||
// 打印当前读取的面板宽度值
|
||||
console.log('LayoutPersistence - 读取左侧面板宽度:', leftPanelValue.width || 0);
|
||||
console.log('LayoutPersistence - 读取右侧面板宽度:', rightPanelValue.width || 0);
|
||||
// 获取当前面板宽度值
|
||||
|
||||
const layoutData = {
|
||||
// 面板区数据
|
||||
@@ -282,7 +281,14 @@ export class LayoutPersistence {
|
||||
this.panelCollections.activeCenterTab = layout.activeCenterTab;
|
||||
}
|
||||
|
||||
// 面板比例已通过面板区域对象直接应用,无需额外处理
|
||||
// 面板比例已通过面板区域对象直接应用
|
||||
|
||||
// 布局应用完成,触发布局应用完成事件
|
||||
// 注意:实际的刷新操作应该由调用方(如DockPanelContainer.vue)来执行,
|
||||
// 因为它可以直接访问容器DOM元素并传递给refreshPanelSizes方法
|
||||
if (this.onLayoutApplied) {
|
||||
this.onLayoutApplied();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -295,9 +295,9 @@ export class ResizeHandlers {
|
||||
this.store.resizeStartPos = { x: 0, y: 0 };
|
||||
|
||||
// 打印保存前的面板宽度值
|
||||
console.log('ResizeHandlers - 保存前左侧面板宽度:', this.store.leftPanelArea.width);
|
||||
|
||||
this.layoutPersistence.saveLayout();
|
||||
console.log('ResizeHandlers - 保存后左侧面板宽度:', this.store.leftPanelArea.width);
|
||||
|
||||
} else if (this.store.dragState.active && checkDockZoneCallback) {
|
||||
// 计算拖拽距离
|
||||
const dragDistance = Math.sqrt(
|
||||
|
||||
@@ -345,13 +345,13 @@ export const useDockPanelStore = defineStore('dockPanel', () => {
|
||||
// 处理所有位置面板的通用逻辑
|
||||
if (panels.length > 0) {
|
||||
resetPanelsSizeRatios(position)
|
||||
// 使用传入的容器参数更新面板尺寸
|
||||
// 无论是否提供container参数,都应该更新面板区内的子面板尺寸
|
||||
if (container) {
|
||||
updatePanelsSize(position, panelArea, container, { panelWidth: 150, panelHeight: 100 });
|
||||
}
|
||||
}
|
||||
// 如果面板区域变为空,触发尺寸影响处理以更新其他区域
|
||||
if (panels.length === 0 && container) {
|
||||
if (panels.length === 0) {
|
||||
handlePanelSizeInfluence(position, container);
|
||||
}
|
||||
|
||||
@@ -651,6 +651,27 @@ export const useDockPanelStore = defineStore('dockPanel', () => {
|
||||
minimizedWindows.value = []
|
||||
}
|
||||
|
||||
// 刷新所有面板区域的大小信息
|
||||
function refreshPanelSizes(container = null) {
|
||||
// 对于每个面板区域,调用updatePanelsSize来刷新大小信息
|
||||
// 只有当容器存在时才调用updatePanelsSize
|
||||
if (container) {
|
||||
updatePanelsSize('left', leftPanelArea.value, container);
|
||||
updatePanelsSize('right', rightPanelArea.value, container);
|
||||
updatePanelsSize('top', topPanelArea.value, container);
|
||||
updatePanelsSize('bottom', bottomPanelArea.value, container);
|
||||
updatePanelsSize('center', centerPanelArea.value, container);
|
||||
}
|
||||
|
||||
// 触发响应式更新
|
||||
// 重新赋值整个对象来确保Vue能够检测到变化
|
||||
leftPanelArea.value = { ...leftPanelArea.value };
|
||||
rightPanelArea.value = { ...rightPanelArea.value };
|
||||
topPanelArea.value = { ...topPanelArea.value };
|
||||
bottomPanelArea.value = { ...bottomPanelArea.value };
|
||||
centerPanelArea.value = { ...centerPanelArea.value };
|
||||
}
|
||||
|
||||
// 初始化面板大小影响关系和受影响关系
|
||||
function initializePanelSizeInfluence() {
|
||||
// 初始化影响关系数据
|
||||
@@ -948,7 +969,7 @@ export const useDockPanelStore = defineStore('dockPanel', () => {
|
||||
case 'top':
|
||||
newSize = layoutCoordinator.adjustRegionSize('top', panelAreas.top.height, delta, panelAreas, containerHeight)
|
||||
panelAreas.top.height = newSize
|
||||
console.log('dockPanelStore - 顶部面板高度更新为:', panelAreas.top.height)
|
||||
|
||||
break
|
||||
case 'bottom':
|
||||
newSize = layoutCoordinator.adjustRegionSize('bottom', panelAreas.bottom.height, -delta, panelAreas, containerHeight)
|
||||
@@ -1007,6 +1028,7 @@ export const useDockPanelStore = defineStore('dockPanel', () => {
|
||||
resetLayout,
|
||||
resetPanelsSizeRatios,
|
||||
initializePanelSizeInfluence,
|
||||
refreshPanelSizes,
|
||||
updatePanelsSize,
|
||||
handlePanelSizeInfluence,
|
||||
adjustAdjacentPanels,
|
||||
|
||||
Reference in New Issue
Block a user