智慧保安考试系统
zhongrj
2023-06-25 545522da7622f5623731d7ab257bcf442cd9d5ec
src/views/exam/startexam.vue
@@ -118,7 +118,7 @@
      // this.startTime = this.getCurrentTimes();
    },
    countDownE_c: function() {
      messageWarn(this, "考试结束123");
      messageWarn(this, "考试结束");
      this.overExam();
      //   this.disableSubmit = true;
      // this.submitExam("over");
@@ -140,7 +140,7 @@
      var that = this;
      if (that.option.data[0].isExam == 3) {
        that.resData["examScoreId"] = that.scoreId;
        console.log(that.resData);
        // console.log(that.resData);
        that.$router.push({
          path: `/startexam/${that.resData.scoreId}`,
          query: that.resData
@@ -181,6 +181,7 @@
      //   // type: "warning",
      // });
      // return;
      // debugger;
      updateApplyStatus(data).then(res => {
        that.resData["examScoreId"] = res.data.id;
        this.$store.commit("SetScoreId", res.data.id);
@@ -201,6 +202,7 @@
      });
    },
    getUserInfoBYExam() {
      console.log(this.option,456123)
      var that = this;
      let setData = ({ color, subtext, isExam }) => {
        that.option.data = [
@@ -239,37 +241,44 @@
        that.$store.commit("SetexamUserData", that.option.data[0]);
      };
      var duibiTime = function(newTime, oldTime) {
        var newYear = newTime.split(" ")[0],
          newDat = newTime.split(" ")[1],
          oldYear = oldTime.split(" ")[0],
          oldDat = oldTime.split(" ")[1];
        if (newYear !== oldYear) {
          return false;
        } else {
          let newD = {
            s: +newDat.split(":")[0],
            f: +newDat.split(":")[1],
            m: +newDat.split(":")[2]
          };
          let oldD = {
            s: +oldDat.split(":")[0],
            f: +oldDat.split(":")[1],
            m: +oldDat.split(":")[2]
          };
          if (newD.s - oldD.s > 1) {
            return false;
          } else if (newD.s - oldD.s == 1) {
            if (newD.f < oldD.f) {
              return oldD.f - newD.f;
            } else {
              return false;
            }
          } else if (newD.s == oldD.s) {
            return 60 - (newD.f - oldD.f);
          }
          // return [newD, oldD];
          return false;
        }
        var newtimes = new Date(newTime.replace(/-/g,'/')).getTime();
        var oldtimes = new Date(oldTime.replace(/-/g,'/')).getTime();
        var dif = Math.ceil((newtimes - oldtimes)/(1000*60))
        return 90-dif
        // var newYear = newTime.split(" ")[0],
        //   newDat = newTime.split(" ")[1],
        //   oldYear = oldTime.split(" ")[0],
        //   oldDat = oldTime.split(" ")[1];
        //   debugger;
        // if (newYear !== oldYear) {
        //   return false;
        // } else {
        //   let newD = {
        //     s: +newDat.split(":")[0],
        //     f: +newDat.split(":")[1],
        //     m: +newDat.split(":")[2]
        //   };
        //   let oldD = {
        //     s: +oldDat.split(":")[0],
        //     f: +oldDat.split(":")[1],
        //     m: +oldDat.split(":")[2]
        //   };
        //   if (newD.s - oldD.s > 1) {
        //     return false;
        //   } else if (newD.s - oldD.s == 1) {
        //     if (newD.f < oldD.f) {
        //       // return oldD.f - newD.f;
        //       return 90 - (newD.f - oldD.f);
        //     } else {
        //       return false;
        //     }
        //   } else if (newD.s == oldD.s) {
        //     return 90 - (newD.f - oldD.f);
        //   }
        //   // return [newD, oldD];
        //   return false;
        // }
        // return false;
      };
@@ -281,7 +290,7 @@
          that.resData = res.data.data[0];
          var data = res.data.data[0];
          // console.log(data,333);
          //当前时间
          var nowD,
            startD = new Date(data.startTime),
@@ -311,6 +320,7 @@
            }
            // console.log(data, 123456);
            if (data.isExam == 3) {
              that.$store.commit("SetScoreId",  data.scoreId);
              this.scoreId = data.scoreId;
              setData({ color: "success", subtext: "继续考试", isExam: 3 });
              const currentTimeSTART = moment(data.examStartTime);