From f0039bcbd40e5948a77556bbbef3818a0b08bf42 Mon Sep 17 00:00:00 2001 From: z66 <1415243231@qq.com> Date: Tue, 26 Aug 2025 18:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E4=BF=AE=E5=A4=8D=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/index.html | 204 ++++++++++++++++++++++++------------------- 1 file changed, 112 insertions(+), 92 deletions(-) diff --git a/templates/index.html b/templates/index.html index 16b6482..e67deb6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -347,7 +347,6 @@ let currentSearchKeyword = ""; let currentServerDirectory = ""; let selectedScriptPath = null; - let scriptStatusMap = {}; // 缓存脚本状态映射 $(function () { loadScripts(); @@ -370,35 +369,28 @@ alert('加载脚本失败:后端返回非数组格式'); return; } - // 只保留有配置的脚本(后端已过滤,前端二次确认) + // 直接保存原始名称,不做额外处理 allScripts = scripts.filter(item => typeof item === 'object' && item !== null && 'name' in item && typeof item.name === 'string' && item.name.trim() !== '' ); - // 批量获取所有脚本的状态和模式 - $.get('/api/scripts/status', function(statusMap) { - scriptStatusMap = statusMap; - currentSearchKeyword = ""; - $('#script-search').val(""); - sortScripts(); - updateConfigScriptSelect(); + currentSearchKeyword = ""; + $('#script-search').val(""); + sortScripts(); + updateConfigScriptSelect(); - if (currentScript) { - const scriptExists = allScripts.some(s => s.name === currentScript); - if (scriptExists) { - $('#config-script').val(currentScript); - loadConfig(currentScript); - updateOutput(); - } else { - currentScript = null; - $('#output-area').empty(); - } + if (currentScript) { + const scriptExists = allScripts.some(s => s.name === currentScript); + if (scriptExists) { + $('#config-script').val(currentScript); + loadConfig(currentScript); + updateOutput(); + } else { + currentScript = null; + $('#output-area').empty(); } - }).fail(function(xhr) { - alert('加载脚本状态失败:' + (xhr.responseJSON?.error || xhr.statusText)); - }); - + } }).fail(function (xhr) { alert('加载脚本列表失败:' + (xhr.responseJSON?.error || xhr.statusText)); allScripts = []; @@ -452,7 +444,7 @@ if (filteredScripts.length === 0) { const tip = currentSearchKeyword ? ` 未找到包含"${currentSearchKeyword}"的脚本` : - ` 暂无配置的脚本`; + ` tasks目录下无脚本文件(支持.bat/.py)`; container.append(`