From 1e09467cc6a0b846d895ed3ff9ffa1937a668f02 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 22 Nov 2021 14:05:59 +0800
Subject: [PATCH] 添加管理员进入进入签到页面

---
 src/views/exam/startexam.vue |  109 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/src/views/exam/startexam.vue b/src/views/exam/startexam.vue
index 8ead43d..23803fa 100644
--- a/src/views/exam/startexam.vue
+++ b/src/views/exam/startexam.vue
@@ -2,7 +2,7 @@
  * @Author: Morpheus
  * @Date: 2021-07-31 16:31:54
  * @Last Modified by: liu
- * @Last Modified time: 2021-10-09 16:08:06
+ * @Last Modified time: 2021-11-22 11:59:02
  * menu-name 考试管理
  */
 <template>
@@ -43,7 +43,7 @@
 
 <script>
 import { mapState } from "vuex";
-import { getExamDetail } from "@/api/examapi/examination";
+import { getExamDetail, getNowTime } from "@/api/examapi/examination";
 import { updateApplyStatus } from "@/api/examapi/applyexam";
 export default {
   data() {
@@ -149,63 +149,66 @@
           var data = res.data.data[0];
           // console.log(data,333);
           //当前时间
-          var nowD = new Date(),
+          var nowD,
             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;
+          getNowTime().then((res) => {
+            nowD = new Date(res.data.data);
+            //对比时间
+            //getTime() 方法可返回距 1970 年 1 月 1 日之间的毫秒数。
+            if (nowD.getTime() > startD.getTime()) {
+              if (endD.getTime() < nowD.getTime()) {
+                that.isTime = 1;
+              } else {
+                that.isTime = 2;
+              }
             } else {
-              that.isTime = 2;
+              that.isTime = 3;
             }
-          } else {
-            that.isTime = 3;
-          }
-          if (res.data.data.length > 0) {
-            that.pageDisable = true;
-            if (data.sex == 1) {
-              that.sex = "男";
-            }
-            if (data.sex == 2) {
-              that.sex = "女";
-            }
-            that.option.data = [
-              {
-                title: that.resData.examName,
-                color: "#ffa820",
-                subtext: "开始考试",
-                click: function () {
-                  window.parent.startExam();
+            if (res.data.data.length > 0) {
+              that.pageDisable = true;
+              if (data.sex == 1) {
+                that.sex = "男";
+              }
+              if (data.sex == 2) {
+                that.sex = "女";
+              }
+              that.option.data = [
+                {
+                  title: that.resData.examName,
+                  color: "#ffa820",
+                  subtext: "开始考试",
+                  click: function () {
+                    window.parent.startExam();
+                  },
+                  list: [
+                    {
+                      title: "姓名:     ",
+                      value: that.resData.realName,
+                      check: true,
+                    },
+                    {
+                      title: "准考证号:    ",
+                      value: that.resData.candidateNo,
+                      check: true,
+                    },
+                    {
+                      title: "身份证号:     ",
+                      value: that.resData.idCardNo,
+                      check: true,
+                    },
+                    {
+                      title: "性别:     ",
+                      value: that.sex,
+                      check: true,
+                    },
+                  ],
                 },
-                list: [
-                  {
-                    title: "姓名:     ",
-                    value: that.resData.realName,
-                    check: true,
-                  },
-                  {
-                    title: "准考证号:    ",
-                    value: that.resData.candidateNo,
-                    check: true,
-                  },
-                  {
-                    title: "身份证号:     ",
-                    value: that.resData.idCardNo,
-                    check: true,
-                  },
-                  {
-                    title: "性别:     ",
-                    value: that.sex,
-                    check: true,
-                  },
-                ],
-              },
-            ];
-            that.$store.commit("SetexamUserData", that.option.data[0]);
-          }
+              ];
+              that.$store.commit("SetexamUserData", that.option.data[0]);
+            }
+          });
         },
 
         (error) => {

--
Gitblit v1.9.3