Kaynağa Gözat

新增查看报告作业查询全部道题正确率功能

zengyicheng 2 yıl önce
ebeveyn
işleme
22f26152d1
1 değiştirilmiş dosya ile 37 ekleme ve 12 silme
  1. 37 12
      src/components/pages/components/worksDetail3.vue

+ 37 - 12
src/components/pages/components/worksDetail3.vue

@@ -488,6 +488,10 @@
                       </div>
                     </div>
                   </div>
+                  <div class="allRightBox">
+                    <span>全部道题的正确率:</span
+                    ><span>{{ checkJson[sIndex].allRight + "%" }}</span>
+                  </div>
                 </div>
                 <div v-else>
                   <div class="ech" style="margin-left: 23px">
@@ -961,7 +965,7 @@ export default {
               stagetask: "",
               time: "",
             });
-            this.checkJson[k] = [];
+            this.checkJson[k] = {};
             // this.allWorks = res.data[0][k];
             // this.chapInfo.push(JSON.parse(res.data[0][k].chapters));
             // chapters.push(JSON.parse(res.data[0][k].chapters));
@@ -1066,13 +1070,19 @@ export default {
                 }
                 t.radio = e;
                 workJson[k].chooseInfo.push(t);
+                this.checkJson[k].allRight = 0;
+                var isCount = 0;
                 for (var p = 0; p < t.radio.length; p++) {
                   if (!this.checkJson[k][p]) {
-                    this.checkJson[k].push({
+                    this.checkJson[k][p] = {
                       checkCount: [],
                       checkPerson: [],
-                      rightPerson: [],
-                    });
+                    };
+                    // this.checkJson[k].push({
+                    //   checkCount: [],
+                    //   checkPerson: [],
+                    //   rightPerson: [],
+                    // });
                   }
                   if (!this.checkJson[k][p].checkCount.length) {
                     this.checkJson[k][p].checkCount = [];
@@ -1087,9 +1097,14 @@ export default {
                         .sort()
                         .join(",") == t.radio[p].sort().join(",")
                     ) {
-                      this.checkJson[k][p].rightPerson.push(
-                        res.data[0][k].sName
-                      );
+                      // this.checkJson[k][p].rightPerson.push(
+                      //   res.data[0][k].sName
+                      // );
+                      this.checkJson[k][p].right = 100;
+                      isCount += this.checkJson[k][p].right;
+                    } else {
+                      this.checkJson[k][p].right = 0;
+                      isCount += 0;
                     }
                     console.log(this.checkJson[k][p].rightPerson);
                     for (var q = 0; q < t.radio[p].length; q++) {
@@ -1112,9 +1127,14 @@ export default {
                     if (
                       workJson[k].chooseInfo[0].testJson[p].answer == t.radio[p]
                     ) {
-                      this.checkJson[k][p].rightPerson.push(
-                        res.data[0][k].sName
-                      );
+                      // this.checkJson[k][p].rightPerson.push(
+                      //   res.data[0][k].sName
+                      // );
+                      this.checkJson[k][p].right = 100;
+                      isCount += this.checkJson[k][p].right;
+                    } else {
+                      this.checkJson[k][p].right = 0;
+                      isCount += 0;
                     }
                     console.log(this.checkJson[k][p].rightPerson);
                     if (parseInt(t.radio[p]) || parseInt(t.radio[p]) == 0) {
@@ -1135,6 +1155,7 @@ export default {
                     }
                   }
                 }
+                this.checkJson[k].allRight = isCount / t.radio.length;
               }
             }
 
@@ -2231,7 +2252,7 @@ export default {
   font-size: 22px;
 }
 
-.sd_score > span:nth-child(1)  {
+.sd_score > span:nth-child(1) {
   width: 130px;
   text-align: justify;
   text-align-last: justify;
@@ -3093,11 +3114,15 @@ export default {
 .tool_right_box + .tool_right_box {
   margin-top: 10px;
 }
-.right_box_xuan {
+.right_box_xuan,
+.allRightBox > span:nth-child(2) {
   background: rgb(0 123 255);
   color: #fff;
   border-radius: 5px;
   padding: 5px;
   margin-left: 10px;
 }
+.allRightBox {
+  padding: 10px 12px;
+}
 </style>