|
|
|
@ -417,15 +417,8 @@ export default { |
|
|
|
|
2 : |
|
|
|
|
0 |
|
|
|
|
|
|
|
|
|
let now |
|
|
|
|
if (!this.projectPermissions) { |
|
|
|
|
now = await this.getNow() |
|
|
|
|
} else { |
|
|
|
|
now = await this.getSumTime() // 考核、赛事获取第一次进入系统的时间,练习不需要 |
|
|
|
|
if (!now) now = await this.getNow() |
|
|
|
|
} |
|
|
|
|
await this.getEntryTime() |
|
|
|
|
|
|
|
|
|
this.entryTime = now |
|
|
|
|
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) |
|
|
|
|
this.getAssList() |
|
|
|
|
} else { // 练习 |
|
|
|
@ -458,10 +451,13 @@ export default { |
|
|
|
|
permissions: this.projectPermissions // 练习/考核/竞赛 |
|
|
|
|
} |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`, data).then(res => { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`, data).then(async res => { |
|
|
|
|
const list = res.projects |
|
|
|
|
this.projectList = list |
|
|
|
|
if (!this.projectPermissions && !this.projectId) this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
|
if (!this.projectPermissions && !this.projectId) { |
|
|
|
|
this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
|
await this.getEntryTime() |
|
|
|
|
} |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
@ -526,13 +522,12 @@ export default { |
|
|
|
|
this.experimentHint = project.experimentHint |
|
|
|
|
this.hintOpen = project.founder ? !project.hintOpenBySchool : !project.hintOpen // 0显示,1不显示,系统跟老师的禁用字段不一样 |
|
|
|
|
this.$emit('tell', projectId, systemId, this.points) |
|
|
|
|
// this.getSumTime() |
|
|
|
|
const isPrac = this.projectPermissions == 0 // 是否是练习 |
|
|
|
|
this.text = isPrac ? '已用' : '剩余' |
|
|
|
|
// 竞赛不需要 |
|
|
|
|
if (!this.competitionId) { |
|
|
|
|
const now = await this.getNow() |
|
|
|
|
this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 |
|
|
|
|
this.countVal = (isPrac ? now - this.entryTime : (new Date(this.endTime) - now)) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接取当前时间减去上次进来的时间做计时 |
|
|
|
|
this.startCount() |
|
|
|
|
} |
|
|
|
|
resolve() |
|
|
|
@ -558,6 +553,16 @@ export default { |
|
|
|
|
resolve(new Date(res.currentTime)) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 获取进入时间 |
|
|
|
|
getEntryTime () { |
|
|
|
|
return new Promise(async (resolve, reject) => { |
|
|
|
|
let now |
|
|
|
|
if (this.projectId) now = await this.getSumTime() // 获取第一次进入系统的时间 |
|
|
|
|
if (!now) now = await this.getNow() |
|
|
|
|
this.entryTime = now |
|
|
|
|
resolve() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 关闭父页面的loading,并置加载完成状态为true |
|
|
|
|
closeLoad () { |
|
|
|
|
this.$parent.loadIns.close() |
|
|
|
@ -599,7 +604,7 @@ export default { |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 获取上次缓存记录 |
|
|
|
|
getCache (cache) { |
|
|
|
|
async getCache (cache) { |
|
|
|
|
const pId = cache ? cache.projectId : '' |
|
|
|
|
const projectId = Number(pId || this.projectId) |
|
|
|
|
const cid = this.courseId |
|
|
|
@ -743,13 +748,14 @@ export default { |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 项目选择回调 |
|
|
|
|
selectProject () { |
|
|
|
|
async selectProject () { |
|
|
|
|
this.isSelected = true |
|
|
|
|
await this.getEntryTime() |
|
|
|
|
this.countVal = this.entryTime |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
this.getCache() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
this.setSubmit(false) |
|
|
|
|
this.countVal = 0 |
|
|
|
|
this.grade = '00' |
|
|
|
|
this.pannelTab = 'first' |
|
|
|
|
this.clearReport() |
|
|
|
@ -889,7 +895,7 @@ export default { |
|
|
|
|
if (this.isSubmit) return false |
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
|
const date = await this.getNow() |
|
|
|
|
const entryTime = this.entryTime |
|
|
|
|
const { entryTime } = this |
|
|
|
|
const timeSum = Math.ceil((date - entryTime) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
|
const projectId = this.projectId |
|
|
|
@ -913,7 +919,7 @@ export default { |
|
|
|
|
classId: this.classId ? this.classId : '', |
|
|
|
|
className: this.className ? this.className : '', |
|
|
|
|
curriculumId: this.courseId, |
|
|
|
|
startTime: this.projectPermissions ? this.startTime : util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间) |
|
|
|
|
startTime: util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 取页面进入的时间 |
|
|
|
|
endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
timeSum, |
|
|
|
|