|
|
@ -23,7 +23,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="countDownBox"> |
|
|
|
<div class="countDownBox"> |
|
|
|
<div style="margin-left: -40px;"> |
|
|
|
<div style="margin-left: -40px;"> |
|
|
|
<div :autoStart="autoStart"> |
|
|
|
<div> |
|
|
|
实训{{text}}时间 |
|
|
|
实训{{text}}时间 |
|
|
|
<span class="timeSpan">{{day}}</span>天 |
|
|
|
<span class="timeSpan">{{day}}</span>天 |
|
|
|
<span class="timeSpan">{{hour}}</span>小时 |
|
|
|
<span class="timeSpan">{{hour}}</span>小时 |
|
|
@ -138,16 +138,15 @@ export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
classId: util.getCookie('classId'), |
|
|
|
classId: util.getCookie('classId'), |
|
|
|
className: util.getCookie("className"), |
|
|
|
className: util.getCookie('className') ? decodeURI(util.getCookie('className')) : '', |
|
|
|
courseId: util.getCookie("courseId"), |
|
|
|
courseId: util.getCookie('courseId'), |
|
|
|
projectId: util.getCookie("projectId"), |
|
|
|
projectId: util.getCookie('projectId') ? Number(util.getCookie('projectId')) : '', |
|
|
|
assessmentId: util.getCookie("assessmentId"), |
|
|
|
assessmentId: util.getCookie('assessmentId'), |
|
|
|
projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
isSubmit: false, // 是否提交的标识 |
|
|
|
isSubmit: false, // 是否提交的标识 |
|
|
|
entryTime: new Date(), |
|
|
|
entryTime: new Date(), |
|
|
|
startTime: util.getCookie("startTime") ? new Date(util.getCookie("startTime")).getTime() : '', |
|
|
|
startTime: util.getCookie('startTime'), |
|
|
|
endTime: util.getCookie("stopTime") ? new Date(util.getCookie("stopTime")).getTime() : '', |
|
|
|
endTime: util.getCookie('stopTime'), |
|
|
|
autoStart: true, |
|
|
|
|
|
|
|
pannelVisible: true, // 实验面板显示标识 |
|
|
|
pannelVisible: true, // 实验面板显示标识 |
|
|
|
grade: '00', // 得分 |
|
|
|
grade: '00', // 得分 |
|
|
|
text: '', // 倒计时前面的文字,练习:所用;考核:剩余。练习是计时,考核是倒计时 |
|
|
|
text: '', // 倒计时前面的文字,练习:所用;考核:剩余。练习是计时,考核是倒计时 |
|
|
@ -156,25 +155,23 @@ export default { |
|
|
|
seconds: 0, // 秒数 |
|
|
|
seconds: 0, // 秒数 |
|
|
|
minutes: 0, // 分钟数 |
|
|
|
minutes: 0, // 分钟数 |
|
|
|
hour: 0, // 小时数 |
|
|
|
hour: 0, // 小时数 |
|
|
|
createTime: '', // 开始时间 |
|
|
|
|
|
|
|
actEndTime: '', // 倒计时结束时间 |
|
|
|
|
|
|
|
projectList: [], // 项目列表 |
|
|
|
projectList: [], // 项目列表 |
|
|
|
experimentTarget: "", //实验目标 |
|
|
|
experimentTarget: '', //实验目标 |
|
|
|
experimentDescription: "", //案例描述 |
|
|
|
experimentDescription: '', //案例描述 |
|
|
|
experimentHint: "", //实验提示 |
|
|
|
experimentHint: '', //实验提示 |
|
|
|
hintOpen: 1, // 是否显示实验提示 |
|
|
|
hintOpen: 1, // 是否显示实验提示 |
|
|
|
points: [], // 判分点列表 |
|
|
|
points: [], // 判分点列表 |
|
|
|
judgmentId: '', // 当前判分点id |
|
|
|
judgmentId: '', // 当前判分点id |
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
pannelTab: "first", // 面板信息切换值 |
|
|
|
pannelTab: 'first', // 面板信息切换值 |
|
|
|
isSelected: false // 是否选择过项目的标识,选择了会置为true |
|
|
|
isSelected: false // 是否选择过项目的标识,选择了会置为true |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
this.getProDetail() |
|
|
|
this.getList() |
|
|
|
}else{ // 练习 |
|
|
|
}else{ // 练习 |
|
|
|
// 获取项目列表 |
|
|
|
// 获取项目列表 |
|
|
|
this.getList().then(() => { |
|
|
|
this.getList().then(() => { |
|
|
@ -201,7 +198,7 @@ export default { |
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
const list = res.projects |
|
|
|
const list = res.projects |
|
|
|
this.projectList = list |
|
|
|
this.projectList = list |
|
|
|
this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
if (!this.projectPermissions) this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
this.getProDetail().then(() => { |
|
|
|
this.getProDetail().then(() => { |
|
|
|
resolve() |
|
|
|
resolve() |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
@ -231,53 +228,12 @@ export default { |
|
|
|
this.experimentTarget = project.experimentTarget |
|
|
|
this.experimentTarget = project.experimentTarget |
|
|
|
this.experimentDescription = project.experimentDescription |
|
|
|
this.experimentDescription = project.experimentDescription |
|
|
|
this.experimentHint = project.experimentHint |
|
|
|
this.experimentHint = project.experimentHint |
|
|
|
// this.actEndTime = project[0].endTime |
|
|
|
|
|
|
|
this.hintOpen = !res.projectManage.hintOpen // 0显示,1不显示 |
|
|
|
this.hintOpen = !res.projectManage.hintOpen // 0显示,1不显示 |
|
|
|
this.$emit('tell', projectId, this.points) |
|
|
|
this.$emit('tell', projectId, this.points) |
|
|
|
if (this.projectPermissions == 1) { |
|
|
|
const isAss = this.projectPermissions == 1 // 是否是考核 |
|
|
|
this.text = "剩余" |
|
|
|
this.text = isAss ? '剩余' : '已用' |
|
|
|
var interval = setInterval(() => { |
|
|
|
this.countVal = isAss ? (new Date(this.endTime).getTime() - Date.now()) / 1000 : 0 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 |
|
|
|
// 获取当前时间,同时得到活动结束时间数组 |
|
|
|
|
|
|
|
let newTime = new Date().getTime(); |
|
|
|
|
|
|
|
// 对结束时间进行处理渲染到页面 |
|
|
|
|
|
|
|
let endTime = new Date(this.actEndTime).getTime(); |
|
|
|
|
|
|
|
let obj = null; // 如果活动未结束,对时间进行处理 |
|
|
|
|
|
|
|
if (endTime - newTime > 0) { |
|
|
|
|
|
|
|
let time = (endTime - newTime) / 1000; // 获取天、时、分、秒 |
|
|
|
|
|
|
|
let day = parseInt(time / (60 * 60 * 24)); |
|
|
|
|
|
|
|
let hou = parseInt((time % (60 * 60 * 24)) / 3600); |
|
|
|
|
|
|
|
let min = parseInt(((time % (60 * 60 * 24)) % 3600) / 60); |
|
|
|
|
|
|
|
let sec = parseInt(((time % (60 * 60 * 24)) % 3600) % 60); |
|
|
|
|
|
|
|
obj = { |
|
|
|
|
|
|
|
day: this.timeFormat(day), |
|
|
|
|
|
|
|
hou: this.timeFormat(hou), |
|
|
|
|
|
|
|
min: this.timeFormat(min), |
|
|
|
|
|
|
|
sec: this.timeFormat(sec) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 活动已结束,全部设置为'00' |
|
|
|
|
|
|
|
obj = { |
|
|
|
|
|
|
|
day: "00", |
|
|
|
|
|
|
|
hou: "00", |
|
|
|
|
|
|
|
min: "00", |
|
|
|
|
|
|
|
sec: "00" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.day = obj.day; |
|
|
|
|
|
|
|
this.hour = obj.hou; |
|
|
|
|
|
|
|
this.minutes = obj.min; |
|
|
|
|
|
|
|
this.seconds = obj.sec; |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.text = "已用"; |
|
|
|
|
|
|
|
// 获取当前时间 |
|
|
|
|
|
|
|
this.createTime = new Date().getTime() |
|
|
|
|
|
|
|
//自动开始 |
|
|
|
|
|
|
|
if (this.autoStart) { |
|
|
|
|
|
|
|
this.startCount() |
|
|
|
this.startCount() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
resolve() |
|
|
|
resolve() |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
reject() |
|
|
|
reject() |
|
|
@ -286,8 +242,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取上次缓存记录 |
|
|
|
// 获取上次缓存记录 |
|
|
|
getCache(pId, jId) { |
|
|
|
getCache(pId, jId) { |
|
|
|
const projectId = pId ? pId : this.projectId |
|
|
|
const projectId = pId || this.projectId |
|
|
|
const judgmentId = jId ? jId : this.judgmentId |
|
|
|
const judgmentId = jId || this.judgmentId |
|
|
|
this.$post(this.api.getLastCache, { |
|
|
|
this.$post(this.api.getLastCache, { |
|
|
|
bcId: judgmentId, // 如果传进来了判分点id,说明本地有缓存,则直接取本地缓存的判分点id,否则,取第一个项目的第一个判分点id |
|
|
|
bcId: judgmentId, // 如果传进来了判分点id,说明本地有缓存,则直接取本地缓存的判分点id,否则,取第一个项目的第一个判分点id |
|
|
|
projectId, // 项目id,同上 |
|
|
|
projectId, // 项目id,同上 |
|
|
@ -304,11 +260,21 @@ export default { |
|
|
|
localStorage.removeItem('codeCache') // 恢复代码后清除本地缓存 |
|
|
|
localStorage.removeItem('codeCache') // 恢复代码后清除本地缓存 |
|
|
|
this.projectId = projectId |
|
|
|
this.projectId = projectId |
|
|
|
this.judgmentId = judgmentId |
|
|
|
this.judgmentId = judgmentId |
|
|
|
|
|
|
|
// 如果是本地缓存里有项目id和判分点id,则要再次获取项目详情,取判分列表再次赋值;本地没有缓存则取只恢复第一个判分点的代码 |
|
|
|
|
|
|
|
if (pId) { |
|
|
|
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
|
|
|
const points = this.points |
|
|
|
|
|
|
|
const item = points.find(e => e.judgmentId === judgmentId) |
|
|
|
|
|
|
|
if (item) item.code = code |
|
|
|
|
|
|
|
this.$emit('tell', projectId, points) |
|
|
|
|
|
|
|
this.$emit('recoveryCode', points.findIndex(e => e.judgmentId === judgmentId) + '') |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
} else { |
|
|
|
const item = this.points.find(e => e.judgmentId === judgmentId) |
|
|
|
const item = this.points.find(e => e.judgmentId === judgmentId) |
|
|
|
if (item) item.code = code |
|
|
|
if (item) item.code = code |
|
|
|
// debugger |
|
|
|
|
|
|
|
this.$emit('tell', projectId, this.points) |
|
|
|
this.$emit('tell', projectId, this.points) |
|
|
|
this.$emit('recoveryCode', judgmentId + '') |
|
|
|
this.$emit('recoveryCode') |
|
|
|
|
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}).catch(() => { |
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
}) |
|
|
|
}) |
|
|
@ -323,7 +289,7 @@ export default { |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
this.isSubmit = false |
|
|
|
this.isSubmit = false |
|
|
|
this.countVal = 0 |
|
|
|
this.countVal = 0 |
|
|
|
this.grade = 0 |
|
|
|
this.grade = '00' |
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
this.$emit('recoveryCode') |
|
|
|
this.$emit('recoveryCode') |
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
@ -347,8 +313,6 @@ export default { |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
submit() { |
|
|
|
submit() { |
|
|
|
const pointList = this.$parent.workbench |
|
|
|
const pointList = this.$parent.workbench |
|
|
|
// debugger |
|
|
|
|
|
|
|
console.log(pointList) |
|
|
|
|
|
|
|
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: "确定", |
|
|
@ -359,11 +323,11 @@ export default { |
|
|
|
const date = new Date() |
|
|
|
const date = new Date() |
|
|
|
const entryTime = this.entryTime |
|
|
|
const entryTime = this.entryTime |
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
const endTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) // 结束时间 |
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
const projectId = this.projectId |
|
|
|
const projectId = this.projectId |
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
this.actEndTime = date |
|
|
|
|
|
|
|
this.reloadCount() |
|
|
|
this.reloadCount() |
|
|
|
|
|
|
|
// 判分点参数 |
|
|
|
const attributesReqList = [] |
|
|
|
const attributesReqList = [] |
|
|
|
pointList.map(e => { |
|
|
|
pointList.map(e => { |
|
|
|
e.codeId && attributesReqList.push({ |
|
|
|
e.codeId && attributesReqList.push({ |
|
|
@ -377,22 +341,22 @@ export default { |
|
|
|
classId: this.classId ? this.classId : '', |
|
|
|
classId: this.classId ? this.classId : '', |
|
|
|
className: this.className ? this.className : '', |
|
|
|
className: this.className ? this.className : '', |
|
|
|
curriculumId: this.courseId, |
|
|
|
curriculumId: this.courseId, |
|
|
|
startTime: util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), |
|
|
|
startTime: this.projectPermissions ? this.startTime : util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 开始时间(考核:直接从职站取考核的开始时间;练习:取页面进入的时间) |
|
|
|
endTime, |
|
|
|
endTime: this.projectPermissions ? this.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
submitTime: endTime, |
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
timeSum, |
|
|
|
timeSum, |
|
|
|
projectId, |
|
|
|
projectId, |
|
|
|
projectName, |
|
|
|
projectName, |
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
totalScore: 100, |
|
|
|
totalScore: 100, // 判分点总分固定为100 |
|
|
|
systemId: 1, |
|
|
|
systemId: 1, |
|
|
|
purpose: this.experimentTarget, |
|
|
|
purpose: this.experimentTarget, // 实验目的 |
|
|
|
attributesReqList |
|
|
|
attributesReqList |
|
|
|
} |
|
|
|
} |
|
|
|
this.$post(this.api.submit, data).then(res => { |
|
|
|
this.$post(this.api.submit, data).then(res => { |
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
this.isSubmit = true |
|
|
|
this.isSubmit = true |
|
|
|
newmain.$emit("isSubmit", this.isSubmit); |
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
let list = res.message |
|
|
|
let list = res.message |
|
|
|
let result = [] |
|
|
|
let result = [] |
|
|
|
let taskList = this.taskList |
|
|
|
let taskList = this.taskList |
|
|
@ -412,12 +376,7 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => {}) |
|
|
|
.catch(err => {}) |
|
|
|
}).catch(() => { |
|
|
|
}).catch(() => {}) |
|
|
|
this.$message({ |
|
|
|
|
|
|
|
type: "info", |
|
|
|
|
|
|
|
message: "已取消提交" |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 实验面板显示隐藏 |
|
|
|
// 实验面板显示隐藏 |
|
|
|
togglePannel() { |
|
|
|
togglePannel() { |
|
|
@ -436,29 +395,29 @@ export default { |
|
|
|
this.minutes = '00' |
|
|
|
this.minutes = '00' |
|
|
|
this.hour = '00' |
|
|
|
this.hour = '00' |
|
|
|
}, |
|
|
|
}, |
|
|
|
counterFn(counterTime) { |
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
|
|
|
|
counter(counterTime) { |
|
|
|
let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数 |
|
|
|
let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数 |
|
|
|
let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数 |
|
|
|
let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数 |
|
|
|
let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数 |
|
|
|
let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数 |
|
|
|
let day = Math.floor(counterTime / (24 * 3600 * 1)); //计算相差天数 |
|
|
|
let day = Math.floor(counterTime / (24 * 3600 * 1)) //计算相差天数 |
|
|
|
let hour = Math.floor(leave1 / (3600 * 1)); //计算相差小时 |
|
|
|
let hour = Math.floor(leave1 / (3600 * 1)) //计算相差小时 |
|
|
|
let minutes = Math.floor(leave2 / (60 * 1)); //计算相差分钟 |
|
|
|
let minutes = Math.floor(leave2 / (60 * 1)) //计算相差分钟 |
|
|
|
let seconds = Math.round(leave3 / 1); //计算相差秒 |
|
|
|
let seconds = Math.round(leave3 / 1) //计算相差秒 |
|
|
|
day = day >= 10 ? day : "0" + day; |
|
|
|
day = day >= 10 ? day : "0" + day |
|
|
|
hour = hour >= 10 ? hour : "0" + hour; |
|
|
|
hour = hour >= 10 ? hour : "0" + hour |
|
|
|
minutes = minutes >= 10 ? minutes : "0" + minutes; |
|
|
|
minutes = minutes >= 10 ? minutes : "0" + minutes |
|
|
|
seconds = seconds >= 10 ? seconds : "0" + seconds; |
|
|
|
seconds = seconds >= 10 ? seconds : "0" + seconds |
|
|
|
this.day = day; |
|
|
|
this.day = day |
|
|
|
this.hour = hour; |
|
|
|
this.hour = hour |
|
|
|
this.minutes = minutes; |
|
|
|
this.minutes = minutes |
|
|
|
this.seconds = seconds; |
|
|
|
this.seconds = seconds |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 倒计时 |
|
|
|
// 启动倒计时 |
|
|
|
startCount() { |
|
|
|
startCount() { |
|
|
|
clearInterval(this.counterTimer) |
|
|
|
clearInterval(this.counterTimer) |
|
|
|
this.countVal = this.countVal ? this.countVal : 0 |
|
|
|
|
|
|
|
this.counterTimer = setInterval(() => { |
|
|
|
this.counterTimer = setInterval(() => { |
|
|
|
this.counterFn(this.countVal++) |
|
|
|
this.counter(this.projectPermissions ? this.countVal-- : this.countVal++) |
|
|
|
}, 1000) |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|