From 8a968bcc9d96c6ac88c6ec85b27be63ae40aef36 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 09 七月 2024 17:37:31 +0800
Subject: [PATCH] 密码强制修改实现

---
 src/views/exam/exam/MarkPaperDetail.vue |  387 ++++++------------------------------------------------
 1 files changed, 45 insertions(+), 342 deletions(-)

diff --git a/src/views/exam/exam/MarkPaperDetail.vue b/src/views/exam/exam/MarkPaperDetail.vue
index 890b58b..ef466f7 100644
--- a/src/views/exam/exam/MarkPaperDetail.vue
+++ b/src/views/exam/exam/MarkPaperDetail.vue
@@ -1,53 +1,56 @@
 <template>
   <div class="paper-container">
-    <div class="paper-card">
+    <div class="paper-card" v-loading="formLoading">
       <el-card style="height: 100vh">
         <el-row style="text-align: left; margin-bottom : 20px; font-size: 20px">璇枃鑰冭瘯</el-row>
         <el-row>
           <el-col class="info">
             <span class="exam-info">瀛﹀憳濮撳悕锛�</span>
-            <span class="exam-info">{{ userName }}</span>
+            <span class="exam-info">{{ form.userName }}</span>
           </el-col>
         </el-row>
         <el-row>
           <el-col class="info">
             <span class="exam-info">浜ゅ嵎鏃堕棿锛�</span>
-            <span class="exam-info">{{ examInfo.updateTime }}</span>
+            <span class="exam-info">{{ form.submitTime }}</span>
           </el-col>
         </el-row>
         <el-row>
           <el-col class="info">
             <span class="exam-info">瀹屾垚鑰楁椂锛�</span>
-            <span class="exam-info">{{ examInfo.doTime }}</span>
+            <span class="exam-info">{{ formattedDoTime }}</span>
           </el-col>
         </el-row>
         <el-row>
           <el-col class="info">
             <span class="exam-info">寰楀垎锛�</span>
-            <span class="exam-info">{{ 30 + ' / ' + 70 }}</span>
+            <span class="exam-info">{{ form.score + ' / ' + form.totalScore }}</span>
           </el-col>
         </el-row>
         <el-divider></el-divider>
         <el-row class="do-exam-title">
           <el-col :span="24">
-                <span :key="item.itemOrder" v-for="item in answer.answerItems">
-                    <el-tag :type="questionDoRightTag(item.doRight)" class="do-exam-title-tag"
+                <span :key="item.itemOrder" v-for="item in form.navbar">
+                    <el-tag :type="questionDoRightTag(item.right)" class="do-exam-title-tag"
                             @click="goAnchor('#question-' + item.itemOrder)">{{ item.itemOrder }}</el-tag>
                 </span>
           </el-col>
         </el-row>
+        <el-divider></el-divider>
+        <div style="text-align: center">
+          <el-button type="primary" style="width: 120px;height: 35px" @click="open">鎻愪氦鎵规敼</el-button>
+        </div>
       </el-card>
     </div>
     <div class="paper-form">
       <el-form :model="form" ref="form" v-loading="formLoading" label-width="100px">
         <el-row :key="index" v-for="(titleItem, index) in form.titleItems">
-          <h3>{{ titleItem.name }}</h3>
-          <el-card class="exampaper-item-box" v-if="titleItem.questionItems.length !== 0">
+          <h3>{{ titleItem.title }}</h3>
+          <el-card class="exampaper-item-box" v-if="titleItem.questionList.length !== 0">
             <el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder + '.'"
-                          v-for="questionItem in titleItem.questionItems" class="exam-question-item"
+                          v-for="questionItem in titleItem.questionList" class="exam-question-item"
                           label-width="50px" :id="'question-' + questionItem.itemOrder">
-              <QuestionAnswerShow :qType="questionItem.questionType" :question="questionItem"
-                                  :answer="answer.answerItems[questionItem.itemOrder - 1]"/>
+              <MarkPaperShow :qType="questionItem.questionType" :question="questionItem" :answer="form.navbar"/>
             </el-form-item>
           </el-card>
         </el-row>
@@ -57,354 +60,48 @@
 </template>
 
 <script>
