|
@@ -273,29 +273,33 @@ export default {
|
|
|
this.data.data.forEach((items) => {
|
|
|
if (type == "left") {
|
|
|
if (items.source) {
|
|
|
- if (items.source == item.nodeId) {
|
|
|
- if (items.correct) {
|
|
|
- clss = "correct";
|
|
|
- } else if (items.error) {
|
|
|
- clss = "error";
|
|
|
- }
|
|
|
+ if (items.correct) {
|
|
|
+ clss = "correct";
|
|
|
+ } else if (items.error) {
|
|
|
+ clss = "error";
|
|
|
}
|
|
|
} else {
|
|
|
- if (items.error) {
|
|
|
+ if (
|
|
|
+ Object.prototype.toString
|
|
|
+ .call(items.answer)
|
|
|
+ .indexOf("Number") != -1
|
|
|
+ ) {
|
|
|
clss = "error";
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (items.target) {
|
|
|
- if (items.target == item.nodeId) {
|
|
|
- if (items.correct) {
|
|
|
- clss = "correct";
|
|
|
- } else if (items.error) {
|
|
|
- clss = "error";
|
|
|
- }
|
|
|
+ if (items.correct) {
|
|
|
+ clss = "correct";
|
|
|
+ } else if (items.error) {
|
|
|
+ clss = "error";
|
|
|
}
|
|
|
} else {
|
|
|
- if (items.error) {
|
|
|
+ if (
|
|
|
+ Object.prototype.toString
|
|
|
+ .call(items.answer)
|
|
|
+ .indexOf("Number") != -1
|
|
|
+ ) {
|
|
|
clss = "error";
|
|
|
}
|
|
|
}
|
|
@@ -402,6 +406,7 @@ export default {
|
|
|
this.$set(this.data.data[i], "target", null);
|
|
|
}
|
|
|
});
|
|
|
+ this.changeAllCorrect();
|
|
|
let node = document.getElementById(conn.sourceId);
|
|
|
this.jsPlumb.removeAllEndpoints(node);
|
|
|
sessionStorage.setItem("LineData", JSON.stringify(this.data));
|
|
@@ -553,7 +558,9 @@ export default {
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
this.allimgnumber = 0;
|
|
|
+ let flag = false;
|
|
|
if (!this.curQue.Bookanswer) {
|
|
|
+ flag = true;
|
|
|
// sData = JSON.parse(sessionStorage.getItem("LineData"));
|
|
|
let isanswer = false;
|
|
|
this.curQue.con.forEach((con) => {
|
|
@@ -580,13 +587,15 @@ export default {
|
|
|
if (item.img_list.length > 0) {
|
|
|
this.allimgnumber++;
|
|
|
}
|
|
|
- if (item.Isexample) {
|
|
|
- this.data.data.push({
|
|
|
- source: item.nodeId,
|
|
|
- target: "right_" + item.AnswerList + this.number + this.judgeAnswer,
|
|
|
- index: i,
|
|
|
- answer: item.AnswerList,
|
|
|
- });
|
|
|
+ if (flag) {
|
|
|
+ if (item.Isexample) {
|
|
|
+ this.data.data.push({
|
|
|
+ source: item.nodeId,
|
|
|
+ target: "right_" + item.AnswerList + this.number + this.judgeAnswer,
|
|
|
+ index: i,
|
|
|
+ answer: item.AnswerList,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
this.curQue.option.forEach((item, i) => {
|
|
@@ -598,21 +607,23 @@ export default {
|
|
|
this.allimgnumber++;
|
|
|
}
|
|
|
});
|
|
|
- this.curQue.con.forEach((item, i) => {
|
|
|
- if (!item.Isexample) {
|
|
|
- this.data.data.push({
|
|
|
- answer: item.AnswerList,
|
|
|
- index: i,
|
|
|
- source: null,
|
|
|
- target: null,
|
|
|
- // userAnswerJudge:
|
|
|
- // Object.prototype.toString.call(item.AnswerList).indexOf("Number") ==
|
|
|
- // -1
|
|
|
- // ? ""
|
|
|
- // : "[JUDGE##F##JUDGE]",
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ if (flag) {
|
|
|
+ this.curQue.con.forEach((item, i) => {
|
|
|
+ if (!item.Isexample) {
|
|
|
+ this.data.data.push({
|
|
|
+ answer: item.AnswerList,
|
|
|
+ index: i,
|
|
|
+ source: null,
|
|
|
+ target: null,
|
|
|
+ // userAnswerJudge:
|
|
|
+ // Object.prototype.toString.call(item.AnswerList).indexOf("Number") ==
|
|
|
+ // -1
|
|
|
+ // ? ""
|
|
|
+ // : "[JUDGE##F##JUDGE]",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
if (
|
|
|
this.judgeAnswer == "studentAnswer" ||
|
|
@@ -624,14 +635,16 @@ export default {
|
|
|
? "left_" + i + this.number + "Isexample" + this.judgeAnswer
|
|
|
: "left_" + i + this.number + this.judgeAnswer;
|
|
|
item.nodeId = nodeId;
|
|
|
-
|
|
|
- if (item.Isexample) {
|
|
|
- this.data.data.push({
|
|
|
- source: item.nodeId,
|
|
|
- target: "right_" + item.AnswerList + this.number + this.judgeAnswer,
|
|
|
- index: i,
|
|
|
- answer: item.AnswerList,
|
|
|
- });
|
|
|
+ if (flag) {
|
|
|
+ if (item.Isexample) {
|
|
|
+ this.data.data.push({
|
|
|
+ source: item.nodeId,
|
|
|
+ target:
|
|
|
+ "right_" + item.AnswerList + this.number + this.judgeAnswer,
|
|
|
+ index: i,
|
|
|
+ answer: item.AnswerList,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
this.curQue.option.forEach((item, i) => {
|
|
@@ -689,31 +702,30 @@ export default {
|
|
|
this.judgeAnswer == "userAnswer"
|
|
|
) {
|
|
|
this.data.data.forEach((item) => {
|
|
|
- this.curQue.con.forEach((con) => {
|
|
|
- if (item.source == con.nodeId) {
|
|
|
- if (
|
|
|
- Object.prototype.toString
|
|
|
- .call(con.AnswerList)
|
|
|
- .indexOf("Number") != -1
|
|
|
- ) {
|
|
|
- if (item.target == this.curQue.option[con.AnswerList].nodeId) {
|
|
|
- item.correct = true;
|
|
|
- } else {
|
|
|
- item.error = true;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (
|
|
|
- Object.prototype.toString
|
|
|
- .call(con.AnswerList)
|
|
|
- .indexOf("Number") != -1
|
|
|
- ) {
|
|
|
- if (item.correct != true) {
|
|
|
- item.error = true;
|
|
|
+ if (item.source) {
|
|
|
+ this.curQue.con.forEach((con) => {
|
|
|
+ if (item.source == con.nodeId) {
|
|
|
+ if (
|
|
|
+ Object.prototype.toString
|
|
|
+ .call(con.AnswerList)
|
|
|
+ .indexOf("Number") != -1
|
|
|
+ ) {
|
|
|
+ if (item.target == this.curQue.option[con.AnswerList].nodeId) {
|
|
|
+ item.correct = true;
|
|
|
+ } else {
|
|
|
+ item.error = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // else if (
|
|
|
+ // !item.source &&
|
|
|
+ // !item.target &&
|
|
|
+ // Object.prototype.toString.call(item.answer).indexOf("Number") != -1
|
|
|
+ // ) {
|
|
|
+ // item.error = true;
|
|
|
+ // }
|
|
|
});
|
|
|
}
|
|
|
|