feat: 完成提交作业的后端

This commit is contained in:
2025-08-14 11:38:09 +08:00
parent 24622d30cf
commit e5dac3e731
13 changed files with 808 additions and 203 deletions

View File

@@ -473,7 +473,7 @@ const canCreateExam = computed(() => {
editExamInfo.value.id.trim() !== "" &&
editExamInfo.value.name.trim() !== "" &&
editExamInfo.value.description.trim() !== "" &&
uploadFiles.value.mdFile !== null
(uploadFiles.value.mdFile !== null || mode.value === "edit")
);
});

View File

@@ -166,9 +166,20 @@
<!-- 提交历史 -->
<div class="space-y-3">
<h4 class="font-medium text-base-content">提交历史</h4>
<div class="text-sm text-base-content/50 text-center py-4">
<div
v-if="isUndefined(commitsList)"
class="text-sm text-base-content/50 text-center py-4"
>
暂无提交记录
</div>
<div v-else class="overflow-y-auto">
<ul class="steps steps-vertical">
<li class="step step-primary">Register</li>
<li class="step step-primary">Choose plan</li>
<li class="step">Purchase</li>
<li class="step">Receive Product</li>
</ul>
</div>
</div>
</div>
</div>
@@ -239,13 +250,19 @@
</div>
</template>
<script setup lang="ts">
import type { ExamInfo } from "@/APIClient";
import type { Commit, ExamInfo } from "@/APIClient";
import { useAlertStore } from "@/components/Alert";
import { AuthManager } from "@/utils/AuthManager";
import { useRequiredInjection } from "@/utils/Common";
import { defineModel, ref } from "vue";
import { useRouter } from "vue-router";
import { formatDate } from "@/utils/Common";
import { computed } from "vue";
import { watch } from "vue";
import { isNull, isUndefined } from "lodash";
const alertStore = useRequiredInjection(useAlertStore);
const router = useRouter();
const show = defineModel<boolean>("show", {
default: false,
@@ -255,8 +272,13 @@ const props = defineProps<{
selectedExam: ExamInfo;
}>();
const alertStore = useRequiredInjection(useAlertStore);
const router = useRouter();
const commitsList = ref<Commit[]>();
async function updateCommits() {
const client = AuthManager.createAuthenticatedExamClient();
const list = await client.getCommitsByExamId(props.selectedExam.id);
commitsList.value = list;
}
watch(() => props.selectedExam, updateCommits);
// Download resources
const downloadingResources = ref(false);