|
@@ -218,7 +218,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();
|
|
|
}
|
|
@@ -228,20 +231,30 @@ 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();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
let validateDuration = (rule, value, callback) => {
|
|
|
+ debugger;
|
|
|
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();
|
|
|
}
|
|
@@ -249,12 +262,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();
|
|
|
}
|
|
@@ -263,15 +282,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();
|
|
|
}
|
|
@@ -279,12 +307,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();
|
|
|
}
|
|
@@ -303,6 +340,7 @@ export default {
|
|
|
label_width_tab3: "120px"
|
|
|
},
|
|
|
activeName: "tab1",
|
|
|
+ toActiveName: null,
|
|
|
examDatetimeRange: [],
|
|
|
show_ckeditor: false,
|
|
|
form: {
|
|
@@ -384,6 +422,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
saveExam: function() {
|
|
|
+ this.toActiveName = null;
|
|
|
this.form.beginTime = this.examDatetimeRange[0];
|
|
|
this.form.endTime = this.examDatetimeRange[1];
|
|
|
console.log(this.form);
|