Răsfoiți Sursa

练习需要设置冻结时间过校验

xiatian 1 an în urmă
părinte
comite
b8c109a60a
1 a modificat fișierele cu 32 adăugiri și 32 ștergeri
  1. 32 32
      src/modules/examwork/view/practiceExam.vue

+ 32 - 32
src/modules/examwork/view/practiceExam.vue

@@ -262,7 +262,7 @@
                     >
                   </el-form-item>
                 </el-row>
-                <!-- <el-row>
+                <el-row>
                   <el-form-item
                     label="交卷冻结时间"
                     prop="FREEZE_TIME"
@@ -283,7 +283,7 @@
                       <el-radio label="BEGINTIME">按考试开始时间</el-radio>
                     </el-radio-group>
                   </el-form-item>
-                </el-row> -->
+                </el-row>
                 <el-row>
                   <el-form-item
                     label="断点续考时间"
@@ -481,31 +481,31 @@ let validateExamTimes = (rule, value, callback) => {
   }
 };
 
-// let validateFreezeTime = (rule, value, callback) => {
-//   let freezeTime = _this.form.properties.FREEZE_TIME;
-//   let duration = _this.form.duration;
-//   if (freezeTime === "") {
-//     callback(new Error("请输入交卷冻结时长"));
-//     if (!_this.toActiveName) {
-//       _this.toActiveName = "tab2";
-//       _this.activeName = "tab2";
-//     }
-//   } else if (0 > freezeTime || !freezeTime.toString().match(/^[1-9]\d*|0$/)) {
-//     callback(new Error("只能是非负整数"));
-//     if (!_this.toActiveName) {
-//       _this.toActiveName = "tab2";
-//       _this.activeName = "tab2";
-//     }
-//   } else if (duration != "" && parseInt(freezeTime) > parseInt(duration)) {
-//     callback(new Error("交卷冻结时长不能大于考试时长"));
-//     if (!_this.toActiveName) {
-//       _this.toActiveName = "tab2";
-//       _this.activeName = "tab2";
-//     }
-//   } else {
-//     callback();
-//   }
-// };
+let validateFreezeTime = (rule, value, callback) => {
+  let freezeTime = _this.form.properties.FREEZE_TIME;
+  let duration = _this.form.duration;
+  if (freezeTime === "") {
+    callback(new Error("请输入交卷冻结时长"));
+    if (!_this.toActiveName) {
+      _this.toActiveName = "tab2";
+      _this.activeName = "tab2";
+    }
+  } else if (0 > freezeTime || !freezeTime.toString().match(/^[1-9]\d*|0$/)) {
+    callback(new Error("只能是非负整数"));
+    if (!_this.toActiveName) {
+      _this.toActiveName = "tab2";
+      _this.activeName = "tab2";
+    }
+  } else if (duration != "" && parseInt(freezeTime) > parseInt(duration)) {
+    callback(new Error("交卷冻结时长不能大于考试时长"));
+    if (!_this.toActiveName) {
+      _this.toActiveName = "tab2";
+      _this.activeName = "tab2";
+    }
+  } else {
+    callback();
+  }
+};
 
 let validateExamReconnectTime = (rule, value, callback) => {
   let examReconnectTime = _this.form.properties.EXAM_RECONNECT_TIME;
@@ -564,8 +564,8 @@ export default {
         duration: 120,
         enable: "true",
         properties: {
-          // FREEZE_TIME: 0,
-          // FREEZE_TIME_TYPE: "DURATION",
+          FREEZE_TIME: 0,
+          FREEZE_TIME_TYPE: "DURATION",
           EXAM_RECONNECT_TIME: 30,
           BEFORE_EXAM_REMARK: "",
           AFTER_EXAM_REMARK: "",
@@ -596,9 +596,9 @@ export default {
         examTimes: [
           { required: true, validator: validateExamTimes, trigger: "blur" },
         ],
-        // FREEZE_TIME: [
-        //   { required: true, validator: validateFreezeTime, trigger: "blur" },
-        // ],
+        FREEZE_TIME: [
+          { required: true, validator: validateFreezeTime, trigger: "blur" },
+        ],
         EXAM_RECONNECT_TIME: [
           {
             required: true,