|
|
|
@ -44,7 +44,7 @@ |
|
|
|
|
v-show="projectPermissions == 0" |
|
|
|
|
@click="reload" |
|
|
|
|
>重新开始</el-button> |
|
|
|
|
<el-button style="margin-right:7px" @click="submit" :disabled="isSubmit">提交</el-button> |
|
|
|
|
<el-button style="margin-right:7px" @click="confirmSubmit" :disabled="isSubmit">提交</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-header> |
|
|
|
@ -170,13 +170,14 @@ export default { |
|
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
|
pannelTab: 'first', // 面板信息切换值 |
|
|
|
|
isSelected: false // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
isSelected: false, // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
statusTimer: null // 查询考核状态定时器 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
|
this.getList() |
|
|
|
|
this.getAssList() |
|
|
|
|
}else{ // 练习 |
|
|
|
|
// 获取项目列表 |
|
|
|
|
this.getList().then(() => { |
|
|
|
@ -246,6 +247,36 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 获取考核列表来查询该考核是否已经考过 |
|
|
|
|
getAssList(){ |
|
|
|
|
this.$post(`${this.api.pageStuAssessment}`, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10000 |
|
|
|
|
}).then(res => { |
|
|
|
|
const list = res.list |
|
|
|
|
const assessmentId = this.assessmentId |
|
|
|
|
let done = false |
|
|
|
|
list.map(e => { |
|
|
|
|
// 匹配到该考核,并且已经提交过(有reportId则说明有实验记录) |
|
|
|
|
if (e.assessmentId == assessmentId && e.reportId) { |
|
|
|
|
done = true |
|
|
|
|
this.isSubmit = true |
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
this.$message.error('你已经提交过该考核!') |
|
|
|
|
setTimeout(_ => { |
|
|
|
|
history.back() // 直接返回上一页面 |
|
|
|
|
}, 1500) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (!done) { |
|
|
|
|
this.getList() |
|
|
|
|
// 查询考核状态定时器 |
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
this.getStatus() |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 获取上次缓存记录 |
|
|
|
|
getCache(pId, jId) { |
|
|
|
|
const projectId = pId || this.projectId |
|
|
|
@ -287,6 +318,19 @@ export default { |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 定时查询考核状态(只有考核才需要定时查,查到考核如果结束后,直接提交考核) |
|
|
|
|
getStatus() { |
|
|
|
|
this.$get(this.api.getDetailById, { |
|
|
|
|
id: this.assessmentId |
|
|
|
|
}).then(res => { |
|
|
|
|
const done = res.data ? res.data.status === 2 : false // 状态(0、待开始 1、进行中 2、已结束) |
|
|
|
|
// 如果考核已结束,则清除查询考核状态的定时器,并且自动提交 |
|
|
|
|
if (done) { |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.submit() |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 项目选择回调 |
|
|
|
|
selectProject(){ |
|
|
|
|
this.isSelected = true |
|
|
|
@ -307,6 +351,7 @@ export default { |
|
|
|
|
this.isSubmit = false |
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
const points = this.points |
|
|
|
|
// code和codeId,还有运行结果全部清空 |
|
|
|
|
points.map(e => { |
|
|
|
|
e.code = '' |
|
|
|
|
e.codeId = '' |
|
|
|
@ -316,16 +361,22 @@ export default { |
|
|
|
|
this.$emit('recoveryCode') |
|
|
|
|
this.startCount() |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit() { |
|
|
|
|
// 提交询问 |
|
|
|
|
confirmSubmit() { |
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
|
if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验') |
|
|
|
|
// if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验') |
|
|
|
|
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
center: true |
|
|
|
|
}).then(() => { |
|
|
|
|
this.submit() |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit() { |
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
|
const date = new Date() |
|
|
|
|
const entryTime = this.entryTime |
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
@ -366,20 +417,19 @@ export default { |
|
|
|
|
let list = res.retInfo |
|
|
|
|
let taskList = this.taskList |
|
|
|
|
var score = 0 |
|
|
|
|
// 给判分列表添加分数和运行结果 |
|
|
|
|
taskList.map(e => { |
|
|
|
|
let item = list.find(n => n.judgmentPointsId === e.judgmentId) |
|
|
|
|
if (item) { |
|
|
|
|
e.score = item.score |
|
|
|
|
e.finishedResult = item.finishedResult |
|
|
|
|
e.finishedResult = item.finishedResult // 1:正确,2:错误 |
|
|
|
|
} else { |
|
|
|
|
e.score = 0 |
|
|
|
|
} |
|
|
|
|
score += e.score |
|
|
|
|
}) |
|
|
|
|
this.grade = util.handleZero(score) |
|
|
|
|
score += e.score // 计算总分 |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
this.grade = util.handleZero(score) // 前置加0 |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 实验面板显示隐藏 |
|
|
|
|
togglePannel() { |
|
|
|
|