From 7f5613f19a075cad97769ad5f5ea6e2cbce531e4 Mon Sep 17 00:00:00 2001
From: 梁保满
{
+ questionList = data.list.sort((a, b) => {
return a.questionIndex - b.questionIndex;
});
}
- this.formateQuestion();
+ this.formateQuestion(questionList);
} else {
this.$message.error(info);
}
},
- formateQuestion() {
- if (this.questionList[0]?.subQuestions) {
- this.questionList?.map((item) => {
+ formateQuestion(arr) {
+ if (arr[0]?.subQuestions) {
+ this.questionList = arr.map((item) => {
let types = [{}];
let addndex = 0;
item.subQuestions.map((sub, index) => {
+ sub.answerOptions = sub.answerOptions || "A,B,C,D";
if (!!sub.questionType) {
if (
sub.questionType == types[addndex].qusType &&
@@ -1085,11 +1087,13 @@ export default {
);
}
}
+ return item;
});
} else {
let types = [{}];
let addndex = 0;
- this.questionList?.map((sub, index) => {
+ this.questionList = arr.map((sub, index) => {
+ sub.answerOptions = sub.answerOptions || "A,B,C,D";
if (!!sub.questionType) {
if (
sub.questionType == types[addndex].qusType &&
@@ -1132,6 +1136,7 @@ export default {
);
}
}
+ return sub;
});
for (let i = 0; i < types.length; i++) {
if (types[i].qusType == 3) {
@@ -1146,6 +1151,7 @@ export default {
}
}
}
+ console.log(this.questionList);
},
},
};
--
libgit2 0.21.4