|
@@ -281,24 +281,33 @@ export default {
|
|
|
// 清除所有连线
|
|
|
clearLine() {
|
|
|
if (!this.TaskModel || this.TaskModel != "ANSWER") {
|
|
|
- let arr = [];
|
|
|
this.data.forEach((item) => {
|
|
|
- if (item.source.indexOf("Isexample") != -1) {
|
|
|
- arr.push(item);
|
|
|
+ if (item.source) {
|
|
|
+ if (item.source.indexOf("Isexample") == -1) {
|
|
|
+ item.source = null;
|
|
|
+ item.target = null;
|
|
|
+ if (
|
|
|
+ Object.prototype.toString.call(item.answer).indexOf("Number") !=
|
|
|
+ -1
|
|
|
+ ) {
|
|
|
+ item.userAnswerJudge = "[JUDGE##F##JUDGE]";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
this.jsPlumb.deleteEveryConnection(); //清除连线方法
|
|
|
- this.data = [];
|
|
|
- this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
|
|
|
- if (arr.length > 0) {
|
|
|
- this.data = JSON.parse(JSON.stringify(arr));
|
|
|
- this.data.forEach((item) => {
|
|
|
- this.jsPlumb.connect({
|
|
|
- source: item.source,
|
|
|
- target: item.target,
|
|
|
- });
|
|
|
+ this.$set(
|
|
|
+ this.curQue,
|
|
|
+ "Bookanswer",
|
|
|
+ JSON.parse(JSON.stringify(this.data))
|
|
|
+ );
|
|
|
+
|
|
|
+ this.data.forEach((item) => {
|
|
|
+ this.jsPlumb.connect({
|
|
|
+ source: item.source,
|
|
|
+ target: item.target,
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
showPlumb() {
|
|
@@ -355,15 +364,27 @@ export default {
|
|
|
}
|
|
|
if (!this.TaskModel || this.TaskModel != "ANSWER") {
|
|
|
// 删除点击的线
|
|
|
- this.data.forEach((item, i) => {
|
|
|
- if (item.source == conn.sourceId) {
|
|
|
- this.data.splice(i, 1);
|
|
|
+ this.curQue.con.forEach((item, i) => {
|
|
|
+ if (item.nodeId == conn.sourceId) {
|
|
|
+ this.$set(this.data[i], "source", null);
|
|
|
+ this.$set(this.data[i], "target", null);
|
|
|
+ if (
|
|
|
+ Object.prototype.toString
|
|
|
+ .call(item.AnswerList)
|
|
|
+ .indexOf("Number") != -1
|
|
|
+ ) {
|
|
|
+ this.$set(this.data[i], "userAnswerJudge", "[JUDGE##F##JUDGE]");
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
let node = document.getElementById(conn.sourceId);
|
|
|
this.jsPlumb.removeAllEndpoints(node);
|
|
|
sessionStorage.setItem("LineData", JSON.stringify(this.data));
|
|
|
- this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
|
|
|
+ this.$set(
|
|
|
+ this.curQue,
|
|
|
+ "Bookanswer",
|
|
|
+ JSON.parse(JSON.stringify(this.data))
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -377,12 +398,43 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
if (!fig) {
|
|
|
- this.data.push({
|
|
|
- source: conn.sourceId,
|
|
|
- target: conn.targetId,
|
|
|
+ this.curQue.con.forEach((item, i) => {
|
|
|
+ if (conn.sourceId == item.nodeId) {
|
|
|
+ this.$set(this.data[i], "source", conn.sourceId);
|
|
|
+ this.$set(this.data[i], "target", conn.targetId);
|
|
|
+ if (
|
|
|
+ Object.prototype.toString
|
|
|
+ .call(item.AnswerList)
|
|
|
+ .indexOf("Number") != -1
|
|
|
+ ) {
|
|
|
+ if (
|
|
|
+ conn.targetId == this.curQue.option[item.AnswerList].nodeId
|
|
|
+ ) {
|
|
|
+ this.$set(
|
|
|
+ this.data[i],
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##T##JUDGE]"
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.data[i],
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##F##JUDGE]"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
+ // this.data.push({
|
|
|
+ // source: conn.sourceId,
|
|
|
+ // target: conn.targetId,
|
|
|
+ // });
|
|
|
sessionStorage.setItem("LineData", JSON.stringify(this.data));
|
|
|
- this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
|
|
|
+ this.$set(
|
|
|
+ this.curQue,
|
|
|
+ "Bookanswer",
|
|
|
+ JSON.parse(JSON.stringify(this.data))
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -463,10 +515,12 @@ export default {
|
|
|
}
|
|
|
if (item.Isexample) {
|
|
|
this.data.push({
|
|
|
+ id: item.nodeId,
|
|
|
source: item.nodeId,
|
|
|
target: "right_" + item.AnswerList + this.number,
|
|
|
index: i,
|
|
|
answer: item.AnswerList,
|
|
|
+ userAnswerJudge: "",
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -479,6 +533,21 @@ export default {
|
|
|
this.allimgnumber++;
|
|
|
}
|
|
|
});
|
|
|
+ this.curQue.con.forEach((item, i) => {
|
|
|
+ if (!item.Isexample) {
|
|
|
+ this.data.push({
|
|
|
+ answer: item.AnswerList,
|
|
|
+ index: i,
|
|
|
+ source: null,
|
|
|
+ target: null,
|
|
|
+ userAnswerJudge:
|
|
|
+ Object.prototype.toString.call(item.AnswerList).indexOf("Number") ==
|
|
|
+ -1
|
|
|
+ ? ""
|
|
|
+ : "[JUDGE##F##JUDGE]",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|