From 93c133349a5ccd7a328371fa113dce69d5611f21 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:39 +0800
Subject: [PATCH] feat(tms): 完成课程考试自测等页面与接口对接
---
apps/jnpf-web-apps-main/src/views/x/tms/examGrade/Mark.vue | 57 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/examGrade/Mark.vue b/apps/jnpf-web-apps-main/src/views/x/tms/examGrade/Mark.vue
index 9c30b38..86e1738 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/examGrade/Mark.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/examGrade/Mark.vue
@@ -1,15 +1,19 @@
<script lang="ts" setup>
import type { GradeExamDetail, GradeExamItem } from './types';
-import { computed, onMounted, reactive, ref } from 'vue';
+import { computed, onMounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useMessage } from '@jnpf/hooks';
+import { Modal } from 'ant-design-vue';
import { getGradeExamDetail, submitGrade } from '#/api/x/tms/examGrade';
-import { labelOfType } from '#/views/x/tms/question/constants';
+import { labelOfType, loadQuestionDics } from '#/views/x/tms/question/constants';
+import { TMS_BTN } from '#/views/x/tms/shared/ui';
-import { colorOfGradeStatus, labelOfGradeStatus } from './constants';
+import { colorOfGradeStatus, labelOfGradeStatus, loadExamGradeDics } from './constants';
+
+import '#/views/x/tms/shared/page.css';
defineOptions({ name: 'TmsExamGradeMark' });
@@ -36,9 +40,21 @@
return Number(detail.value.objectiveScore || 0) + subjectiveTotal.value;
});
-onMounted(() => {
- loadDetail();
+onMounted(async () => {
+ await Promise.all([loadExamGradeDics(), loadQuestionDics()]);
+ await loadDetail();
});
+
+watch(
+ () => String(route.params.id || ''),
+ async (id, prev) => {
+ if (!id || id === prev) return;
+ Object.keys(scoreMap).forEach((key) => {
+ delete scoreMap[key];
+ });
+ await loadDetail();
+ },
+);
async function loadDetail() {
const id = String(route.params.id || '');
@@ -91,19 +107,30 @@
}
async function handleSubmit() {
- if (!detail.value || readonly.value) return;
+ if (!detail.value || readonly.value || saving.value) return;
const err = validateScores();
if (err) {
createMessage.warning(err);
return;
}
+ Modal.confirm({
+ title: '纭鎻愪氦',
+ content: '鎻愪氦鍚庝笉鍙慨鏀癸紝纭畾鎻愪氦鍚楋紵',
+ okText: '纭',
+ cancelText: '鍙栨秷',
+ onOk: () => doSubmit(),
+ });
+}
+
+async function doSubmit() {
+ if (!detail.value || readonly.value || saving.value) return;
saving.value = true;
try {
const items = detail.value.items
.filter((x) => x.isSubjective === '1')
.map((x) => ({ id: x.id, gotScore: Number(scoreMap[x.id] || 0) }));
- await submitGrade({ examId: detail.value.examId, items });
- createMessage.success(`闃呭嵎瀹屾垚锛屾�诲垎 ${previewTotal.value}`);
+ const result = await submitGrade({ examId: detail.value.examId, items });
+ createMessage.success(`闃呭嵎瀹屾垚锛屾�诲垎 ${result?.totalScore ?? previewTotal.value}`);
goBack();
} catch (e: any) {
createMessage.error(e?.message || '鎻愪氦澶辫触');
@@ -122,12 +149,10 @@
<div class="jnpf-content-wrapper-center tms-grade-center">
<div class="jnpf-content-wrapper-content tms-grade-mark-wrap">
<div class="mark-top">
- <div class="mark-header">
+ <div class="mark-header tms-page-header">
<div>
- <div class="text-base font-medium">
- {{ detail?.paperName || '闃呭嵎' }} 路 闃呭嵎
- </div>
- <div v-if="detail" class="mt-1 text-gray-400 text-sm">
+ <div class="tms-page-header__title">{{ detail?.paperName || '闃呭嵎' }} 路 闃呭嵎</div>
+ <div v-if="detail" class="tms-page-header__sub">
鑰冪敓锛歿{ detail.userName }}
<span v-if="detail.deptName">锛坽{ detail.deptName }}锛�</span>
<span class="ml-3">浜ゅ嵎锛歿{ detail.submitTime || '-' }}</span>
@@ -136,12 +161,12 @@
</span>
</div>
</div>
- <a-space>
- <a-button @click="goBack">杩斿洖</a-button>
+ <div class="tms-page-header__actions">
+ <a-button @click="goBack">{{ TMS_BTN.back }}</a-button>
<a-button v-if="detail && !readonly" type="primary" :loading="saving" @click="handleSubmit">
鎻愪氦闃呭嵎
</a-button>
- </a-space>
+ </div>
</div>
<div v-if="detail" class="score-bar">
--
Gitblit v1.8.0