|
@@ -34,7 +34,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { onMounted, watch } from "vue";
|
|
|
|
|
|
+import { onMounted, watch, h } from "vue";
|
|
import {
|
|
import {
|
|
clearMarkTask,
|
|
clearMarkTask,
|
|
getGroup,
|
|
getGroup,
|
|
@@ -259,20 +259,25 @@ const saveTaskToServer = async () => {
|
|
const mkey = "save_task_key";
|
|
const mkey = "save_task_key";
|
|
|
|
|
|
const errors = markResult.scoreList.reduce((p, c, index) => {
|
|
const errors = markResult.scoreList.reduce((p, c, index) => {
|
|
- if (!isNumber(c) && store.currentTask) {
|
|
|
|
- const question = store.currentTask.questionList[index];
|
|
|
|
- p.push({
|
|
|
|
- question,
|
|
|
|
- index,
|
|
|
|
- error: `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`,
|
|
|
|
- });
|
|
|
|
|
|
+ const question = store.currentTask?.questionList[index]!;
|
|
|
|
+ let error;
|
|
|
|
+ if (!isNumber(c)) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
|
|
|
|
+ } else if (isNumber(question.maxScore) && c > question.maxScore) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
|
|
|
|
+ } else if (isNumber(question.minScore) && c < question.minScore) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
|
|
|
|
+ }
|
|
|
|
+ if (error) {
|
|
|
|
+ p.push({ question, index, error });
|
|
}
|
|
}
|
|
return p;
|
|
return p;
|
|
}, [] as Array<{ question: Question; index: number; error: string }>);
|
|
}, [] as Array<{ question: Question; index: number; error: string }>);
|
|
if (errors.length !== 0) {
|
|
if (errors.length !== 0) {
|
|
console.log(errors);
|
|
console.log(errors);
|
|
- message.error({
|
|
|
|
- content: errors.map((e) => `${e.error}`).join("\n"),
|
|
|
|
|
|
+ const msg = errors.map((v) => h("div", `${v.error}`));
|
|
|
|
+ message.warning({
|
|
|
|
+ content: h("span", ["校验失败", ...msg]),
|
|
duration: 10,
|
|
duration: 10,
|
|
key: mkey,
|
|
key: mkey,
|
|
});
|
|
});
|