From 7fcc4d343b77830f8a7a002a6661434a7063675d Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sun, 7 Dec 2025 20:41:38 -0400 Subject: [PATCH] check page, fix ui --- src/App.vue | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index a816982..72f8d04 100644 --- a/src/App.vue +++ b/src/App.vue @@ -229,17 +229,28 @@ const appendLog = (msg: string) => { }); } +const appendLogs = (msgs: string[]) => { + checkLogs.value.push(...msgs); + nextTick(() => { + if (logContainerRef.value) { + logContainerRef.value.scrollTop = logContainerRef.value.scrollHeight; + } + }); +} + const handleDeleteEmptyDirs = async () => { - appendLog("---" + " 删除空目录操作 @ " + new Date().toLocaleString() + " ---"); + appendLog("\n" + "=".repeat(20)); appendLog("正在扫描并删除空目录..."); try { const deleted = await invoke('delete_empty_dirs', { path: currentDir.value }); if (deleted.length === 0) { appendLog("未发现空目录。"); } else { - for (const path of deleted) { - appendLog(`已删除: ${path}`); - await new Promise(resolve => setTimeout(resolve, 50)); // Small delay for buffering effect + const batchSize = 100; + for (let i = 0; i < deleted.length; i += batchSize) { + const batch = deleted.slice(i, i + batchSize).map(p => `已删除: ${p}`); + appendLogs(batch); + await new Promise(resolve => setTimeout(resolve, 50)); // Small delay for rendering } appendLog(`删除完毕,共删除 ${deleted.length} 个空目录。`); } @@ -249,7 +260,7 @@ const handleDeleteEmptyDirs = async () => { } const handleCheckNaming = async () => { - appendLog("---" + " 检查命名操作 @ " + new Date().toLocaleString() + " ---"); + appendLog("\n" + "=".repeat(20)); appendLog(`正在检查文件命名,前缀要求: ${videoNamePrefix.value} ...`); try { const mismatches = await invoke('check_file_naming', { @@ -261,17 +272,23 @@ const handleCheckNaming = async () => { appendLog("检查完毕,所有文件均符合命名规范。"); } else { appendLog(`发现 ${mismatches.length} 个文件不符合规范:`); - // Simple tree view simulation - // Sort to group by dir mismatches.sort(); - mismatches.forEach(path => { - // Determine relative path to show cleaner tree-like structure + + // Format logs first + const formattedLogs = mismatches.map(path => { let displayPath = path; if (path.startsWith(currentDir.value)) { displayPath = "." + path.substring(currentDir.value.length); } - appendLog(displayPath); + return displayPath; }); + + const batchSize = 100; + for (let i = 0; i < formattedLogs.length; i += batchSize) { + const batch = formattedLogs.slice(i, i + batchSize); + appendLogs(batch); + await new Promise(resolve => setTimeout(resolve, 50)); + } } } catch (e) { appendLog(`错误: ${e}`); @@ -526,7 +543,7 @@ watch(currentDir, (newPath) => { -
+

检查

{ style="margin-bottom: 20px" /> -
+
删除空目录 检查命名 @@ -691,6 +708,7 @@ body { display: flex; flex-direction: column; flex-grow: 1; /* Make it fill available height */ + overflow: hidden; /* Prevent container from expanding beyond parent */ } .log-header { padding: 10px 15px; @@ -717,4 +735,4 @@ body { text-align: center; margin-top: 20px; } - \ No newline at end of file +