WANG 6 年 前
コミット
6e2c089b36
1 ファイル変更19 行追加7 行削除
  1. 19 7
      src/modules/examwork/view/onlineExam.vue

+ 19 - 7
src/modules/examwork/view/onlineExam.vue

@@ -466,7 +466,7 @@ let validateDuration = (rule, value, callback) => {
       _this.toActiveName = "tab2";
       _this.activeName = "tab2";
     }
-  } else if (!duration.toString().match(/^[1-9]\d*|0$/)) {
+  } else if (0 > duration || !duration.toString().match(/^[1-9]\d*|0$/)) {
     callback(new Error("只能是非负整数"));
     if (!_this.toActiveName) {
       _this.toActiveName = "tab2";
@@ -485,7 +485,7 @@ let validateExamTimes = (rule, value, callback) => {
       _this.toActiveName = "tab2";
       _this.activeName = "tab2";
     }
-  } else if (!examTimes.toString().match(/^[1-9]\d*$/)) {
+  } else if (0 >= examTimes || !examTimes.toString().match(/^[1-9]\d*$/)) {
     callback(new Error("只能是正整数"));
     if (!_this.toActiveName) {
       _this.toActiveName = "tab2";
@@ -505,7 +505,7 @@ let validateFreezeTime = (rule, value, callback) => {
       _this.toActiveName = "tab2";
       _this.activeName = "tab2";
     }
-  } else if (!freezeTime.toString().match(/^[1-9]\d*|0$/)) {
+  } else if (0 > freezeTime || !freezeTime.toString().match(/^[1-9]\d*|0$/)) {
     callback(new Error("只能是非负整数"));
     if (!_this.toActiveName) {
       _this.toActiveName = "tab2";
@@ -530,7 +530,10 @@ let validateExamReconnectTime = (rule, value, callback) => {
       _this.toActiveName = "tab2";
       _this.activeName = "tab2";
     }
-  } else if (!examReconnectTime.toString().match(/^[1-9]\d*$/)) {
+  } else if (
+    0 >= examReconnectTime ||
+    !examReconnectTime.toString().match(/^[1-9]\d*$/)
+  ) {
     callback(new Error("只能是正整数"));
     if (!_this.toActiveName) {
       _this.toActiveName = "tab2";
@@ -552,7 +555,10 @@ let validateSnapshotInterval = (rule, value, callback) => {
         _this.toActiveName = "tab4";
         _this.activeName = "tab4";
       }
-    } else if (!snapshotnterval.toString().match(/^[1-9]\d*$/)) {
+    } else if (
+      0 >= snapshotnterval ||
+      !snapshotnterval.toString().match(/^[1-9]\d*$/)
+    ) {
       callback(new Error("只能是正整数"));
       if (!_this.toActiveName) {
         _this.toActiveName = "tab4";
@@ -581,7 +587,10 @@ let validateWarnThreshold = (rule, value, callback) => {
         _this.toActiveName = "tab4";
         _this.activeName = "tab4";
       }
-    } else if (!warnThreshold.toString().match(/^[1-9]\d*$/)) {
+    } else if (
+      0 >= warnThreshold ||
+      !warnThreshold.toString().match(/^[1-9]\d*$/)
+    ) {
       callback(new Error("只能是正整数"));
       if (!_this.toActiveName) {
         _this.toActiveName = "tab4";
@@ -604,7 +613,10 @@ let validateLivingWarnThreshold = (rule, value, callback) => {
         _this.toActiveName = "tab4";
         _this.activeName = "tab4";
       }
-    } else if (!livingWarnThreshold.toString().match(/^[1-9]\d*$/)) {
+    } else if (
+      0 >= livingWarnThreshold ||
+      !livingWarnThreshold.toString().match(/^[1-9]\d*$/)
+    ) {
       callback(new Error("只能是正整数"));
       if (!_this.toActiveName) {
         _this.toActiveName = "tab4";