|
@@ -1,8 +1,28 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
<div class="Big-Book-prev-Textdes sentenceSort" v-if="curQue">
|
|
|
+ <h6
|
|
|
+ v-if="judgeAnswer == 'userAnswer' || judgeAnswer == 'studentAnswer'"
|
|
|
+ class="standardTitle"
|
|
|
+ style="margin: 10px 0 8px 24px"
|
|
|
+ >
|
|
|
+ {{ judgeAnswer == "userAnswer" ? "Your answer" : "Student answers" }}
|
|
|
+ </h6>
|
|
|
+ <h6
|
|
|
+ v-else-if="judgeAnswer == 'standardAnswer'"
|
|
|
+ class="standardTitle"
|
|
|
+ style="margin: 10px 0 8px 24px"
|
|
|
+ >
|
|
|
+ Standard answer
|
|
|
+ </h6>
|
|
|
<h2>{{ curQue.title }}</h2>
|
|
|
- <div class="item-box" v-for="(item, index) in curQue.Bookanswer" :key="index">
|
|
|
+ <div
|
|
|
+ class="item-box"
|
|
|
+ v-for="(item, index) in judgeAnswer == 'standardAnswer'
|
|
|
+ ? userErrList
|
|
|
+ : curQue.Bookanswer"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
<div class="item-right">
|
|
|
<b>{{ index + 1 }}</b>
|
|
|
<draggable
|
|
@@ -14,7 +34,7 @@
|
|
|
:options="{
|
|
|
group: { name: 'itxst' + index, pull: 'clone' },
|
|
|
}"
|
|
|
- :sort="TaskModel=='ANSWER'?'false':'true'"
|
|
|
+ :sort="TaskModel == 'ANSWER' ? 'false' : 'true'"
|
|
|
class="content-box"
|
|
|
>
|
|
|
<transition-group>
|
|
@@ -24,8 +44,15 @@
|
|
|
JSON.stringify(SortArr[index]).indexOf(itemNode.index) != -1
|
|
|
? 'select'
|
|
|
: '',
|
|
|
+ judgeAnswer == 'standardAnswer'
|
|
|
+ ? 'correct'
|
|
|
+ : itemNode.correct == 'correct'
|
|
|
+ ? 'correct'
|
|
|
+ : 'error',
|
|
|
]"
|
|
|
- v-for="(itemNode, indexNode) in item.detail.wordsList"
|
|
|
+ v-for="(itemNode, indexNode) in judgeAnswer == 'standardAnswer'
|
|
|
+ ? item.correctWordsList
|
|
|
+ : item.detail.wordsList"
|
|
|
:key="indexNode"
|
|
|
>
|
|
|
<p>
|
|
@@ -40,7 +67,7 @@
|
|
|
<div class="fw">
|
|
|
<span
|
|
|
class="fw-btn"
|
|
|
- :class="[!TaskModel||TaskModel!='ANSWER'?'sure-active':'']"
|
|
|
+ :class="[!TaskModel || TaskModel != 'ANSWER' ? 'sure-active' : '']"
|
|
|
@click="removeCurrentSortArr(item, index)"
|
|
|
></span>
|
|
|
</div>
|
|
@@ -53,7 +80,7 @@
|
|
|
import draggable from "vuedraggable";
|
|
|
export default {
|
|
|
components: { draggable },
|
|
|
- props: ["curQue","TaskModel"],
|
|
|
+ props: ["curQue", "TaskModel", "judgeAnswer"],
|
|
|
data() {
|
|
|
return {
|
|
|
userList: [],
|
|
@@ -62,6 +89,7 @@ export default {
|
|
|
moveId: null,
|
|
|
dragData: null,
|
|
|
orgData: null,
|
|
|
+ userErrList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -104,6 +132,27 @@ export default {
|
|
|
this.$message.warning("当前没有可清空的数据");
|
|
|
return;
|
|
|
},
|
|
|
+ // 判断对错
|
|
|
+ changeuserAnswerJudge(index) {
|
|
|
+ let flag = true;
|
|
|
+ for (
|
|
|
+ let i = 0;
|
|
|
+ i < this.curQue.Bookanswer[index].detail.wordsList.length;
|
|
|
+ i++
|
|
|
+ ) {
|
|
|
+ if (
|
|
|
+ this.curQue.Bookanswer[index].detail.wordsList[i].chs !=
|
|
|
+ this.curQue.Bookanswer[index].detail.segList[i]
|
|
|
+ ) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ this.curQue.Bookanswer[index].userAnswerJudge = "[JUDGE##T##JUDGE]";
|
|
|
+ } else {
|
|
|
+ this.curQue.Bookanswer[index].userAnswerJudge = "[JUDGE##F##JUDGE]";
|
|
|
+ }
|
|
|
+ },
|
|
|
onStart(e, index) {
|
|
|
this.drag = true;
|
|
|
this.dragData = JSON.parse(
|
|
@@ -121,6 +170,7 @@ export default {
|
|
|
// this.curQue.option[index].detail.wordsList = JSON.parse(
|
|
|
// JSON.stringify(this.dragData)
|
|
|
// );
|
|
|
+ this.changeuserAnswerJudge(index);
|
|
|
//如果左边
|
|
|
if (arr.length == this.SortArr[index].length) {
|
|
|
return;
|
|
@@ -167,7 +217,10 @@ export default {
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
- this.curQue.option.forEach((item) => {
|
|
|
+ console.log(this.curQue);
|
|
|
+ let data = JSON.parse(JSON.stringify(this.curQue.option));
|
|
|
+ data.forEach((item) => {
|
|
|
+ item.userAnswerJudge = "[JUDGE##F##JUDGE]";
|
|
|
let arr = [];
|
|
|
this.SortArr.push(arr);
|
|
|
item.detail.wordsList.forEach((it, i) => {
|
|
@@ -176,7 +229,32 @@ export default {
|
|
|
});
|
|
|
this.orgData = JSON.parse(JSON.stringify(this.curQue.option));
|
|
|
if (!this.curQue.Bookanswer) {
|
|
|
- this.$set(this.curQue, "Bookanswer", JSON.parse(JSON.stringify(this.curQue.option)));
|
|
|
+ this.$set(this.curQue, "Bookanswer", data);
|
|
|
+ }
|
|
|
+ if (this.judgeAnswer == "standardAnswer") {
|
|
|
+ this.curQue.Bookanswer.forEach((item, i) => {
|
|
|
+ if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
|
|
|
+ this.userErrList.push(
|
|
|
+ JSON.parse(JSON.stringify(this.curQue.option[i]))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (this.judgeAnswer == "studentAnswer") {
|
|
|
+ this.curQue.Bookanswer.forEach((item) => {
|
|
|
+ if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
|
|
|
+ item.detail.wordsList.forEach((items, i) => {
|
|
|
+ if (items.chs == item.correctWordsList[i].chs) {
|
|
|
+ items.correct = "correct";
|
|
|
+ } else {
|
|
|
+ items.correct = "error";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ item.detail.wordsList.forEach((items, i) => {
|
|
|
+ items.correct = "correct";
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
@@ -222,10 +300,10 @@ export default {
|
|
|
margin-right: 4px;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
- .content-box{
|
|
|
- background: #E9E9E9;
|
|
|
- padding: 8px;
|
|
|
- border-radius: 8px;
|
|
|
+ .content-box {
|
|
|
+ background: #e9e9e9;
|
|
|
+ padding: 8px;
|
|
|
+ border-radius: 8px;
|
|
|
}
|
|
|
}
|
|
|
.fw {
|
|
@@ -296,6 +374,18 @@ export default {
|
|
|
.select {
|
|
|
background: rgba(0, 0, 0, 0.06);
|
|
|
}
|
|
|
+ .correct {
|
|
|
+ background: rgba(44, 167, 103, 0.1);
|
|
|
+ /* 正确答案 */
|
|
|
+
|
|
|
+ border: 1px solid #2ca767;
|
|
|
+ }
|
|
|
+ .error {
|
|
|
+ background: rgba(237, 52, 45, 0.1);
|
|
|
+ /* 错误颜色 */
|
|
|
+
|
|
|
+ border: 1px solid #ed342d;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|