|
|
@ -44,7 +44,7 @@ |
|
|
|
v-show="projectPermissions == 0" |
|
|
|
v-show="projectPermissions == 0" |
|
|
|
@click="reload" |
|
|
|
@click="reload" |
|
|
|
>重新开始</el-button> |
|
|
|
>重新开始</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> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-header> |
|
|
|
</el-header> |
|
|
@ -170,13 +170,14 @@ export default { |
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
pannelTab: 'first', // 面板信息切换值 |
|
|
|
pannelTab: 'first', // 面板信息切换值 |
|
|
|
isSelected: false // 是否选择过项目的标识,选择了会置为true |
|
|
|
isSelected: false, // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
|
|
|
statusTimer: null // 查询考核状态定时器 |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
this.getList() |
|
|
|
this.getAssList() |
|
|
|
}else{ // 练习 |
|
|
|
}else{ // 练习 |
|
|
|
// 获取项目列表 |
|
|
|
// 获取项目列表 |
|
|
|
this.getList().then(() => { |
|
|
|
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) { |
|
|
|
getCache(pId, jId) { |
|
|
|
const projectId = pId || this.projectId |
|
|
|
const projectId = pId || this.projectId |
|
|
@ -287,6 +318,19 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => {}) |
|
|
|
}).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(){ |
|
|
|
selectProject(){ |
|
|
|
this.isSelected = true |
|
|
|
this.isSelected = true |
|
|
@ -307,6 +351,7 @@ export default { |
|
|
|
this.isSubmit = false |
|
|
|
this.isSubmit = false |
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
const points = this.points |
|
|
|
const points = this.points |
|
|
|
|
|
|
|
// code和codeId,还有运行结果全部清空 |
|
|
|
points.map(e => { |
|
|
|
points.map(e => { |
|
|
|
e.code = '' |
|
|
|
e.code = '' |
|
|
|
e.codeId = '' |
|
|
|
e.codeId = '' |
|
|
@ -316,71 +361,76 @@ export default { |
|
|
|
this.$emit('recoveryCode') |
|
|
|
this.$emit('recoveryCode') |
|
|
|
this.startCount() |
|
|
|
this.startCount() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交询问 |
|
|
|
submit() { |
|
|
|
confirmSubmit() { |
|
|
|
const pointList = this.$parent.workbench |
|
|
|
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("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
confirmButtonText: "确定", |
|
|
|
confirmButtonText: "确定", |
|
|
|
cancelButtonText: "取消", |
|
|
|
cancelButtonText: "取消", |
|
|
|
type: "warning", |
|
|
|
type: "warning", |
|
|
|
center: true |
|
|
|
center: true |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
const date = new Date() |
|
|
|
this.submit() |
|
|
|
const entryTime = this.entryTime |
|
|
|
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
|
|
|
|
const projectId = this.projectId |
|
|
|
|
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
|
|
|
|
this.reloadCount() |
|
|
|
|
|
|
|
// 判分点参数 |
|
|
|
|
|
|
|
const attributesReqList = [] |
|
|
|
|
|
|
|
pointList.map(e => { |
|
|
|
|
|
|
|
attributesReqList.push({ |
|
|
|
|
|
|
|
codeId: e.codeId, |
|
|
|
|
|
|
|
bcId: e.judgmentId, |
|
|
|
|
|
|
|
isSubmit: e.codeId ? 1 : 0, |
|
|
|
|
|
|
|
answer: e.answer |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const data = { |
|
|
|
|
|
|
|
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), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间) |
|
|
|
|
|
|
|
endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
|
|
|
timeSum, |
|
|
|
|
|
|
|
projectId, |
|
|
|
|
|
|
|
projectName, |
|
|
|
|
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
|
|
|
|
totalScore: 100, // 判分点总分固定为100 |
|
|
|
|
|
|
|
systemId: 1, |
|
|
|
|
|
|
|
purpose: this.experimentTarget, // 实验目的 |
|
|
|
|
|
|
|
attributesReqList |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(this.api.submit, data).then(res => { |
|
|
|
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
|
|
|
this.isSubmit = true |
|
|
|
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
e.score = 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
score += e.score |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.grade = util.handleZero(score) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(err => {}) |
|
|
|
|
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 提交 |
|
|
|
|
|
|
|
submit() { |
|
|
|
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
|
|
|
|
const date = new Date() |
|
|
|
|
|
|
|
const entryTime = this.entryTime |
|
|
|
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
|
|
|
|
const projectId = this.projectId |
|
|
|
|
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
|
|
|
|
this.reloadCount() |
|
|
|
|
|
|
|
// 判分点参数 |
|
|
|
|
|
|
|
const attributesReqList = [] |
|
|
|
|
|
|
|
pointList.map(e => { |
|
|
|
|
|
|
|
attributesReqList.push({ |
|
|
|
|
|
|
|
codeId: e.codeId, |
|
|
|
|
|
|
|
bcId: e.judgmentId, |
|
|
|
|
|
|
|
isSubmit: e.codeId ? 1 : 0, |
|
|
|
|
|
|
|
answer: e.answer |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const data = { |
|
|
|
|
|
|
|
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), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间) |
|
|
|
|
|
|
|
endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
|
|
|
timeSum, |
|
|
|
|
|
|
|
projectId, |
|
|
|
|
|
|
|
projectName, |
|
|
|
|
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
|
|
|
|
totalScore: 100, // 判分点总分固定为100 |
|
|
|
|
|
|
|
systemId: 1, |
|
|
|
|
|
|
|
purpose: this.experimentTarget, // 实验目的 |
|
|
|
|
|
|
|
attributesReqList |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(this.api.submit, data).then(res => { |
|
|
|
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
|
|
|
this.isSubmit = true |
|
|
|
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
|
|
|
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 // 1:正确,2:错误 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
e.score = 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
score += e.score // 计算总分 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.grade = util.handleZero(score) // 前置加0 |
|
|
|
|
|
|
|
}).catch(err => {}) |
|
|
|
|
|
|
|
}, |
|
|
|
// 实验面板显示隐藏 |
|
|
|
// 实验面板显示隐藏 |
|
|
|
togglePannel() { |
|
|
|
togglePannel() { |
|
|
|
this.pannelVisible = !this.pannelVisible |
|
|
|
this.pannelVisible = !this.pannelVisible |
|
|
|