+
-
-
- 返回
- 保存
-
+
+
+ 返回
+ 保存
+
@@ -28,113 +17,101 @@
-
+
- {{dict.dictLabel}}
+ {{ dict.dictLabel }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -149,14 +126,14 @@ import { dateToString, dateTextToDateString, dateRemoveSeconds, dateTextToDateti
export default {
components: {
examSelect,
- CropperImage
- },
- data () {
+ CropperImage
+ },
+ data() {
return {
choiceVisible: true,
// 状态字典
statusOptions: [],
- ui_style : null,
+ ui_style: null,
hosturl: '',
// 表单参数
form: {},
@@ -179,17 +156,18 @@ export default {
]
},
buildTypeOptions: [
- {dictValue: 1, dictLabel: "人工组卷"},
- {dictValue: 2, dictLabel: "随机抽题"},
- {dictValue: 3, dictLabel: "考时随机组卷"}
+ { dictValue: 1, dictLabel: "人工组卷" },
+ { dictValue: 2, dictLabel: "随机抽题" },
+ { dictValue: 3, dictLabel: "考时随机组卷" }
],
choiceList: null,
forceDoneOptions: [
- {dictValue: 0, dictLabel: "强制抽卷"},
- {dictValue: 1, dictLabel: "不强制"}
+ { dictValue: 0, dictLabel: "强制抽卷" },
+ { dictValue: 1, dictLabel: "不强制" }
],
imageUrl: null,
startDate: null,
+ endDate:null,
url: '',
upLoadData: {
guidCode: ''
@@ -199,68 +177,88 @@ export default {
isUpdate: false
}
},
- created () {
+ watch: {
+ // 监听开始时间和结束时间的变化
+ startDate(newVal, oldVal) {
+ if (this.form.examType == 2 && this.endDate) {
+ this.validateTimeRange();
+ }
+ },
+ endDate(newVal, oldVal) {
+ if (this.form.examType == 2 && this.startDate) {
+ this.validateTimeRange();
+ }
+ },
+ 'form.examType'(newVal, oldVal) {
+ if (newVal == 2 && this.startDate && this.endDate) {
+ this.validateTimeRange();
+ }
+ }
+ },
+ created() {
const s_width = document.body.clientWidth
if (s_width < 1000) {
- this.ui_style = 'margin-left: 2%; margin-right: 2%;'
+ this.ui_style = 'margin-left: 2%; margin-right: 2%;'
} else if (s_width >= 1000 && s_width < 1366) {
- this.ui_style = 'margin-left: 8%; margin-right: 8%;'
+ this.ui_style = 'margin-left: 8%; margin-right: 8%;'
} else if (s_width >= 1366 && s_width < 1566) {
- this.ui_style = 'margin-left: 12%; margin-right: 12%;'
+ this.ui_style = 'margin-left: 12%; margin-right: 12%;'
} else if (s_width >= 1566 && s_width < 1766) {
- this.ui_style = 'margin-left: 18%; margin-right: 18%;'
+ this.ui_style = 'margin-left: 18%; margin-right: 18%;'
} else {
- this.ui_style = 'margin-left: 24%; margin-right: 24%;'
+ this.ui_style = 'margin-left: 24%; margin-right: 24%;'
}
this.hosturl = baseApiUrl
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
- });
+ });
},
methods: {
- init_data (contentdata, choicelist) {
+ init_data(contentdata, choicelist) {
this.isUpdate = false
- if (contentdata.examCode !== undefined && contentdata.examCode !== null ) {
- this.form = contentdata
+ if (contentdata.examCode !== undefined && contentdata.examCode !== null) {
+ contentdata.examType=contentdata.examType||1;
+ contentdata.examTimes=contentdata.examTimes||1;
+ this.form = contentdata
if (this.form.pictureUrl !== undefined && this.form.pictureUrl !== null) {
- this.imageUrl = this.hosturl + this.form.pictureUrl
+ this.imageUrl = this.hosturl + this.form.pictureUrl
}
}
if (choicelist !== undefined && choicelist !== null) {
this.choiceList = choicelist
- }
+ }
},
- update_data (row) {
+ update_data(row) {
this.isUpdate = true
row.forceDone = Number(row.forceDone)
row.buildType = Number(row.buildType)
-
+
this.form = row
if (this.form.pictureUrl !== undefined && this.form.pictureUrl !== null) {
- this.imageUrl = this.hosturl + this.form.pictureUrl
+ this.imageUrl = this.hosturl + this.form.pictureUrl
}
this.startDate = row.startTime
listQuestionsbankBycode(row.examBank).then(response => {
this.choiceList = response.data
});
},
- doChoice () {
+ doChoice() {
this.choiceVisible = false
this.$store.commit("SET_SHOWTITLE", false)
this.$nextTick(() => {
- this.$refs.selectRef.init_data(this.choiceList)
+ this.$refs.selectRef.init_data(this.choiceList)
})
},
- selectDoneHandle (saveList) {
+ selectDoneHandle(saveList) {
this.$store.commit("SET_SHOWTITLE", true)
this.choiceList = saveList
this.choiceVisible = true
-
+
let nametext = ''
let codetext = ''
if (this.choiceList !== null && this.choiceList.length > 0) {
- for (let i = 0; i < this.choiceList.length; i ++) {
+ for (let i = 0; i < this.choiceList.length; i++) {
if (i < this.choiceList.length - 1) {
nametext += this.choiceList[i].bankName + ','
codetext += this.choiceList[i].bankCode + ','
@@ -273,7 +271,7 @@ export default {
this.form.examBankText = nametext
this.form.examBank = codetext
},
- onTimeChange () {
+ onTimeChange() {
if (this.startDate === undefined || this.startDate === null) {
this.form.examDuration = undefined
this.$message.error('请先输入考试开始时间')
@@ -281,15 +279,20 @@ export default {
}
this.set_time()
},
- set_time () {
+ set_time() {
let timeitem = this.form.examDuration.split(":")
const addhour = Number(timeitem[0]) * 60 * 60 * 1000
const addminute = Number(timeitem[1]) * 60 * 1000
const datestr = dateRemoveSeconds(new Date(this.startDate))
this.form.startTime = Number(new Date(datestr).getTime())
- this.form.endTime = this.form.startTime + addhour + addminute
+ if(this.form.examType==1){
+ this.form.endTime = this.form.startTime + addhour + addminute
+ }else{
+ const dateEnd=dateRemoveSeconds(new Date(this.endDate))
+ this.form.endTime = Number(new Date(dateEnd).getTime())
+ }
},
- getData () {
+ getData() {
if (this.onCheck()) {
const saveData = {
choiceList: this.choiceList,
@@ -300,29 +303,36 @@ export default {
return null
}
},
- saveData () {
+ saveData() {
if (this.onCheck()) {
- this.set_time ()
+ // 在设置时间之前再次验证时间范围
+ if (this.form.examType == 2) {
+ if (!this.validateTimeRange()) {
+ return false;
+ }
+ }
+
+ this.set_time()
updateExamtask(this.form).then(response => {
this.msgSuccess("修改成功");
return true
- });
+ });
} else {
return false
}
},
- onClose () {
+ onClose() {
this.$emit('refreshContent')
- },
- onSaveOrBack () {
+ },
+ onSaveOrBack() {
if (this.saveData()) {
this.$emit('refreshContent')
}
- },
- onSave () {
+ },
+ onSave() {
this.saveData()
},
- onCheck () {
+ onCheck() {
if (this.form.examName === undefined || this.form.examName === null) {
this.$message.error('需要输入考试名称')
return false
@@ -341,36 +351,65 @@ export default {
if (this.form.pictureUrl === undefined || this.form.pictureUrl === null) {
this.$message.error('需要先加入标题图片')
return false
- }
+ }
if (this.startDate === undefined || this.startDate === null) {
this.$message.error('需要输入考试开始时间')
return false
}
+ // 添加时间验证:开始时间不能晚于结束时间,结束时间不能早于开始时间
+ if (this.form.examType == 2) {
+ if (this.endDate === undefined || this.endDate === null) {
+ this.$message.error('需要输入考试结束时间')
+ return false
+ }
+
+ const startDateTime = new Date(this.startDate).getTime();
+ const endDateTime = new Date(this.endDate).getTime();
+
+ if (startDateTime >= endDateTime) {
+ this.$message.error('开始时间不能晚于或等于结束时间')
+ return false
+ }
+ }
+
if (this.form.examDuration === undefined || this.form.examDuration === null) {
this.$message.error('需要输入考试时长')
return false
}
-
+
if (this.form.startTime === undefined || this.form.startTime === null) {
this.set_time()
}
return true
},
- beforeAvatarUpload (file) {
+ beforeAvatarUpload(file) {
this.cropperModel = true
this.cropperName = name
this.$nextTick(() => {
this.$refs.child.selectImg(this.form.examCode, file)
- })
+ })
},
// 图片上传成功后
- handleUploadSuccess (data) {
- this.imageUrl = this.hosturl + data.photoUrl
+ handleUploadSuccess(data) {
+ this.imageUrl = this.hosturl + data.photoUrl
this.form.pictureUrl = data.photoUrl
this.cropperModel = false
+ },
+ // 验证时间范围
+ validateTimeRange() {
+ if (this.startDate && this.endDate) {
+ const startDateTime = new Date(this.startDate).getTime();
+ const endDateTime = new Date(this.endDate).getTime();
+
+ if (startDateTime >= endDateTime) {
+ this.$message.error('开始时间不能晚于或等于结束时间');
+ return false;
+ }
+ }
+ return true;
}
}
};
@@ -378,18 +417,18 @@ export default {
-
-
diff --git a/exam_online_ui/src/views/login.vue b/exam_online_ui/src/views/login.vue
index 7191512..7da749f 100644
--- a/exam_online_ui/src/views/login.vue
+++ b/exam_online_ui/src/views/login.vue
@@ -45,16 +45,43 @@
登 录 中...
+
+
+ 微信扫码登录
+
+
+
+
+
+
+
![微信二维码]()
+
二维码加载中...
+
请使用微信扫描二维码登录
+
+
+