Procházet zdrojové kódy

处理学生作答

zhousheng před 4 roky
rodič
revize
6496d91c9a

+ 34 - 4
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/LessonTestReport.vue

@@ -8,7 +8,7 @@
 
         <br />
         <div class="scoreboard" v-show='testState == 1'>
-            <h4>点击试卷详情前往作答</h4>
+            <span>点击<span @click="showTest" style="color: #03966a;cursor:pointer;font-weight:800">试卷详情</span>前往作答</span>
         </div>
         <div class="scoreboard" v-show='testState == 2'>
             <h4>成绩尚未结算</h4>
@@ -21,7 +21,7 @@
                             <Card class="score-card">
                                 <p class="card-title">{{$t('studentWeb.exam.score')}}</p>
                                 <div class="card-content">
-                                    <span class="myscore">{{RandomNum()}}</span> / 100
+                                    <span class="myscore">{{testScore}}</span> / 100
                                 </div>
                             </Card>
                         </i-col>
@@ -48,7 +48,7 @@
                             <Card class="score-card">
                                 <p class="card-title">{{$t('studentWeb.exam.rightNum')}}</p>
                                 <div class="card-content">
-                                    <span class="myscore">40</span> / 54
+                                    <span class="myscore">{{rightAns.right}}</span> / {{rightAns.all}}
                                 </div>
                             </Card>
                         </i-col>
@@ -262,6 +262,11 @@
                 this.testJudge()
         },
         methods: {
+            showTest() {
+                if (this.examInfo.subject !== undefined) {
+                    this.$store.commit("ToggleLessonTestPopWithSubject", this.examInfo)
+                }
+            },
             testJudge() {
                 if (this.examInfo.subject !== undefined) {
                     console.log(this.examInfo)
@@ -375,7 +380,32 @@
             },
         },
         computed: {
-
+            testScore() {
+                let data = 0
+                if (this.examInfo.subject !== undefined) {
+                    for (let item of this.examInfo.stuScore) {
+                        data += item
+                    }
+                }
+                return data
+            },
+            rightAns() {
+                let info = {
+                    all: 0,
+                    right: 0
+                }
+                if (this.examInfo.subject !== undefined) {
+                     info = {
+                        all: this.examInfo.stuScore.length,
+                        right: 0
+                    }
+                    for (let item of this.examInfo.stuScore) {
+                        if(item !== 0 && item !== -1)
+                       info.right++
+                    }
+                }
+                return info
+            }
         },
         watch: {
             $route: {