|
@@ -183,20 +183,20 @@ export default {
|
|
|
this.modalForm.subQuestions[index].newQuestion.questionKey;
|
|
|
this.activeNames = this.activeNames.filter((k) => k !== delQuestionKey);
|
|
|
},
|
|
|
- answerPointsChange(answerPointsCount) {
|
|
|
- let curSubQuestionCount = this.modalForm.subQuestions.length;
|
|
|
- if (curSubQuestionCount === answerPointsCount) return;
|
|
|
-
|
|
|
- if (curSubQuestionCount > answerPointsCount) {
|
|
|
- this.modalForm.subQuestions = this.modalForm.subQuestions.slice(
|
|
|
- 0,
|
|
|
- answerPointsCount
|
|
|
- );
|
|
|
- } else {
|
|
|
- for (let i = curSubQuestionCount; i < answerPointsCount; i++) {
|
|
|
- this.addSubQuestion("SINGLE_ANSWER_QUESTION");
|
|
|
+ answerPointsChange(answerPointsChanged) {
|
|
|
+ let subQuestions = [];
|
|
|
+ answerPointsChanged.forEach((item) => {
|
|
|
+ const order = Number(item);
|
|
|
+ if (order === 0) {
|
|
|
+ let newQuestion = getInitQuestionModel("SINGLE_ANSWER_QUESTION");
|
|
|
+ newQuestion.questionKey = randomCode();
|
|
|
+ newQuestion.courseId = this.question.courseId;
|
|
|
+ subQuestions.push(newQuestion);
|
|
|
+ } else {
|
|
|
+ subQuestions.push(this.modalForm.subQuestions[order - 1]);
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ this.modalForm.subQuestions = subQuestions;
|
|
|
},
|
|
|
quesBodyChange() {
|
|
|
this.$refs.modalFormComp.validateField(`quesBody`, () => {});
|