From 8c6eadd7f31ea65a2917dcd3f655563950acfba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E5=BA=86=E6=98=8E?= Date: Mon, 20 Oct 2025 09:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4LayoutPersistence.js=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/src/components/LayoutPersistence.js | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/AutoRobot/Windows/Robot/Web/src/components/LayoutPersistence.js b/AutoRobot/Windows/Robot/Web/src/components/LayoutPersistence.js index 8bddf8e..9cd6057 100644 --- a/AutoRobot/Windows/Robot/Web/src/components/LayoutPersistence.js +++ b/AutoRobot/Windows/Robot/Web/src/components/LayoutPersistence.js @@ -20,40 +20,8 @@ export class LayoutPersistence { saveLayout() { try { const layout = this._getCurrentLayout(); - // 添加详细的保存日志 - console.log('LayoutPersistence - 即将保存的布局数据:', { - leftPanelWidth: layout.leftPanelArea.width, - timestamp: new Date().toISOString() - }); - - // 直接检查localStorage当前值 - const currentValue = localStorage.getItem(this.storageKey); - let currentWidth = '未知'; - if (currentValue) { - try { - const currentLayout = JSON.parse(currentValue); - currentWidth = currentLayout.leftPanelArea?.width || '未知'; - } catch (e) { - currentWidth = '解析失败'; - } - } - console.log('LayoutPersistence - 保存前localStorage中的左侧面板宽度:', currentWidth); - // 执行保存操作 localStorage.setItem(this.storageKey, JSON.stringify(layout)); - - // 验证保存是否成功 - const savedValue = localStorage.getItem(this.storageKey); - let savedWidth = '未知'; - if (savedValue) { - try { - const savedLayout = JSON.parse(savedValue); - savedWidth = savedLayout.leftPanelArea?.width || '未知'; - } catch (e) { - savedWidth = '解析失败'; - } - } - console.log('LayoutPersistence - 保存后localStorage中的左侧面板宽度:', savedWidth); } catch (error) { console.error('LayoutPersistence - 保存布局失败:', error); } @@ -64,35 +32,16 @@ export class LayoutPersistence { */ loadLayout() { try { - console.log('LayoutPersistence - 开始加载布局数据'); - - // 获取并记录localStorage中的原始数据 const savedLayoutStr = localStorage.getItem(this.storageKey); - console.log('LayoutPersistence - localStorage中的原始数据存在:', !!savedLayoutStr); if (!savedLayoutStr) { - console.log('LayoutPersistence - 未找到保存的布局数据'); return false; } - // 解析并记录布局数据 const layout = JSON.parse(savedLayoutStr); - console.log('LayoutPersistence - 解析后的布局数据:', { - leftPanelWidth: layout.leftPanelArea?.width || '未定义', - timestamp: layout.timestamp || '无时间戳' - }); - - // 记录应用前的左侧面板宽度 - const leftPanelValue = this.panelCollections.leftPanelArea || {}; - console.log('LayoutPersistence - 应用布局前左侧面板宽度:', leftPanelValue.width || 0); - // 应用布局 this._applyLayout(layout); - // 记录应用后的左侧面板宽度 - const updatedLeftPanelValue = this.panelCollections.leftPanelArea || {}; - console.log('LayoutPersistence - 应用布局后左侧面板宽度:', updatedLeftPanelValue.width || 0); - return true; } catch (error) { console.error('LayoutPersistence - 加载布局失败:', error);