浏览代码

排序题自定义序号

natasha 2 年之前
父节点
当前提交
d1afd8a7d6
共有 2 个文件被更改,包括 23 次插入6 次删除
  1. 13 0
      src/components/Adult/inputModules/Sort.vue
  2. 10 6
      src/components/Adult/preview/SentenceSortQP.vue

+ 13 - 0
src/components/Adult/inputModules/Sort.vue

@@ -24,6 +24,18 @@
         :key="item + index"
         style="border-bottom: 1px #ccc solid; margin-bottom: 20px"
       >
+        <div class="NNPE-book-input-item">
+            <span class="NNPE-book-lable" style="width:70px;display:inline-block;textAlign:right;marginRight:8px">序号:</span>
+            <el-input
+                class="NNPE-book-input"
+                type="textarea"
+                autosize
+                placeholder="请输入序号"
+                v-model="item.number"
+                @blur="item.number = item.number.trim()"
+                style="width: 500px"
+            ></el-input>
+        </div>
         <div class="NPC-sentence-Segword" style="position: relative">
           <SentenceSegwordChs :curQue="item.detail" :type="type" />
           <img
@@ -103,6 +115,7 @@ export default {
               segList: [], //分词结果
               seg_words: "",
               wordsList: [],
+              number: '', // 序号
             },
             correctWordsList: [], //正确的list
           },

+ 10 - 6
src/components/Adult/preview/SentenceSortQP.vue

@@ -19,7 +19,7 @@
       :key="index"
     >
       <div class="item-right">
-        <b>{{ judgeAnswer == 'standardAnswer' ? item.itemIndex + 1 :  index+ 1}}</b>
+        <b>{{ judgeAnswer == 'standardAnswer' ? item.number ? item.number : item.itemIndex + 1 : item.number ? item.number : index+ 1}}</b>
         <draggable
           v-model="item.detail.wordsList"
           animation="300"
@@ -215,7 +215,7 @@ export default {
     if (this.judgeAnswer == "standardAnswer") {
       this.curQue.Bookanswer.forEach((item, i) => {
         if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
-          this.curQue.option[i].itemIndex = i
+          this.curQue.option[i].itemIndex = this.curQue.option[i].number ? this.curQue.option[i].number : i
           this.userErrList.push(
             JSON.parse(JSON.stringify(this.curQue.option[i]))
           );
@@ -228,10 +228,14 @@ export default {
       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";
+            if(item.correctWordsList[i]){
+                if (items.chs == item.correctWordsList[i].chs) {
+                    items.correct = "correct";
+                } else {
+                    items.correct = "error";
+                }
+            }else{
+                items.correct = "";
             }
           });
         } else {