|
@@ -436,7 +436,10 @@ let validateName = (rule, value, callback) => {
|
|
|
let name = _this.form.name;
|
|
|
if (name == "") {
|
|
|
callback(new Error("请输入考试名称"));
|
|
|
- _this.activeName = "tab1";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab1";
|
|
|
+ _this.activeName = "tab1";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -446,7 +449,10 @@ let validateExamDatetimeRange = (rule, value, callback) => {
|
|
|
let examDatetimeRange = _this.examDatetimeRange;
|
|
|
if (!examDatetimeRange) {
|
|
|
callback(new Error("请输入考试时间"));
|
|
|
- _this.activeName = "tab1";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab1";
|
|
|
+ _this.activeName = "tab1";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -454,12 +460,18 @@ let validateExamDatetimeRange = (rule, value, callback) => {
|
|
|
|
|
|
let validateDuration = (rule, value, callback) => {
|
|
|
let duration = _this.form.duration;
|
|
|
- if (duration == "") {
|
|
|
+ if (duration === "") {
|
|
|
callback(new Error("请输入考试时长"));
|
|
|
- _this.activeName = "tab2";
|
|
|
- } else if (!duration.toString().match(/^[1-9]\d*|0$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
+ } else if (0 > duration || !duration.toString().match(/^[1-9]\d*|0$/)) {
|
|
|
callback(new Error("只能是非负整数"));
|
|
|
- _this.activeName = "tab2";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -467,12 +479,18 @@ let validateDuration = (rule, value, callback) => {
|
|
|
|
|
|
let validateExamTimes = (rule, value, callback) => {
|
|
|
let examTimes = _this.form.examTimes;
|
|
|
- if (examTimes == "") {
|
|
|
+ if (examTimes === "") {
|
|
|
callback(new Error("请输入考试次数"));
|
|
|
- _this.activeName = "tab2";
|
|
|
- } else if (!examTimes.toString().match(/^[1-9]\d*$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
+ } else if (0 >= examTimes || !examTimes.toString().match(/^[1-9]\d*$/)) {
|
|
|
callback(new Error("只能是正整数"));
|
|
|
- _this.activeName = "tab2";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -481,15 +499,24 @@ let validateExamTimes = (rule, value, callback) => {
|
|
|
let validateFreezeTime = (rule, value, callback) => {
|
|
|
let freezeTime = _this.form.properties.FREEZE_TIME;
|
|
|
let duration = _this.form.duration;
|
|
|
- if (freezeTime == "") {
|
|
|
+ if (freezeTime === "") {
|
|
|
callback(new Error("请输入交卷冻结时长"));
|
|
|
- _this.activeName = "tab2";
|
|
|
- } else if (!freezeTime.toString().match(/^[1-9]\d*|0$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
+ } else if (0 > freezeTime || !freezeTime.toString().match(/^[1-9]\d*|0$/)) {
|
|
|
callback(new Error("只能是非负整数"));
|
|
|
- _this.activeName = "tab2";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
} else if (duration != "" && freezeTime > duration) {
|
|
|
callback(new Error("交卷冻结时长不能大于考试时长"));
|
|
|
- _this.activeName = "tab2";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -497,12 +524,21 @@ let validateFreezeTime = (rule, value, callback) => {
|
|
|
|
|
|
let validateExamReconnectTime = (rule, value, callback) => {
|
|
|
let examReconnectTime = _this.form.properties.EXAM_RECONNECT_TIME;
|
|
|
- if (examReconnectTime == "") {
|
|
|
+ if (examReconnectTime === "") {
|
|
|
callback(new Error("请输入断点续考时间"));
|
|
|
- _this.activeName = "tab2";
|
|
|
- } else if (!examReconnectTime.toString().match(/^[1-9]\d*$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ 0 >= examReconnectTime ||
|
|
|
+ !examReconnectTime.toString().match(/^[1-9]\d*$/)
|
|
|
+ ) {
|
|
|
callback(new Error("只能是正整数"));
|
|
|
- _this.activeName = "tab2";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab2";
|
|
|
+ _this.activeName = "tab2";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -513,15 +549,27 @@ let validateSnapshotInterval = (rule, value, callback) => {
|
|
|
let snapshotnterval = _this.form.properties.SNAPSHOT_INTERVAL;
|
|
|
let duration = _this.form.duration;
|
|
|
if (isFaceEnable == "true") {
|
|
|
- if (snapshotnterval == "") {
|
|
|
+ if (snapshotnterval === "") {
|
|
|
callback(new Error("请输入抓拍间隔"));
|
|
|
- _this.activeName = "tab4";
|
|
|
- } else if (!snapshotnterval.toString().match(/^[1-9]\d*$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ 0 >= snapshotnterval ||
|
|
|
+ !snapshotnterval.toString().match(/^[1-9]\d*$/)
|
|
|
+ ) {
|
|
|
callback(new Error("只能是正整数"));
|
|
|
- _this.activeName = "tab4";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
} else if (duration != "" && snapshotnterval > duration) {
|
|
|
callback(new Error("抓拍间隔不能大于考试时长"));
|
|
|
- _this.activeName = "tab4";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -533,12 +581,21 @@ let validateWarnThreshold = (rule, value, callback) => {
|
|
|
let isFaceEnable = _this.form.properties.IS_FACE_ENABLE;
|
|
|
let warnThreshold = _this.form.properties.WARN_THRESHOLD;
|
|
|
if (isFaceEnable == "true") {
|
|
|
- if (warnThreshold == "") {
|
|
|
+ if (warnThreshold === "") {
|
|
|
callback(new Error("请输入预警阀值"));
|
|
|
- _this.activeName = "tab4";
|
|
|
- } else if (!warnThreshold.toString().match(/^[1-9]\d*$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ 0 >= warnThreshold ||
|
|
|
+ !warnThreshold.toString().match(/^[1-9]\d*$/)
|
|
|
+ ) {
|
|
|
callback(new Error("只能是正整数"));
|
|
|
- _this.activeName = "tab4";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -550,12 +607,21 @@ let validateLivingWarnThreshold = (rule, value, callback) => {
|
|
|
let isFaceEnable = _this.form.properties.IS_FACE_ENABLE;
|
|
|
let livingWarnThreshold = _this.form.properties.LIVING_WARN_THRESHOLD;
|
|
|
if (isFaceEnable == "true") {
|
|
|
- if (livingWarnThreshold == "") {
|
|
|
+ if (livingWarnThreshold === "") {
|
|
|
callback(new Error("请输入真实性预警阀值"));
|
|
|
- _this.activeName = "tab4";
|
|
|
- } else if (!livingWarnThreshold.toString().match(/^[1-9]\d*$/)) {
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ 0 >= livingWarnThreshold ||
|
|
|
+ !livingWarnThreshold.toString().match(/^[1-9]\d*$/)
|
|
|
+ ) {
|
|
|
callback(new Error("只能是正整数"));
|
|
|
- _this.activeName = "tab4";
|
|
|
+ if (!_this.toActiveName) {
|
|
|
+ _this.toActiveName = "tab4";
|
|
|
+ _this.activeName = "tab4";
|
|
|
+ }
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
@@ -580,6 +646,7 @@ export default {
|
|
|
label_width_tab6: "120px"
|
|
|
},
|
|
|
activeName: "tab1",
|
|
|
+ toActiveName: null,
|
|
|
examDatetimeRange: [],
|
|
|
show_ckeditor: false,
|
|
|
form: {
|
|
@@ -707,6 +774,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
saveExam: function() {
|
|
|
+ this.toActiveName = null;
|
|
|
this.form.beginTime = this.examDatetimeRange[0];
|
|
|
this.form.endTime = this.examDatetimeRange[1];
|
|
|
console.log(this.form);
|
|
@@ -734,7 +802,9 @@ export default {
|
|
|
type: "success",
|
|
|
message: "新增成功"
|
|
|
});
|
|
|
- this.back();
|
|
|
+ this.$router.push({
|
|
|
+ path: "/examwork/onlineExam/" + response.data.id
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
} else {
|