From ec98aba087a2fe4231f1abfb720289b1d6dd7900 Mon Sep 17 00:00:00 2001 From: JSR Date: Thu, 26 Mar 2026 16:22:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=85=A5=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=8B=E6=8B=89=E5=B9=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=8F=E4=BD=9C=E6=8F=90=E4=BA=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + AGENTS.md | 2 +- src/components/StudentManager.tsx | 56 +++++++++++-------------------- src/i18n/locales/en-US.json | 1 - src/i18n/locales/zh-CN.json | 1 - 5 files changed, 22 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 261e7f8..6d02767 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ Thumbs.db # Tauri local/generated artifacts src-tauri/data.sql src-tauri/gen/ +AGENTS.md ``` diff --git a/AGENTS.md b/AGENTS.md index 9770b40..5ccefd3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,7 +5,7 @@ - 所有代码跑`pnpm run typecheck` or `cargo typecheck`必须通过。 ## 提交与推送要求 -- 每次代码修改后,除非用户说明需要一次 Git 提交(commit),否则不进行。 +- 每次代码修改后,必须进行一次 Git 提交(commit)并推送(git push)。 - 提交信息必须使用中文。 - 提交信息必须遵循 Conventional Commits 规范,格式示例:`feat: 新增登录页表单校验`、`fix: 修复导出报告空指针问题`。 - 每次提交完成后,必须将对应提交推送到远端仓库(`git push`)。 diff --git a/src/components/StudentManager.tsx b/src/components/StudentManager.tsx index 7273070..444719e 100644 --- a/src/components/StudentManager.tsx +++ b/src/components/StudentManager.tsx @@ -92,7 +92,6 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { const [currentPage, setCurrentPage] = useState(1) const [pageSize, setPageSize] = useState(50) const [visible, setVisible] = useState(false) - const [importOptionsVisible, setImportOptionsVisible] = useState(false) const [textImportVisible, setTextImportVisible] = useState(false) const [xlsxVisible, setXlsxVisible] = useState(false) const [banYouVisible, setBanYouVisible] = useState(false) @@ -636,7 +635,6 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { setXlsxAoa(event.data.data) setXlsxSelectedCol(null) setXlsxVisible(true) - setImportOptionsVisible(false) setTextImportVisible(false) setXlsxLoading(false) } else if (event.data.type === "error") { @@ -799,26 +797,15 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { } } - const handleOpenImportOptions = () => { - if (!canEdit) { - messageApi.error(t("common.readOnly")) - return - } - setImportOptionsVisible(true) - } - const handleOpenTextImport = () => { - setImportOptionsVisible(false) setTextImportVisible(true) } const handleOpenXlsxImport = () => { - setImportOptionsVisible(false) xlsxInputRef.current?.click() } const handleOpenBanYouImport = () => { - setImportOptionsVisible(false) setBanYouVisible(true) } @@ -1209,6 +1196,23 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { ? editFormGroupName.trim() : "" + const importMenu = { + items: [ + { key: "text", label: t("students.importByText") }, + { key: "xlsx", label: t("students.importByXlsx") }, + { key: "banyou", label: t("students.importByBanyou") }, + ], + onClick: ({ key }: { key: string }) => { + if (!canEdit) { + messageApi.error(t("common.readOnly")) + return + } + if (key === "text") handleOpenTextImport() + else if (key === "xlsx") handleOpenXlsxImport() + else if (key === "banyou") handleOpenBanYouImport() + }, + } + const paginatedData = data.slice((currentPage - 1) * pageSize, currentPage * pageSize) return ( @@ -1220,9 +1224,9 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { - + + + @@ -1475,26 +1479,6 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => { )} - setImportOptionsVisible(false)} - footer={null} - destroyOnHidden - > - - - - - - -