|
@@ -276,7 +276,9 @@
|
|
|
<rich-text
|
|
|
:text-json="paperDetailUnit.question.quesBody"
|
|
|
></rich-text>
|
|
|
- <span> ({{ paperDetailUnit.score }}分) </span>
|
|
|
+ <span :class="{ 'color-danger': !paperDetailUnit.score }">
|
|
|
+ ({{ paperDetailUnit.score }}分)
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="edit-cont-body">
|
|
|
<div
|
|
@@ -551,6 +553,7 @@
|
|
|
ref="SelectQuestionDialog"
|
|
|
:course-id="paper.course.id"
|
|
|
:disabled-question-ids="paperQuestionIds"
|
|
|
+ select-mode="paper"
|
|
|
@confirm="questionSelected"
|
|
|
></select-question-dialog>
|
|
|
</div>
|
|
@@ -568,7 +571,7 @@ import {
|
|
|
paperQuestionDeleteApi,
|
|
|
paperQuestionSaveApi,
|
|
|
paperDetailAddQuestionApi,
|
|
|
- // paperQuestionChangeApi,
|
|
|
+ paperQuestionChangeApi,
|
|
|
} from "../api";
|
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
|
|
@@ -656,6 +659,10 @@ export default {
|
|
|
});
|
|
|
this.paper = res.data;
|
|
|
this.showCheckDuplicate();
|
|
|
+
|
|
|
+ if (!this.checkPaperQuestionAllHasScore()) {
|
|
|
+ this.$notify.error("有小题未设置分值!");
|
|
|
+ }
|
|
|
},
|
|
|
// header-actions
|
|
|
showCheckDuplicate() {
|
|
@@ -680,6 +687,11 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ checkPaperQuestionAllHasScore() {
|
|
|
+ return !this.paper.paperDetails.some((detail) => {
|
|
|
+ return detail.paperDetailUnits.some((qUnit) => !qUnit.question.score);
|
|
|
+ });
|
|
|
+ },
|
|
|
// 保存试卷
|
|
|
async toSavePaper() {
|
|
|
const res = await paperSaveApi(this.paper).catch((error) => {
|
|
@@ -894,12 +906,23 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 更换试题
|
|
|
- toChangeQues(row) {
|
|
|
- // let question = row.question;
|
|
|
- // if (!this.changeSelectQuestionMap[question.sourceDetailId])
|
|
|
- // this.changeSelectQuestionMap[question.sourceDetailId] = [];
|
|
|
+ async toChangeQues(row) {
|
|
|
+ let question = row.question;
|
|
|
+ if (!this.changeSelectQuestionMap[question.sourceDetailId])
|
|
|
+ this.changeSelectQuestionMap[question.sourceDetailId] = [];
|
|
|
|
|
|
- console.log(row);
|
|
|
+ const res = await paperQuestionChangeApi(
|
|
|
+ row.id,
|
|
|
+ this.changeSelectQuestionMap[question.sourceDetailId].join()
|
|
|
+ ).catch(() => {});
|
|
|
+
|
|
|
+ if (!res) return;
|
|
|
+
|
|
|
+ if (!this.changeSelectQuestionMap[question.sourceDetailId].length) {
|
|
|
+ this.changeSelectQuestionMap[question.sourceDetailId].push(question.id);
|
|
|
+ }
|
|
|
+ this.changeSelectQuestionMap[question.sourceDetailId].push(res.data);
|
|
|
+ this.initPaper();
|
|
|
},
|
|
|
// 编辑小题
|
|
|
toEditQues(row) {
|