From 272c6479425767aaaeb53c3bf29a85979abbb5cf Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 18 Aug 2021 15:52:35 +0800
Subject: [PATCH] 样式      到时见自动提交

---
 src/views/startexam/index.vue |   91 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 69 insertions(+), 22 deletions(-)

diff --git a/src/views/startexam/index.vue b/src/views/startexam/index.vue
index 2e75079..b94e418 100644
--- a/src/views/startexam/index.vue
+++ b/src/views/startexam/index.vue
@@ -8,7 +8,8 @@
               <el-col :span="5">
                 <div class="tool-bar">
                   <div class="time-remain">
-                    剩余时间:
+                    <div class="time-remain_title">剩余时间 :</div>
+
                     <div class="time">
                       <count-down
                         v-on:start_callback="countDownS_cb(1)"
@@ -32,7 +33,8 @@
                   <div class="answer-card">
                     <el-button
                       type="text"
-                      icon="el-icon-date"
+                      icon="el-icon-date el-dates"
+                      class="el-dates"
                       @click="answerCard"
                       >答题卡</el-button
                     >
@@ -74,10 +76,14 @@
                   />
 
                   <div class="subject-buttons" v-if="query.subjectId !== ''">
-                    <el-button plain @click="last" :loading="loadingLast"
+                    <!-- <el-button plain @click="last" :loading="loadingLast"
                       >上一题</el-button
-                    >
-                    <el-button plain @click="next" :loading="loadingNext"
+                    > -->
+                    <el-button
+                      @click="next"
+                      class="buttons"
+                      :loading="loadingNext"
+                      type="primary"
                       >下一题</el-button
                     >
                     <el-button
@@ -100,9 +106,9 @@
               center
             >
               <div class="answer-card-title">
-                {{ exam.examinationName }}(共{{ subjectIds.length }}题,合计{{
-                  exam.totalScore
-                }}分)
+                {{ exam.examinationName }}(共{{
+                  subjectIds.length
+                }}题,合计100分)
               </div>
               <div class="answer-card-split"></div>
               <el-row class="answer-card-content">
@@ -117,8 +123,8 @@
                 <el-button
                   circle
                   v-for="(value, index) in subjectIds"
+                  :style="{ background: value.color, color: value.fontColor }"
                   :key="index"
-                  @click="toSubject(value.everyID, value.type, index)"
                   >&nbsp;{{ index + 1 }}&nbsp;</el-button
                 >
               </el-row>
@@ -263,6 +269,7 @@
             this.subjectStartTime = current;
             // this.endTime = moment(this.exam.endTime).valueOf()
             this.endTime = current + 45 * 60 * 1000;
+            // this.endTime = current + 1 * 60 * 1000;
             this.disableSubmit = false;
           }
         })
@@ -286,6 +293,7 @@
                 answer: "",
                 score: subjectData[i].score,
                 color: "#fff",
+                fontColor: "#000",
               });
             }
 
@@ -316,7 +324,8 @@
     },
     countDownE_cb: function () {
       messageWarn(this, "考试结束");
-      this.disableSubmit = true;
+      //   this.disableSubmit = true;
+      this.submitExam("over");
     },
     last() {
       for (let i = 0; i < this.subjectIds.length; i++) {
@@ -347,6 +356,11 @@
     next() {
       for (let i = 0; i < this.subjectIds.length; i++) {
         if (this.subjectIds[i].everyID == this.query.subjectId) {
+          if (this.getAnswer() == "") {
+            messageSuccess(this, "请选择答案");
+            return;
+          }
+
           this.subjectIds[i].answer = this.getAnswer();
 
           this.markAnswered(this.subjectIds[i].answer, i);
@@ -390,9 +404,11 @@
 
             if (this.result == 1) {
               subjectIds.color = "#67C23A";
+              subjectIds.fontColor = "#fff";
             }
             if (this.result == 2) {
               subjectIds.color = "red";
+              subjectIds.fontColor = "#fff";
             }
 
             const { id, choicesType } = subject;
@@ -513,7 +529,7 @@
       this.dialogVisible = false;
     },
     // 提交
-    submitExam() {
+    submitExam(val) {
       var ind = this.subjectIndex;
 
       if (this.firstFlag == false) {
@@ -525,6 +541,13 @@
       this.subjectIds[ind].answer = this.getAnswer();
 
       this.markAnswered(this.subjectIds[ind].answer, ind);
+
+      if (val == "over") {
+        //时间到了情况  自动提交
+        this.disableSubmit = true;
+        this.doSubmitExam();
+        return;
+      }
 
       this.$confirm("确定要提交吗?", "提示", {
         confirmButtonText: "确定",
@@ -539,7 +562,7 @@
     },
     doSubmitExam() {
       var obj = {
-        id:this.$route.query.examScoreId,
+        id: this.$route.query.examScoreId,
         examName: this.$route.query.examName,
         candidateNo: this.$route.query.candidateNo,
         securityName: this.userInfo.user_name,
@@ -735,6 +758,9 @@
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" rel="stylesheet/scss" scoped>
+$fontSize1: 18px;
+$fontSize2: 20px;
+$fontSize3: 40px;
 .subject-box {
   margin-top: 50px;
   margin-left: 20px;
@@ -746,23 +772,43 @@
   min-height: 400px;
 }
 .subject-buttons {
-  text-align: right;
-  position: fixed;
-  top: 70%;
-  right: 15%;
+  text-align: left;
+  position: relative;
+  top: 70px;
+  left: 390px;
+  // top: 70%;
+  // right: 30%;
+  .buttons {
+    // border: 1px solid green;
+  }
 }
 .tool-bar {
   margin-left: 20px;
-  font-size: 20px;
+}
+.time-remain_title {
+  font-size: $fontSize2;
 }
 .time-remain .time {
-  display: inline-block;
-  font-size: 18px;
-  line-height: 22px;
+  display: block;
+  font-size: $fontSize3;
+  line-height: $fontSize3;
   color: #ff0000;
   font-weight: 400;
+  position: relative;
+  //   top: -20px;
 }
-
+.current-progress {
+  font-size: $fontSize2;
+}
+.answer-card {
+  margin: 15px 0;
+}
+.el-dates {
+  font-size: $fontSize1;
+}
+.subject-exam-title {
+  margin-bottom: 25px;
+}
 /* 答题卡 */
 .answer-card-title {
   font-size: 24px;
@@ -788,10 +834,11 @@
 
 #avue-view > .morpheus-box {
   position: absolute;
-  width: 100%;
+  width: calc(100% - 100px);
   height: 85%;
   border-radius: 4px;
   top: 10%;
+  left: 50px;
   padding: 10px !important;
   box-sizing: border-box;
 }

--
Gitblit v1.9.3