From 9a5e8e0076e34dc3593498e8384c8300b9fa7bf6 Mon Sep 17 00:00:00 2001 From: dmy Date: Mon, 2 Mar 2026 21:13:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B9=B6=E7=AE=80=E5=8C=96=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为日志组件添加折叠功能并显示空状态提示 移除参数表单中冗余的后端日志调试信息 --- webui/src/components/Log.vue | 16 ++++++++++++---- webui/src/components/ParameterForm.vue | 11 +---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/webui/src/components/Log.vue b/webui/src/components/Log.vue index 5cb7c38..d4ce06c 100644 --- a/webui/src/components/Log.vue +++ b/webui/src/components/Log.vue @@ -1,14 +1,14 @@ @@ -38,6 +39,7 @@ interface LogEntry { const logs = ref([]) const logContainer = ref(null) +const expanded = ref(true) const addLog = (level: LogEntry['level'], message: string) => { const now = new Date() @@ -103,4 +105,10 @@ defineExpose({ .log-debug .log-message { color: #9cdcfe; } + +.log-empty { + color: #666; + font-style: italic; + padding: 8px; +} diff --git a/webui/src/components/ParameterForm.vue b/webui/src/components/ParameterForm.vue index cfd928f..208718a 100644 --- a/webui/src/components/ParameterForm.vue +++ b/webui/src/components/ParameterForm.vue @@ -384,23 +384,14 @@ const calculate = async () => { try { // 调用 pywebview 的 Python 函数 if (window.pywebview) { - logRef.value?.addLog('info', '开始调用后端计算...') const response = await window.pywebview.api.calculate(params) - logRef.value?.addLog('info', `后端返回 keys: ${Object.keys(response).join(', ')}`) - logRef.value?.addLog('info', `DEBUG_VERSION: ${response.DEBUG_VERSION || '无'}`) - logRef.value?.addLog('info', `后端返回: ${JSON.stringify(response).substring(0, 150)}`) - // 显示日志 - console.log('[DEBUG] response:', response) + // 显示后端日志 const logs = response.logs if (Array.isArray(logs) && logs.length > 0) { - logRef.value?.addLog('info', `收到 ${logs.length} 条日志`) for (const log of logs) { logRef.value?.addLog(log.level as any, log.message) } - } else { - logRef.value?.addLog('warning', '后端未返回日志') - logRef.value?.addLog('warning', `response.logs = ${JSON.stringify(logs)}`) } result.value = JSON.stringify(response, null, 2)