|
|
@ -159,7 +159,8 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import util from "@/libs/util"; |
|
|
|
import Setting from '@/setting' |
|
|
|
|
|
|
|
import Util from '@/libs/util' |
|
|
|
import { mapState, mapActions } from "vuex"; |
|
|
|
import { mapState, mapActions } from "vuex"; |
|
|
|
import StudentTree from "@/components/student-tree/src/tree"; |
|
|
|
import StudentTree from "@/components/student-tree/src/tree"; |
|
|
|
import qs from 'qs' |
|
|
|
import qs from 'qs' |
|
|
@ -167,6 +168,7 @@ export default { |
|
|
|
components: { StudentTree }, |
|
|
|
components: { StudentTree }, |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
token: Util.local.get(Setting.tokenKey), |
|
|
|
founderKeys: { |
|
|
|
founderKeys: { |
|
|
|
0: "系统", |
|
|
|
0: "系统", |
|
|
|
1: "老师" |
|
|
|
1: "老师" |
|
|
@ -251,7 +253,7 @@ export default { |
|
|
|
if (!this.isToProject) this.setAss({}); |
|
|
|
if (!this.isToProject) this.setAss({}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
this.date = [util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000)), util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000))]; |
|
|
|
this.date = [Util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000)), Util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(new Date().getTime() + 300000))]; |
|
|
|
this.form.id && this.getData(); |
|
|
|
this.form.id && this.getData(); |
|
|
|
this.recoveryData(); |
|
|
|
this.recoveryData(); |
|
|
|
this.getschoolCourse(); |
|
|
|
this.getschoolCourse(); |
|
|
@ -266,8 +268,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
date: function (val) { |
|
|
|
date: function (val) { |
|
|
|
if (val[0] != "0000-00-00 00:00:00") { |
|
|
|
if (val[0] != "0000-00-00 00:00:00") { |
|
|
|
this.startTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[0])); |
|
|
|
this.startTime = Util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[0])); |
|
|
|
this.stopTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[1])); |
|
|
|
this.stopTime = Util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[1])); |
|
|
|
this.updateTime++ |
|
|
|
this.updateTime++ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -408,33 +410,33 @@ export default { |
|
|
|
save (cb) { // 提交 |
|
|
|
save (cb) { // 提交 |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
|
if (!this.form.experimentalName) return util.warningMsg("请填写考核名称"); |
|
|
|
if (!this.form.experimentalName) return Util.warningMsg("请填写考核名称"); |
|
|
|
if (this.expNameRepeat) return util.warningMsg("考核名称重复,请重新输入"); |
|
|
|
if (this.expNameRepeat) return Util.warningMsg("考核名称重复,请重新输入"); |
|
|
|
if (this.form.type !== 1) { |
|
|
|
if (this.form.type !== 1) { |
|
|
|
if (new Date().getTime() > new Date(this.startTime).getTime()) return util.warningMsg("开始时间不能早于当前时间"); |
|
|
|
if (new Date().getTime() > new Date(this.startTime).getTime()) return Util.warningMsg("开始时间不能早于当前时间"); |
|
|
|
let timestamp = new Date(new Date(this.stopTime).getTime() - new Date(this.startTime).getTime()); |
|
|
|
let timestamp = new Date(new Date(this.stopTime).getTime() - new Date(this.startTime).getTime()); |
|
|
|
let minute = 1000 * 60; |
|
|
|
let minute = 1000 * 60; |
|
|
|
let hour = minute * 60; |
|
|
|
let hour = minute * 60; |
|
|
|
let day = hour * 24; |
|
|
|
let day = hour * 24; |
|
|
|
this.form.experimentDuration = `${Math.floor(timestamp / day)}d${Math.floor(timestamp % day / hour)}h${Math.floor(timestamp % day % hour / minute)}m`; |
|
|
|
this.form.experimentDuration = `${Math.floor(timestamp / day)}d${Math.floor(timestamp % day / hour)}h${Math.floor(timestamp % day % hour / minute)}m`; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.form.type == 1 && this.form.experimentDuration == "0d0h0m") return util.warningMsg("请填写考核时长"); |
|
|
|
if (this.form.type == 1 && this.form.experimentDuration == "0d0h0m") return Util.warningMsg("请填写考核时长"); |
|
|
|
if (this.form.type == 2 && this.startTime == "0000-00-00 00:00:00") return util.warningMsg("请填写考核时间"); |
|
|
|
if (this.form.type == 2 && this.startTime == "0000-00-00 00:00:00") return Util.warningMsg("请填写考核时间"); |
|
|
|
if (this.form.type == 1) { |
|
|
|
if (this.form.type == 1) { |
|
|
|
const { day, hour, minute } = this.duration |
|
|
|
const { day, hour, minute } = this.duration |
|
|
|
if (String(day).includes('.')) return util.warningMsg('考核天数请填写整数') |
|
|
|
if (String(day).includes('.')) return Util.warningMsg('考核天数请填写整数') |
|
|
|
if (day < 0) return util.warningMsg('考核天数请勿填写负数') |
|
|
|
if (day < 0) return Util.warningMsg('考核天数请勿填写负数') |
|
|
|
if (String(hour).includes('.')) return util.warningMsg('考核小时请填写整数') |
|
|
|
if (String(hour).includes('.')) return Util.warningMsg('考核小时请填写整数') |
|
|
|
if (hour < 0) return util.warningMsg('考核小时请勿填写负数') |
|
|
|
if (hour < 0) return Util.warningMsg('考核小时请勿填写负数') |
|
|
|
if (String(minute).includes('.')) return util.warningMsg('考核分钟请填写整数') |
|
|
|
if (String(minute).includes('.')) return Util.warningMsg('考核分钟请填写整数') |
|
|
|
if (minute < 0) return util.warningMsg('考核分钟请勿填写负数') |
|
|
|
if (minute < 0) return Util.warningMsg('考核分钟请勿填写负数') |
|
|
|
} |
|
|
|
} |
|
|
|
if (!form.uuid) return util.warningMsg("请选择考核项目"); |
|
|
|
if (!form.uuid) return Util.warningMsg("请选择考核项目"); |
|
|
|
const item = this.projectData.find(e => form.uuid === e.projectId || form.uuid === e.paperId) |
|
|
|
const item = this.projectData.find(e => form.uuid === e.projectId || form.uuid === e.paperId) |
|
|
|
if (item) form[item.projectId ? 'projectId' : 'paperId'] = form.uuid |
|
|
|
if (item) form[item.projectId ? 'projectId' : 'paperId'] = form.uuid |
|
|
|
if (this.form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
if (this.form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
if (!this.form.invitationCode) return util.warningMsg("请设置邀请码"); |
|
|
|
if (!this.form.invitationCode) return Util.warningMsg("请设置邀请码"); |
|
|
|
if (!this.form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return util.warningMsg("请输入6位纯数字邀请码"); |
|
|
|
if (!this.form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return Util.warningMsg("请输入6位纯数字邀请码"); |
|
|
|
} |
|
|
|
} |
|
|
|
this.form.startTime = this.form.type == 2 ? this.startTime : '' |
|
|
|
this.form.startTime = this.form.type == 2 ? this.startTime : '' |
|
|
|
this.form.stopTime = this.form.type == 2 ? this.stopTime : '' |
|
|
|
this.form.stopTime = this.form.type == 2 ? this.stopTime : '' |
|
|
@ -448,7 +450,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (this.isSpecify == 1 && !stuInfo.length) { |
|
|
|
if (this.isSpecify == 1 && !stuInfo.length) { |
|
|
|
util.warningMsg("请选择学生"); |
|
|
|
Util.warningMsg("请选择学生"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.form.classId = classId.toString(); |
|
|
|
this.form.classId = classId.toString(); |
|
|
@ -461,7 +463,7 @@ export default { |
|
|
|
if (this.form.id) { |
|
|
|
if (this.form.id) { |
|
|
|
this.$post(this.api.modifyAssessment, this.form).then(async res => { |
|
|
|
this.$post(this.api.modifyAssessment, this.form).then(async res => { |
|
|
|
this.updateTime = 0 |
|
|
|
this.updateTime = 0 |
|
|
|
util.successMsg("修改成功"); |
|
|
|
Util.successMsg("修改成功"); |
|
|
|
cb ? cb() : this.backPage() |
|
|
|
cb ? cb() : this.backPage() |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
@ -469,7 +471,7 @@ export default { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$post(this.api.saveAssessment, this.form).then(res => { |
|
|
|
this.$post(this.api.saveAssessment, this.form).then(res => { |
|
|
|
this.updateTime = 0 |
|
|
|
this.updateTime = 0 |
|
|
|
util.successMsg("创建成功"); |
|
|
|
Util.successMsg("创建成功"); |
|
|
|
cb ? cb() : this.$router.push('list') |
|
|
|
cb ? cb() : this.$router.push('list') |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
@ -534,7 +536,22 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
showProject (row) { |
|
|
|
showProject (row) { |
|
|
|
this.handleCacheData() |
|
|
|
this.handleCacheData() |
|
|
|
|
|
|
|
if (row.paperId) { |
|
|
|
|
|
|
|
// 理论试卷 |
|
|
|
|
|
|
|
let url = `${location.origin}/examination` |
|
|
|
|
|
|
|
if (Setting.isDev) { |
|
|
|
|
|
|
|
url = `http://192.168.31.125:8098/` |
|
|
|
|
|
|
|
} else if (Setting.isPro) { |
|
|
|
|
|
|
|
const { host } = location |
|
|
|
|
|
|
|
url = `https://${host === 'dev.huorantech.cn' ? host : 'www.huorantech.cn'}/examination/` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
url += `#/testPaper/preview?id=${row.paperId}&token=${this.token}` |
|
|
|
|
|
|
|
localStorage.setItem('exam_token', this.token) |
|
|
|
|
|
|
|
window.open(url) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 实训 |
|
|
|
this.$router.push(`/project/add?projectId=${row.projectId}&show=1&ass=1`) |
|
|
|
this.$router.push(`/project/add?projectId=${row.projectId}&show=1&ass=1`) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
createInv () { |
|
|
|
createInv () { |
|
|
|
let result = ""; |
|
|
|
let result = ""; |
|
|
|