-import { getStudentExam } from '@/api/exam'
-import QuestionAnswerShow from '@/views/answer/components/QuestionAnswerShow'
-import examPaperAnswerApi from '@/api/examPaperAnswer'
+import { getStudentExam, submitMark } from '@/api/exam'
+import MarkPaperShow from '@/views/exam/exam/components/MarkPaperShow'
 import { mapGetters, mapState } from 'vuex'
 
 export default {
   name: 'MarkPaperDetail',
-  components: { QuestionAnswerShow },
+  components: { MarkPaperShow },
   mounted () {
-    this.examInfo.examId = this.$route.query.examId
-    this.examInfo.examName = this.$route.query.examName
-    this.userId = this.$route.query.userId
-    examPaperAnswerApi.read(1).then(re => {
-      re = {
-        'code': 1, 'message': '鎴愬姛', 'data': {
-          'paper': {
-            'id': 30,
-            'paperType': 7,
-            'score': '15',
-            'classes': null,
-            'name': '杩欐槸涓�涓祴璇曡瘯鍗�',
-            'suggestTime': 12,
-            'limitDateTime': null,
-            'titleItems': [{
-              'name': '鍗曢�夐',
-              'questionItems': [{
-                'id': 25,
-                'questionType': 1,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楁纭殑鏄�',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '绾㈡ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '鐧芥ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }, { 'prefix': 'C', 'content': '闈掓ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'D',
-                  'content': '缁挎ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': null,
-                'correct': 'A',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 1,
-                'knowledgeIdList': [8, 9]
-              }, {
-                'id': 30,
-                'questionType': 1,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楁纭殑鏄�',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '绾㈡ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '鐧芥ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }, { 'prefix': 'C', 'content': '闈掓ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'D',
-                  'content': '缁挎ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': null,
-                'correct': 'A',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 2,
-                'knowledgeIdList': [8, 9]
-              }]
-            }, {
-              'name': '澶氶�夐',
-              'questionItems': [{
-                'id': 26,
-                'questionType': 2,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楁纭殑鏄�',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '绾㈡ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '鐧芥ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }, { 'prefix': 'C', 'content': '闈掓ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'D',
-                  'content': '缁挎ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': ['A', 'C'],
-                'correct': 'A,C',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 3,
-                'knowledgeIdList': [8, 9]
-              }, {
-                'id': 31,
-                'questionType': 2,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楁纭殑鏄�',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '绾㈡ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '鐧芥ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }, { 'prefix': 'C', 'content': '闈掓ゼ姊�', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'D',
-                  'content': '缁挎ゼ姊�',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': ['A', 'C'],
-                'correct': 'A,C',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 4,
-                'knowledgeIdList': [8, 9]
-              }]
-            }, {
-              'name': '鍒ゆ柇棰�',
-              'questionItems': [{
-                'id': 27,
-                'questionType': 3,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楄鏄庢纭悧',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '姝g‘', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '閿欒',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': null,
-                'correct': 'A',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 5,
-                'knowledgeIdList': [8, 9]
-              }, {
-                'id': 32,
-                'questionType': 3,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺锛屼笅鍒楄鏄庢纭悧',
-                'gradeLevel': 1,
-                'items': [{ 'prefix': 'A', 'content': '姝g‘', 'score': null, 'itemUuid': null }, {
-                  'prefix': 'B',
-                  'content': '閿欒',
-                  'score': null,
-                  'itemUuid': null
-                }],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': null,
-                'correct': 'A',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 6,
-                'knowledgeIdList': [8, 9]
-              }]
-            }, {
-              'name': '濉┖棰�',
-              'questionItems': [{
-                'id': 2,
-                'questionType': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁',
-                'gradeLevel': 1,
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correct': null,
-                'correctArray': '绾㈡ゼ姊�,鐧芥ゼ姊�,闈掓ゼ姊�,缁挎ゼ姊�',
-                'score': '10',
-                'difficult': 3,
-                'itemOrder': 7,
-                'knowledgeIdList': [8, 9],
-                'items': [
-                  { prefix: '1', content: '绾㈡ゼ姊�' },
-                  { prefix: '2', content: '鐧芥ゼ姊�' },
-                  { prefix: '3', content: '闈掓ゼ姊�' },
-                  { prefix: '4', content: '缁挎ゼ姊�' }
-                ]
-              }
-              ]
-            }, {
-              'name': '璇煶棰�',
-              'questionItems': [{
-                'id': 55,
-                'questionType': 1,
-                'title': '鍚煶棰戝洖绛斿嚭灏忔槑浠婂ぉ鍚冪殑浠�涔�',
-                'items': [
-                  { 'prefix': 'A', 'content': '鐣寗', 'score': null, 'itemUuid': null },
-                  { 'prefix': 'B', 'content': '鐧借彍', 'score': null, 'itemUuid': null },
-                  { 'prefix': 'C', 'content': '棣欒晧', 'score': null, 'itemUuid': null },
-                  { 'prefix': 'D', 'content': '鑿犺悵', 'score': null, 'itemUuid': null }
-                ],
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correctArray': null,
-                'correct': 'A',
-                'score': '2.5',
-                'difficult': 3,
-                'itemOrder': 8,
-                'knowledgeIdList': [8, 9]
-              }]
-            }, {
-              'name': '绠�绛旈',
-              'questionItems': [{
-                'id': 1,
-                'questionType': 5,
-                'subjectId': 4,
-                'title': '涓崕鍥涘ぇ鍚嶈憲閮芥湁鍝簺',
-                'gradeLevel': 1,
-                'analyze': '棰樼洰姣旇緝绠�鍗曪紝鑷鍒嗘瀽',
-                'correct': '绾㈡ゼ姊︺�佽タ娓歌銆佹按娴掍紶銆佷笁鍥芥紨涔�',
-                'score': '10',
-                'difficult': 3,
-                'itemOrder': 9,
-                'knowledgeIdList': [8, 9]
-              }
-              ]
-            }],
-          },
-          'answer': {
-            'id': 9,
-            'doTime': 26,
-            'score': '100',
-            'createUser': null,
-            'answerItems': [{
-              'id': 25,
-              'questionId': 25,
-              'doRight': true,
-              'content': 'A',
-              'itemOrder': 1,
-              'contentArray': null,
-              'score': '2.5',
-              'questionScore': '2.5'
-            }, {
-              'id': 26,
-              'questionId': 30,
-              'doRight': false,
-              'content': 'C',
-              'itemOrder': 2,
-              'contentArray': null,
-              'score': '0',
-              'questionScore': '2.5'
-            }, {
-              'id': 27,
-              'questionId': 26,
-              'doRight': false,
-              'content': '',
-              'itemOrder': 3,
-              'contentArray': [''],
-              'score': '0',
-              'questionScore': '2.5'
-            }, {
-              'id': 28,
-              'questionId': 31,
-              'doRight': false,
-              'content': 'C,D',
-              'itemOrder': 4,
-              'contentArray': ['C', 'D'],
-              'score': '0',
-              'questionScore': '2.5'
-            }, {
-              'id': 29,
-              'questionId': 27,
-              'doRight': true,
-              'content': 'A',
-              'itemOrder': 5,
-              'contentArray': null,
-              'score': '2.5',
-              'questionScore': '2.5'
-            }, {
-              'id': 30,
-              'questionId': 32,
-              'doRight': true,
-              'content': 'A',
-              'itemOrder': 6,
-              'contentArray': null,
-              'score': '2.5',
-              'questionScore': '2.5'
-            }, {
-              'id': 33,
-              'questionId': 2,
-              'doRight': null,
-              'content': 'A',
-              'itemOrder': 7,
-              'contentArray': ['绾㈤棬姊�', '涓夊浗婕旂粠', '姘村6杞�'],
-              'score': '2.5',
-              'questionScore': '2.5'
-            }, {
-              'id': 25,
-              'questionId': 55,
-              'doRight': true,
-              'content': 'A',
-              'itemOrder': 8,
-              'contentArray': null,
-              'score': '2.5',
-              'questionScore': '2.5'
-            }, {
-              'id': 31,
-              'questionId': 1,
-              'doRight': null,
-              'content': '绾㈡ゼ姊�.......',
-              'itemOrder': 9,
-              'questionScore': '10'
-            }],
-            'doTimeStr': '26绉�'
-          }
-        }
-      }
-      this.form = re.data.paper
-      this.answer = re.data.answer
+    getStudentExam(this.$route.query.examId, this.$route.query.userId).then(re => {
+      this.formLoading = true
+      this.form = re.data.data
       this.formLoading = false
     })
-    // if (this.examInfo.examId && this.userId) {
-    //   this.getStudentPaper()
-    // }
   },
   data () {
     return {
       paperQuestionList: [],
       form: {},
       formLoading: false,
-      answer: {
-        id: null,
-        score: 0,
-        doTime: 0,
-        answerItems: [],
-        doRight: false
-      },
       userId: null,
       userName: '寮犱笁',
-      questionLoading: false,
-      examInfo: {
-        examId: null,
-        examName: '',
-        doTime: '119鍒�40绉�',
-        updateTime: '2024-06-20 15:59:40',
-        paperQuestionList: []
-      }
+      questionLoading: false
     }
   },
   methods: {
+    open () {
+      this.$confirm('纭鏄惁鎻愪氦鎴愮哗鎵规敼?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        submitMark(this.form).then(re => {
+          if (re.data.code === 1) {
+            console.log('1111111')
+            this.$message.success('鎻愪氦鎴愬姛')
+            this.$router.back()
+          } else {
+            this.$message.error(re.message)
+          }
+        })
+      })
+    },
     goAnchor (selector) {
       this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
     },
@@ -418,6 +115,12 @@
     }
   },
   computed: {
+    formattedDoTime () {
+      const totalSeconds = this.form.doTime
+      const minutes = Math.floor(totalSeconds / 60)
+      const seconds = totalSeconds % 60
+      return `${minutes}鍒�${seconds < 10 ? '0' + seconds : seconds}绉抈
+    },
     ...mapGetters('enumItem', ['enumFormat']),
     ...mapState('enumItem', {
       doRightTag: state => state.exam.question.answer.doRightTag

--
Gitblit v1.8.0