diff --git a/src/views/publish/examRule/draft/examFrom.vue b/src/views/publish/examRule/draft/examFrom.vue index 608f5c502..b10fe1413 100644 --- a/src/views/publish/examRule/draft/examFrom.vue +++ b/src/views/publish/examRule/draft/examFrom.vue @@ -23,6 +23,7 @@ style="width: 100%;" value-format="timestamp" :disabled="isEdit" + :picker-options="pickerOptions" /> @@ -35,7 +36,8 @@ :placeholder="$t('publish.endTestTime')" style="width: 100%;" value-format="timestamp" - :disabled="isEdit" + :disabled="true" + :picker-options="pickerOptions" /> @@ -111,6 +113,11 @@ export default { }, 100); }; return { + pickerOptions: { + disabledDate(time) { + return time.getTime() < new Date(new Date().toLocaleDateString()).getTime(); + } + }, formDetail: { name: '', region: '', @@ -224,12 +231,21 @@ export default { submitForm() { this.$refs['form'].validate((valid) => { if (valid) { + this.form.startDate=this.getDate(this.form.startDate); + this.form.endDate=this.getDate(this.form.endDate); this.form['trial'] = this.trial; this.$store.dispatch('exam/setCourseDetail', this.form); this.$emit('definition', this.form); } }); }, + getDate(date) { + let now = new Date(date), +    y = now.getFullYear(), +    m = now.getMonth() + 1, +    d = now.getDate(); +    return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8); + }, updateForm() { this.$refs['form'].validate((valid) => { if (valid) {