From 10f8e6bb66fb5f9c5b4ac5920a8819a7ebe1885a Mon Sep 17 00:00:00 2001 From: CNWei Date: Wed, 4 Nov 2026 22:51:37 +0800 Subject: [PATCH] =?UTF-8?q?style(frontend):=20=E7=B2=BE=E7=AE=80=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=AF=AD=E8=A8=80=E6=8F=90=E7=A4=BA=E5=B9=B6=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E8=A7=A3=E9=87=8A=E5=99=A8=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 脚本语言提示从大块灰色卡片改成下拉框右侧的一行说明 - Python 表单不再显示解释器输入框,固定使用 .venv 里的 Python - 虚拟环境目录字段改为全宽并明确自动探测语义 - 非 Python 语言仍由语言自动设置 cmd.exe/node.exe/lua.exe,API 仍可传自定义 interpreter --- README.md | 7 +- frontend/src/App.css | 43 ++++++----- frontend/src/components/TaskEditorModal.tsx | 83 +++++++++------------ frontend/src/lib/taskForm.ts | 6 +- 4 files changed, 66 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 6a7c7fe..d962c50 100644 --- a/README.md +++ b/README.md @@ -228,8 +228,9 @@ queued ──► running ──► succeeded / failed / timed_out / cancelled - 没装 uv:必须手动准备虚拟环境;Python 任务缺少 `.venv` 时运行失败并给出提示。 - 既没有虚拟环境、也没有 pyproject/requirements:编辑器显示错误,Python 任务运行失败。 Python 任务不再静默回退到系统解释器。 -- 解释器字段只对 Python 显示:留空会自动使用虚拟环境里的 `python.exe`; - 选择 Shell / Node / Lua 时不需要手填解释器,分别固定使用 `cmd.exe` / `node.exe` / `lua.exe`。 +- 解释器由语言自动决定,界面不再显示解释器输入框: + Python 始终使用虚拟环境里的 Python,Shell 使用 `cmd.exe`,Node 使用 `node.exe`,Lua 使用 `lua.exe`。 + 自定义解释器仍可通过 API 的 `action.interpreter` 字段传入。 命中虚拟环境后注入: @@ -253,7 +254,7 @@ queued ──► running ──► succeeded / failed / timed_out / cancelled - **编辑器**:先选任务类型(脚本 / HTTP / 二进制),脚本类型再选语言(Python / Shell / Node / Lua), 非 Python 语言会自动隐藏虚拟环境字段并调整脚本占位符;Cron 预览(实时计算未来 3/5/8/10 次)、 时区下拉、虚拟环境状态条、调用预览;探测到虚拟环境会自动回填「虚拟环境目录」,仍可手动修改; - 缺少虚拟环境但项目有依赖文件时可直接用 uv 创建。解释器字段只在 Python 下显示,留空自动使用虚拟环境 Python。 + 缺少虚拟环境但项目有依赖文件时可直接用 uv 创建。解释器由语言自动选择,界面不再要求手填。 - **目录选择**:页面内目录浏览器(盘符 → 逐级进入 → 使用此目录),同时保留手动输入。 - **日志弹窗**:运行历史筛选、SSE 实时日志、取消运行、下载日志、Escape/焦点陷阱。 - **Python 镜像**:内置清华 TUNA / 阿里云 / 中科大 / PyPI 官方;可新增、编辑、启用停用、设为默认。 diff --git a/frontend/src/App.css b/frontend/src/App.css index ff3200e..c84a01f 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -292,23 +292,21 @@ gap: 16px; } -/* 虚拟环境目录通常是一条完整路径,给它更多宽度;解释器名很短 */ -.venv-grid { - grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr); -} - -.language-grid { - align-items: start; -} - -.language-hint { +.script-language-row { display: flex; - min-height: 36px; - align-items: center; - border: 1px solid var(--su-border); - border-radius: var(--su-radius-md); - padding: 8px 12px; - background-color: var(--su-bg-subtle); + align-items: flex-end; + gap: 16px; +} + +.script-language-field { + min-width: 0; + flex: 0 0 260px; +} + +.script-language-hint { + min-width: 0; + flex: 1; + padding-bottom: 10px; } .form-select { @@ -1118,8 +1116,17 @@ grid-template-columns: 1fr; } - .venv-grid { - grid-template-columns: 1fr; + .script-language-row { + align-items: stretch; + flex-direction: column; + } + + .script-language-field { + flex: none; + } + + .script-language-hint { + padding-bottom: 0; } .cron-run-grid { diff --git a/frontend/src/components/TaskEditorModal.tsx b/frontend/src/components/TaskEditorModal.tsx index 768a274..1d38891 100644 --- a/frontend/src/components/TaskEditorModal.tsx +++ b/frontend/src/components/TaskEditorModal.tsx @@ -526,28 +526,28 @@ export function TaskEditorModal({ {actionType === 'script' ? ( -
- - ( - + applyScriptLanguage(value as ScriptLanguage) + } + /> + )} + /> +
+ + {scriptMeta.hint} + ) : null} @@ -580,34 +580,19 @@ export function TaskEditorModal({ {isPythonScript ? ( <> -
- - - - - - -
+ + +