From c2a1c68a2a398e6d0f2f5854c65127efbff306b1 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期一, 28 十月 2024 11:36:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/answer/info.vue |   85 +++++++++++++++++++++++++++---------------
 1 files changed, 55 insertions(+), 30 deletions(-)

diff --git a/src/views/answer/info.vue b/src/views/answer/info.vue
index 3d2a382..05db274 100644
--- a/src/views/answer/info.vue
+++ b/src/views/answer/info.vue
@@ -4,11 +4,14 @@
     <div class="bg">
       <div class="main">
         <!-- 寰呰繑鍥炵殑鏍囬 -->
-        <TitleIndex title="绛斿嵎绠$悊" />
+        <TitleIndex title="绛斿嵎绠$悊"/>
         <div class="content">
           <!-- 鎼滅储 -->
           <div>
             <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px">
+              <el-form-item>
+                <el-input v-model="queryParam.examName" placeholder="璇疯緭鍏ヨ�冭瘯鍚嶇О" clearable></el-input>
+              </el-form-item>
               <el-form-item>
                 <el-input v-model="queryParam.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" clearable></el-input>
               </el-form-item>
@@ -20,11 +23,12 @@
           </div>
           <!-- 琛ㄦ牸 -->
           <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row>
-            <el-table-column prop="paperName" label="璇曞嵎鍚嶇О" align="center" />
-            <el-table-column prop="userName" label="鍙傝�冧汉" align="center" />
-            <el-table-column label="寰楀垎" width="100px">
+            <el-table-column prop="examName" label="鑰冭瘯鍚嶇О" align="center"/>
+            <el-table-column prop="paperName" label="璇曞嵎鍚嶇О" align="center"/>
+            <el-table-column prop="userName" width="150" label="鍙傝�冧汉" align="center"/>
+            <el-table-column label="寰楀垎" width="150px" align="center">
               <template slot-scope="{row}">
-                {{ row.userScore }} / {{ row.paperScore }}
+                {{ row.score }} / {{ row.totalScore }}
               </template>
             </el-table-column>
             <el-table-column label="棰樼洰瀵归敊" width="100px" align="center">
@@ -32,16 +36,26 @@
                 {{ row.questionCorrect }} / {{ row.questionCount }}
               </template>
             </el-table-column>
-            <el-table-column prop="doTime" label="鑰楁椂" width="80px" align="center" />
-            <el-table-column prop="createTime" label="鎻愪氦鏃堕棿" width="160px" align="center" />
-            <el-table-column label="鎿嶄綔" width="200px" align="center">
+            <el-table-column prop="doTime" label="鑰楁椂" width="100px" align="center">
+              <template slot-scope="{row}">
+                {{ formattedDoTime(row) }}
+              </template>
+            </el-table-column>
+            <el-table-column prop="submitTime" label="鎻愪氦鏃堕棿" width="240px" align="center">
+              <template slot-scope="{row}">
+                <span :style="row.status === 0 ? '' : 'color: red'">
+                  {{ row.status === 0 ? row.submitTime : '缂鸿��' }}
+                </span>
+              </template>
+            </el-table-column>
+            <el-table-column label="鎿嶄綔" width="120px" align="center">
               <template slot-scope="{row}">
                 <el-button size="mini" @click="view(row)">璇︽儏</el-button>
               </template>
             </el-table-column>
           </el-table>
           <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex"
-            :limit.sync="queryParam.pageSize" @pagination="search" />
+                      :limit.sync="queryParam.pageSize" @pagination="search"/>
         </div>
       </div>
     </div>
@@ -57,11 +71,12 @@
   components: {
     Pagination
   },
-  data() {
+  data () {
     return {
       listLoading: true,
       queryParam: {
-        examPaperId: '',
+        examId: '',
+        userId: '',
         userName: '',
         pageIndex: 1,
         pageSize: 10
@@ -71,15 +86,22 @@
       tableData: [],
       visible: false,
       subjects: []
-    };
+    }
   },
-  created() {
-    this.queryParam.examPaperId = this.$route.query.id
+  created () {
+    this.queryParam.examId = this.$route.query.id
+    this.queryParam.userId = this.$route.query.userId
     this.search()
   },
   methods: {
+    formattedDoTime (row) {
+      const totalSeconds = row.doTime
+      const minutes = Math.floor(totalSeconds / 60)
+      const seconds = totalSeconds % 60
+      return `${minutes}鍒�${seconds < 10 ? '0' + seconds : seconds}绉抈
+    },
     // 鑾峰彇鍒楄〃
-    search() {
+    search () {
       this.listLoading = true
       examPaperAnswerApi.page(this.queryParam).then(re => {
         this.tableData = re.data.list
@@ -89,26 +111,29 @@
         this.listLoading = false
       })
     },
-    view(row) {
-      this.$router.push({ path: '/answer/answer-detail', query: { id: row.id } });
+    view (row) {
+      this.$router.push({ path: '/answer/answer-detail', query: { id: row.id } })
     },
-    handleExport() {
+    handleExport () {
       let that = this
-      let url = '/api/admin/examPaperAnswer/exportExcel?examPaperId=' + this.queryParam.examPaperId + '&userName=' + this.queryParam.userName
-      var x = new XMLHttpRequest();
-      x.open("POST", url, true);
-      x.responseType = "blob";
+      let url = '/api/admin/examPaperAnswer/exportExcel?userName=' + this.queryParam.userName
+      if (this.queryParam.userId) url += '&userId=' + this.queryParam.userId
+      if (this.queryParam.examId) url += '&examId=' + this.queryParam.examId
+      var x = new XMLHttpRequest()
+      x.open('POST', url, true)
+      x.responseType = 'blob'
       x.onload = function () {
-        var url = window.URL.createObjectURL(x.response);
-        var a = document.createElement("a");
-        a.href = url;
-        a.download = that.tableData[0].paperName + '.xlsx';
-        a.click();
-      };
-      x.send();
+        var url = window.URL.createObjectURL(x.response)
+        var a = document.createElement('a')
+        a.href = url
+        if (that.queryParam.examId) a.download = that.tableData[0].examName + '.xlsx'
+        if (that.queryParam.userId) a.download = that.tableData[0].userName + '.xlsx'
+        a.click()
+      }
+      x.send()
     }
   }
-};
+}
 </script>
 <style scoped lang="scss">
 .flex {

--
Gitblit v1.8.0