优化:代码审查
清理: - 删除重复的 composables(useFilePreview.js、useFileEdit.js) - 已有 TypeScript 版本在 FileSystem/composables/ 优化: - 统一 API 层错误日志到 debugLog(system.ts) - 移除 UpdatePanel 调试面板和调试文本 代码质量: - 提升代码可维护性 - 统一错误处理方式
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
import type { SystemInfo, CPU, Memory, Disk, File } from './types'
|
||||
import { debugError } from '@/utils/debugLog'
|
||||
|
||||
/**
|
||||
* 转换后端文件数据格式(蛇形 → 驼峰)
|
||||
@@ -162,7 +163,7 @@ export async function listZipContents(zipPath: string): Promise<File[]> {
|
||||
const result = await window.go.main.App.ListZipContents(zipPath)
|
||||
return transformFileList(result)
|
||||
} catch (error) {
|
||||
console.error('[API] listZipContents 错误:', error)
|
||||
debugError('[API] listZipContents 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -178,7 +179,7 @@ export async function extractFileFromZip(zipPath: string, filePath: string): Pro
|
||||
const result = await window.go.main.App.ExtractFileFromZip(zipPath, filePath)
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error('[API] extractFileFromZip 错误:', error)
|
||||
debugError('[API] extractFileFromZip 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -195,7 +196,7 @@ export async function extractFileFromZipToTemp(zipPath: string, filePath: string
|
||||
const result = await window.go.main.App.ExtractFileFromZipToTemp(zipPath, filePath)
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error('[API] extractFileFromZipToTemp 错误:', error)
|
||||
debugError('[API] extractFileFromZipToTemp 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -211,7 +212,7 @@ export async function getZipFileInfo(zipPath: string, filePath: string): Promise
|
||||
const result = await window.go.main.App.GetZipFileInfo(zipPath, filePath)
|
||||
return transformFile(result)
|
||||
} catch (error) {
|
||||
console.error('[API] getZipFileInfo 错误:', error)
|
||||
debugError('[API] getZipFileInfo 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -226,7 +227,7 @@ export async function openPath(path: string): Promise<void> {
|
||||
try {
|
||||
await window.go.main.App.OpenPath(path)
|
||||
} catch (error) {
|
||||
console.error('[API] openPath 错误:', error)
|
||||
debugError('[API] openPath 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -259,7 +260,7 @@ export async function resolveShortcut(lnkPath: string): Promise<{
|
||||
const result = await window.go.main.App.ResolveShortcut(lnkPath)
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error('[API] resolveShortcut 错误:', error)
|
||||
debugError('[API] resolveShortcut 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -280,7 +281,7 @@ export async function detectFileTypeByContent(path: string): Promise<{
|
||||
const result = await window.go.main.App.DetectFileTypeByContent(path)
|
||||
return result as any
|
||||
} catch (error) {
|
||||
console.error('[API] detectFileTypeByContent 错误:', error)
|
||||
debugError('[API] detectFileTypeByContent 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user