From 4f6cdee3d3a9967b6955aacc354bf557430c0643 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 05 八月 2024 17:05:16 +0800
Subject: [PATCH] 批改

---
 src/views/onlineEducation/groupExams/components/correctExam.vue |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/src/views/onlineEducation/groupExams/components/correctExam.vue b/src/views/onlineEducation/groupExams/components/correctExam.vue
index abbcb36..3bb2a83 100644
--- a/src/views/onlineEducation/groupExams/components/correctExam.vue
+++ b/src/views/onlineEducation/groupExams/components/correctExam.vue
@@ -22,12 +22,12 @@
               </div>
               <div v-if="data.form.questions && data.form.questions.length>0" style="display: flex;flex-wrap: wrap;line-height: 40px">
                 <div v-for="(item,index) in data.form.questions" :key="index" style="margin-right: 5px">
-                  <el-tag size="large" style="cursor: pointer" effect="light" :type="item.studentAnswer.passed == 0 ? 'danger' :item.studentAnswer.passed == 1?'success': 'warning'">{{index+1}}</el-tag>
+                  <el-tag size="large" style="cursor: pointer" effect="light" :type="item.studentAnswer.passed == 0 ? 'danger' :item.studentAnswer.passed == 1?'success': 'warning'" @click="toView(index+1)">{{index+1}}</el-tag>
                 </div>
                 <el-divider />
               </div>
               <div style="display: flex;justify-content: center;">
-                <el-button type="primary" @click="submitExam">提交批改</el-button>
+                <el-button type="primary" @click="submitExam" v-if="data.queryParams.state != 2">提交批改</el-button>
               </div>
             </div>
           </el-card>
@@ -43,7 +43,7 @@
                 <div v-for="(item,index) in data.singleList" :key="index" style="margin-left: 15px;margin-top: 10px">
                   <div style="display: flex;flex-direction: column;">
                     <div style="margin-top: 10px;display: flex;align-items: center">
-                      <span style="font-size: 15px">{{index+1}}.</span>
+                      <span style="font-size: 15px" :id="index+1">{{index+1}}.</span>
                       <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span>
                     </div>
                     <div style="display: flex;margin-top: 15px;margin-left: 25px">
@@ -73,7 +73,7 @@
                 <div v-for="(item,index) in data.multiList" :key="index" style="margin-left: 15px;margin-top: 10px">
                   <div style="display: flex;flex-direction: column;">
                     <div style="margin-top: 10px;display: flex;align-items: center">
-                      <span style="font-size: 15px">{{data.singleList.length + index+1}}.</span>
+                      <span style="font-size: 15px" :id="data.singleList.length + index+1">{{data.singleList.length + index+1}}.</span>
                       <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span>
                     </div>
                     <div style="display: flex;margin-top: 15px;margin-left: 25px">
@@ -103,7 +103,7 @@
                 <div v-for="(item,index) in data.judgeList" :key="index" style="margin-left: 15px;margin-top: 10px">
                   <div style="display: flex;flex-direction: column;">
                     <div style="margin-top: 10px;display: flex;align-items: center">
-                      <span style="font-size: 15px">{{data.singleList.length+data.multiList.length + index+1}}.</span>
+                      <span style="font-size: 15px" :id="data.singleList.length+data.multiList.length + index+1">{{data.singleList.length+data.multiList.length + index+1}}.</span>
                       <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span>
                     </div>
                     <div style="display: flex;margin-top: 15px;margin-left: 25px">
@@ -132,7 +132,7 @@
                 <div v-for="(item,index) in data.easyList" :key="index" style="margin-left: 15px;margin-top: 10px">
                   <div style="display: flex;flex-direction: column;">
                     <div style="margin-top: 10px;display: flex;align-items: center">
-                      <span style="font-size: 15px">{{data.singleList.length + data.multiList.length + data.judgeList.length + index+1}}.</span>
+                      <span style="font-size: 15px" :id="data.singleList.length + data.multiList.length + data.judgeList.length + index+1">{{data.singleList.length + data.multiList.length + data.judgeList.length + index+1}}.</span>
                       <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span>
                     </div>
                     <div style="display: flex;margin-top: 15px;margin-left: 30px">
@@ -164,7 +164,7 @@
           </el-card>
         </div>
       </div>
-
+      <el-backtop target=""></el-backtop>
     </div>
   </div>
 </template>
@@ -173,8 +173,10 @@
 import Cookies from "js-cookie";
 import {useRoute, useRouter} from "vue-router";
 import {getClassification} from "@/api/onlineEducation/courseClass";
-import {ElMessage} from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
 import {doConfirmExam, getPaperStu} from "@/api/onlineEducation/exam";
+import {removeToken} from "@/utils/auth";
+import {isRelogin} from "@/utils/request";
 const route = useRoute()
 const router = useRouter();
 
@@ -185,6 +187,7 @@
     paperId: null,
     pageNum: 1,
     pageSize: 10,
+    state: null,
   },
   form: {
     id: null,
@@ -204,6 +207,7 @@
   backValue.value = val
   data.queryParams.paperId = val.paperId
   data.queryParams.id = val.id
+  data.queryParams.state = val.state
   await getStuPaper()
 })
 
@@ -301,6 +305,12 @@
       score: item.score,
     }
   })
+  questions.forEach(item => {
+    if(item.score == '' || item.score == null){
+      ElMessage.warning('有未批改题目');
+      return;
+    }
+  })
   const param = {
     id:data.form.id,
     paperId: data.form.paperId,
@@ -311,12 +321,25 @@
   const res = await doConfirmExam(param);
   if(res.code === 200){
     await getStuPaper()
+    await ElMessageBox.alert(`试卷得分:${data.form.score}分`, '考试结果', {
+      confirmButtonText: '关闭',
+      callback: async () => {
+        // back()
+      },
+    })
   }else{
     ElMessage.warning(res.message)
   }
   console.log('简答',param)
 
 }
+const toView = (data) => {
+  document?.getElementById(data)?.scrollIntoView({
+    behavior: "smooth", //smooth:平滑,auto:直接定位
+    block: "center",
+    inline: "center",
+  });
+}
 
 </script>
 

--
Gitblit v1.9.2