From e856deb4dfa66f042bc1c3e28db2217c327b036c Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 13 Oct 2021 17:04:19 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_exam

---
 src/views/exam/startexam.vue |   73 +++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/src/views/exam/startexam.vue b/src/views/exam/startexam.vue
index 183dde2..8ead43d 100644
--- a/src/views/exam/startexam.vue
+++ b/src/views/exam/startexam.vue
@@ -1,8 +1,8 @@
 /*
  * @Author: Morpheus
  * @Date: 2021-07-31 16:31:54
- * @Last Modified by: Morpheus
- * @Last Modified time: 2021-07-18 17:09:52
+ * @Last Modified by: liu
+ * @Last Modified time: 2021-10-09 16:08:06
  * menu-name 考试管理
  */
 <template>
@@ -47,11 +47,11 @@
 import { updateApplyStatus } from "@/api/examapi/applyexam";
 export default {
   data() {
-    var a  = 1;
     return {
       resData: null,
       sex: "",
       pageDisable: false,
+      isTime: 2,
       option: {
         span: 8,
         data: [
@@ -61,7 +61,6 @@
         ],
       },
     };
-    
   },
   computed: {
     ...mapState({
@@ -88,6 +87,22 @@
     },
     //开始考试跳转
     startExam() {
+      //判断是否到了考试时间
+      if (this.isTime == 3) {
+        this.$message({
+          type: "warning",
+          message: "未到考试时间!",
+        });
+        return;
+      }
+      //已超过考试截止时间
+      if (this.isTime == 1) {
+        this.$message({
+          type: "warning",
+          message: "已过考试时间!",
+        });
+        return;
+      }
       var that = this;
       //去修改考试状态
       var data = {
@@ -95,9 +110,30 @@
         examType: this.resData.examType,
         examId: this.resData.id,
         userId: this.userInfo.user_id,
+        candidateNo: this.resData.candidateNo,
       };
+      // this.$notify({
+      //   message:
+      //     "考试期间切勿退出登入、关闭浏览器, 否则考试成绩无效, 如有问题及时联系管理人员!",
+      //   duration: 6000,
+      //   showClose: false,
+      //   customClass: "beginS",
+      //   // type: "warning",
+      // });
+      // return;
       updateApplyStatus(data).then((res) => {
         that.resData["examScoreId"] = res.data.id;
+        this.$store.commit("SetScoreId", res.data.id);
+        console.log(res.data.id, "ididididiidididididid");
+        window.name = "";
+        this.$notify({
+          message:
+            "考试期间切勿退出登入、关闭浏览器, 否则考试成绩无效, 如有问题及时联系管理人员!",
+          duration: 6000,
+          showClose: false,
+          customClass: "beginS",
+          // type: "warning",
+        });
         that.$router.push({
           path: `/startexam/${that.resData.id}`,
           query: that.resData,
@@ -109,9 +145,25 @@
       getExamDetail(this.userInfo.user_id).then(
         (res) => {
           that.resData = res.data.data[0];
+
           var data = res.data.data[0];
-          // debugger;
-          // console.log(data, 254424);
+          // console.log(data,333);
+          //当前时间
+          var nowD = new Date(),
+            startD = new Date(data.startTime),
+            //考试截止时间
+            endD = new Date(data.endTime);
+          //对比时间
+          //getTime() 方法可返回距 1970 年 1 月 1 日之间的毫秒数。
+          if (nowD.getTime() > startD.getTime()) {
+            if (endD.getTime() < nowD.getTime()) {
+              that.isTime = 1;
+            } else {
+              that.isTime = 2;
+            }
+          } else {
+            that.isTime = 3;
+          }
           if (res.data.data.length > 0) {
             that.pageDisable = true;
             if (data.sex == 1) {
@@ -222,4 +274,13 @@
     }
   }
 }
+
+.beginS {
+  height: 180px;
+  width: 500px;
+}
+.el-notification__content {
+  font-size: 90px !important;
+  line-height: 44px !important;
+}
 </style>

--
Gitblit v1.9.3