From 5f9c6609bb7542240d78c0cb3a92ccfb4dd8e39c Mon Sep 17 00:00:00 2001 From: JSR Date: Wed, 18 Mar 2026 17:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=20OOBE=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E7=B2=98=E8=B4=B4=E5=A4=9A=E8=A1=8C=E5=A7=93?= =?UTF-8?q?=E5=90=8D=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/OOBE/OOBE.tsx | 35 ++++++++++++++++++++++++++++------- src/i18n/locales/en-US.json | 2 +- src/i18n/locales/zh-CN.json | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/components/OOBE/OOBE.tsx b/src/components/OOBE/OOBE.tsx index afaee75..f0ab428 100644 --- a/src/components/OOBE/OOBE.tsx +++ b/src/components/OOBE/OOBE.tsx @@ -166,13 +166,31 @@ export const OOBE: React.FC = ({ visible, onComplete }) => { } const addStudent = () => { - const name = newStudentName.trim() - if (!name) return - if (students.some((s) => s.name === name)) { + const input = newStudentName.trim() + if (!input) return + + const lines = input + .split(/\r?\n/) + .map((line) => line.trim()) + .filter(Boolean) + if (lines.length === 0) return + + const existing = new Set(students.map((s) => s.name)) + const added = new Set() + const newStudents: studentItem[] = [] + + lines.forEach((name) => { + if (existing.has(name) || added.has(name)) return + newStudents.push({ name }) + added.add(name) + }) + + if (newStudents.length === 0) { messageApi.warning(t("oobe.steps.students.studentExists")) return } - setStudents([...students, { name }]) + + setStudents([...students, ...newStudents]) setNewStudentName("") } @@ -530,17 +548,20 @@ export const OOBE: React.FC = ({ visible, onComplete }) => { {t("oobe.steps.students.supportedFormats")} -
- + setNewStudentName(e.target.value)} placeholder={t("oobe.steps.students.studentName")} - onPressEnter={addStudent} + autoSize={{ minRows: 2, maxRows: 5 }} />
+ + {t("oobe.steps.students.manualHint")} +