mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
feat: 导入名单改为下拉并更新协作提交规则
This commit is contained in:
@@ -45,4 +45,5 @@ Thumbs.db
|
||||
# Tauri local/generated artifacts
|
||||
src-tauri/data.sql
|
||||
src-tauri/gen/
|
||||
AGENTS.md
|
||||
```
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
- 所有代码跑`pnpm run typecheck` or `cargo typecheck`必须通过。
|
||||
|
||||
## 提交与推送要求
|
||||
- 每次代码修改后,除非用户说明需要一次 Git 提交(commit),否则不进行。
|
||||
- 每次代码修改后,必须进行一次 Git 提交(commit)并推送(git push)。
|
||||
- 提交信息必须使用中文。
|
||||
- 提交信息必须遵循 Conventional Commits 规范,格式示例:`feat: 新增登录页表单校验`、`fix: 修复导出报告空指针问题`。
|
||||
- 每次提交完成后,必须将对应提交推送到远端仓库(`git push`)。
|
||||
|
||||
@@ -92,7 +92,6 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState<number>(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 }) => {
|
||||
<Button disabled={!canEdit} onClick={openGroupBoardEditor}>
|
||||
{t("students.groupBoardEdit")}
|
||||
</Button>
|
||||
<Button disabled={!canEdit} onClick={handleOpenImportOptions}>
|
||||
{t("students.importList")}
|
||||
</Button>
|
||||
<Dropdown trigger={["click"]} menu={importMenu} disabled={!canEdit}>
|
||||
<Button disabled={!canEdit}>{t("students.importList")}</Button>
|
||||
</Dropdown>
|
||||
<Button type="primary" disabled={!canEdit} onClick={() => setVisible(true)}>
|
||||
{t("students.addStudent")}
|
||||
</Button>
|
||||
@@ -1475,26 +1479,6 @@ export const StudentManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={t("students.importOptionsTitle")}
|
||||
open={importOptionsVisible}
|
||||
onCancel={() => setImportOptionsVisible(false)}
|
||||
footer={null}
|
||||
destroyOnHidden
|
||||
>
|
||||
<Space orientation="vertical" style={{ width: "100%" }}>
|
||||
<Button type="primary" disabled={!canEdit} onClick={handleOpenTextImport}>
|
||||
{t("students.importByText")}
|
||||
</Button>
|
||||
<Button loading={xlsxLoading} disabled={!canEdit} onClick={handleOpenXlsxImport}>
|
||||
{t("students.importByXlsx")}
|
||||
</Button>
|
||||
<Button disabled={!canEdit} onClick={handleOpenBanYouImport}>
|
||||
{t("students.importByBanyou")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={t("students.importByText")}
|
||||
open={textImportVisible}
|
||||
|
||||
@@ -468,7 +468,6 @@
|
||||
"tagSaveSuccess": "Tags saved successfully",
|
||||
"tagSaveFailed": "Failed to save tags",
|
||||
"importTitle": "Import List",
|
||||
"importOptionsTitle": "Choose Import Method",
|
||||
"importTextHint": "Paste multiple lines, one student name per line",
|
||||
"importTextPlaceholder": "Example:\nAlice\nBob\nCharlie",
|
||||
"importByText": "Import from Text",
|
||||
|
||||
@@ -468,7 +468,6 @@
|
||||
"tagSaveSuccess": "标签保存成功",
|
||||
"tagSaveFailed": "保存标签失败",
|
||||
"importTitle": "导入名单",
|
||||
"importOptionsTitle": "选择导入方式",
|
||||
"importTextHint": "支持粘贴多行文本,一行一个姓名",
|
||||
"importTextPlaceholder": "例如:\n张三\n李四\n王五",
|
||||
"importByText": "从文本导入",
|
||||
|
||||
Reference in New Issue
Block a user