移除LayoutPersistence.js中的调试日志语句

This commit is contained in:
2025-10-20 09:55:07 +08:00
parent feaa0ed3a9
commit 8c6eadd7f3

View File

@@ -20,40 +20,8 @@ export class LayoutPersistence {
saveLayout() { saveLayout() {
try { try {
const layout = this._getCurrentLayout(); 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)); 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) { } catch (error) {
console.error('LayoutPersistence - 保存布局失败:', error); console.error('LayoutPersistence - 保存布局失败:', error);
} }
@@ -64,35 +32,16 @@ export class LayoutPersistence {
*/ */
loadLayout() { loadLayout() {
try { try {
console.log('LayoutPersistence - 开始加载布局数据');
// 获取并记录localStorage中的原始数据
const savedLayoutStr = localStorage.getItem(this.storageKey); const savedLayoutStr = localStorage.getItem(this.storageKey);
console.log('LayoutPersistence - localStorage中的原始数据存在:', !!savedLayoutStr);
if (!savedLayoutStr) { if (!savedLayoutStr) {
console.log('LayoutPersistence - 未找到保存的布局数据');
return false; return false;
} }
// 解析并记录布局数据
const layout = JSON.parse(savedLayoutStr); 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); this._applyLayout(layout);
// 记录应用后的左侧面板宽度
const updatedLeftPanelValue = this.panelCollections.leftPanelArea || {};
console.log('LayoutPersistence - 应用布局后左侧面板宽度:', updatedLeftPanelValue.width || 0);
return true; return true;
} catch (error) { } catch (error) {
console.error('LayoutPersistence - 加载布局失败:', error); console.error('LayoutPersistence - 加载布局失败:', error);