feat: 前端增加提交功能

This commit is contained in:
2025-08-19 21:02:49 +08:00
parent 2aef180ddb
commit ca0322137b
6 changed files with 236 additions and 101 deletions

View File

@@ -8,19 +8,7 @@
{{ mode === "create" ? "新建实验" : "编辑实验" }}
</h2>
<button @click="close" class="btn btn-sm btn-circle btn-ghost">
<svg
class="w-6 h-6"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
<XIcon class="w-6 h-6" />
</button>
</div>
@@ -417,11 +405,13 @@ import {
BinaryIcon,
FileArchiveIcon,
FileJsonIcon,
XIcon,
} from "lucide-vue-next";
import {
ExamClient,
ExamDto,
ResourceClient,
ResourcePurpose,
type FileParameter,
} from "@/APIClient";
import { useAlertStore } from "@/components/Alert";
@@ -685,7 +675,12 @@ async function uploadExamResources(examId: string) {
data: uploadFiles.value.mdFile,
fileName: uploadFiles.value.mdFile.name,
};
await client.addResource("doc", "template", examId, mdFileParam);
await client.addResource(
"doc",
ResourcePurpose.Template,
examId,
mdFileParam,
);
console.log("MD文档上传成功");
}
@@ -695,7 +690,12 @@ async function uploadExamResources(examId: string) {
data: imageFile,
fileName: imageFile.name,
};
await client.addResource("image", "template", examId, imageFileParam);
await client.addResource(
"image",
ResourcePurpose.Template,
examId,
imageFileParam,
);
console.log("图片上传成功:", imageFile.name);
}
@@ -707,7 +707,7 @@ async function uploadExamResources(examId: string) {
};
await client.addResource(
"bitstream",
"template",
ResourcePurpose.Template,
examId,
bitstreamFileParam,
);
@@ -720,7 +720,12 @@ async function uploadExamResources(examId: string) {
data: canvasFile,
fileName: canvasFile.name,
};
await client.addResource("canvas", "template", examId, canvasFileParam);
await client.addResource(
"canvas",
ResourcePurpose.Template,
examId,
canvasFileParam,
);
console.log("画布模板上传成功:", canvasFile.name);
}
@@ -732,7 +737,7 @@ async function uploadExamResources(examId: string) {
};
await client.addResource(
"resource",
"template",
ResourcePurpose.Template,
examId,
resourceFileParam,
);
@@ -775,6 +780,7 @@ defineExpose({
show,
close,
editExam,
editExamInfo,
});
</script>