|
|
|
@ -6,7 +6,7 @@ |
|
|
|
|
<div class="flex" style="width: 28%"> |
|
|
|
|
<p>实训项目</p> |
|
|
|
|
<el-select |
|
|
|
|
v-model="value1" |
|
|
|
|
v-model="projectId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
class="select" |
|
|
|
|
:disabled="projectPermissions != 0" |
|
|
|
@ -14,7 +14,7 @@ |
|
|
|
|
style="flex: 1" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in value" |
|
|
|
|
v-for="item in projectList" |
|
|
|
|
:key="item.projectId" |
|
|
|
|
:label="item.projectName" |
|
|
|
|
:value="item.projectId" |
|
|
|
@ -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="Submit" :disabled="isSubmit">提交</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-header> |
|
|
|
@ -96,7 +96,7 @@ |
|
|
|
|
</div> |
|
|
|
|
</el-aside> |
|
|
|
|
<el-main> |
|
|
|
|
<el-tabs v-model="activeName" type="card"> |
|
|
|
|
<el-tabs v-model="pannelTab" type="card"> |
|
|
|
|
<el-tab-pane label="案例" name="first"> |
|
|
|
|
<div class="break-all" v-html="experimentDescription"></div> |
|
|
|
|
</el-tab-pane> |
|
|
|
@ -105,13 +105,13 @@ |
|
|
|
|
<el-collapse-item v-for="(loop, index) in points" :key="index"> |
|
|
|
|
<template slot="title"> |
|
|
|
|
<i class="el-icon-s-ticket"></i> |
|
|
|
|
<span style="font-size:16px">{{loop.experimentalRequirements}}</span> |
|
|
|
|
</template> |
|
|
|
|
<div class="break-all" v-html="loop.experimentalRequirements"></div> |
|
|
|
|
</template> |
|
|
|
|
<div class="break-all" v-html="loop.expserimentalRequirements"></div> |
|
|
|
|
</el-collapse-item> |
|
|
|
|
</el-collapse> |
|
|
|
|
</el-tab-pane> |
|
|
|
|
<el-tab-pane label="实验提示" name="fifth" v-if="isstartexperimentSuggests"> |
|
|
|
|
<el-tab-pane label="实验提示" name="fifth" v-if="hintOpen"> |
|
|
|
|
<div class="break-all" v-html="experimentHint"></div> |
|
|
|
|
</el-tab-pane> |
|
|
|
|
</el-tabs> |
|
|
|
@ -139,15 +139,23 @@ import util from '@/util' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
userId: util.getCookie("userId"), |
|
|
|
|
studentId: util.getCookie("studentId"), |
|
|
|
|
courseId: util.getCookie("courseId"), |
|
|
|
|
projectId: util.getCookie("projectId"), |
|
|
|
|
assessmentId: util.getCookie("assessmentId"), |
|
|
|
|
projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
|
isSubmit: false, |
|
|
|
|
entryTime: util.formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
|
startTime: util.getCookie("startTime") ? new Date(util.getCookie("startTime")).getTime() : '', |
|
|
|
|
stopTime: util.getCookie("stopTime") ? new Date(util.getCookie("stopTime")).getTime() : '', |
|
|
|
|
test: [], |
|
|
|
|
ishow: true, |
|
|
|
|
grade: "00", |
|
|
|
|
exampleData: "", |
|
|
|
|
codeid: "", |
|
|
|
|
codeIds: [], |
|
|
|
|
judgmentPointsIds: [], |
|
|
|
|
text: "", |
|
|
|
|
isStart: false, |
|
|
|
|
isStart: false, // 是否开启倒计时的标识 |
|
|
|
|
globalTimer: null, //获取setInterval对象值 |
|
|
|
|
millisecond: 0, |
|
|
|
|
countVal: this.defaultVal, //获取初始值 |
|
|
|
@ -156,10 +164,9 @@ export default { |
|
|
|
|
seconds: 0, |
|
|
|
|
minutes: 0, |
|
|
|
|
hour: 0, |
|
|
|
|
createTime: "", //开始时间 |
|
|
|
|
actEndTime: "", //倒计时结束时间 |
|
|
|
|
value1: "", //选中后绑定的对象 |
|
|
|
|
value: [], |
|
|
|
|
createTime: '', // 开始时间 |
|
|
|
|
actEndTime: '', // 倒计时结束时间 |
|
|
|
|
projectList: [], |
|
|
|
|
experimentTarget: "", //实验目标 |
|
|
|
|
experimentDescription: "", //案例描述 |
|
|
|
|
experimentHint: "", //实验提示 |
|
|
|
@ -167,21 +174,9 @@ export default { |
|
|
|
|
points: [], |
|
|
|
|
activeNames: [], |
|
|
|
|
tableData: [], |
|
|
|
|
activeName: "first", |
|
|
|
|
studentId: "", |
|
|
|
|
courseId: "", |
|
|
|
|
projectId: "", |
|
|
|
|
assessmentId: "", |
|
|
|
|
projectPermissions: 0, //项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
|
isSubmit: false, |
|
|
|
|
entryTime: util.formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
|
startTime: '', |
|
|
|
|
stopTime: '', |
|
|
|
|
isSelected: false, |
|
|
|
|
userId: '', |
|
|
|
|
workbenchCus: this.workbench, |
|
|
|
|
isRecovery: false, |
|
|
|
|
isstartexperimentSuggests: 1 |
|
|
|
|
pannelTab: "first", |
|
|
|
|
isSelected: false, // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
hintOpen: 1 // 是否显示实验提示 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -240,51 +235,23 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.assessmentId = util.getCookie("assessmentId"); |
|
|
|
|
this.userId = util.getCookie("userId"); |
|
|
|
|
this.studentId = util.getCookie("studentId"); |
|
|
|
|
this.projectId = util.getCookie("projectId"); |
|
|
|
|
this.courseId = util.getCookie("courseId"); |
|
|
|
|
this.startTime = util.getCookie("startTime") ? new Date(util.getCookie("startTime")).getTime() : '' |
|
|
|
|
this.stopTime = util.getCookie("stopTime") ? new Date(util.getCookie("stopTime")).getTime() : '' |
|
|
|
|
|
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 |
|
|
|
|
if(this.projectId){ |
|
|
|
|
this.getQueryProject(); |
|
|
|
|
}else{ |
|
|
|
|
console.log(33) |
|
|
|
|
this.getProjects(); |
|
|
|
|
let codeCache = localStorage.getItem('codeCache') |
|
|
|
|
if(codeCache){ |
|
|
|
|
codeCache = JSON.parse(codeCache) |
|
|
|
|
// if(codeCache.systemId && codeCache.systemId == this.$config.systemId){ |
|
|
|
|
// this.$confirm('是否要继续上次的实验?', '提示', { |
|
|
|
|
// confirmButtonText: '是', |
|
|
|
|
// cancelButtonText: '否', |
|
|
|
|
// type: 'success' |
|
|
|
|
// }).then(() => { |
|
|
|
|
// this.value1 = codeCache.projectId |
|
|
|
|
// this.workbenchCus = codeCache.workbench |
|
|
|
|
// this.isRecovery = true |
|
|
|
|
// this.selectProject() |
|
|
|
|
// let codeIds = [] |
|
|
|
|
// codeCache.workbench.map(n => codeIds.push(n.code.codeId)) |
|
|
|
|
// codeIds = codeIds.filter(n => n) |
|
|
|
|
// this.codeIds = codeIds |
|
|
|
|
// this.$emit('recoveryCode',codeCache.workbench1) |
|
|
|
|
// }).catch(() => { |
|
|
|
|
// localStorage.removeItem('codeCache') |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
|
this.getProDetail() |
|
|
|
|
}else{ // 练习 |
|
|
|
|
// 获取项目列表 |
|
|
|
|
this.getList().then(() => { |
|
|
|
|
let cache = localStorage.getItem('codeCache') |
|
|
|
|
if(cache){ |
|
|
|
|
cache = JSON.parse(cache) |
|
|
|
|
this.getCache(cache.projectId, cache.judgmentId) |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.assessmentId && this.projectId && this.checkVer() |
|
|
|
|
this.codeId && this.codeIds.push(this.codeId) |
|
|
|
|
//兄弟组件传值 |
|
|
|
|
newmain.$on("codeid", val => { |
|
|
|
|
this.codeid = val; |
|
|
|
|
let codeId = this.codeid; |
|
|
|
|
this.codeIds.push(codeId); |
|
|
|
|
}); |
|
|
|
|
// 更改tableData |
|
|
|
|
newmain.$on("updateJud", item => { |
|
|
|
@ -296,32 +263,44 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
checkVer() { |
|
|
|
|
let data = { |
|
|
|
|
userId: this.userId, |
|
|
|
|
id: this.assessmentId |
|
|
|
|
} |
|
|
|
|
this.$get(this.api.qualifications,data).then(res => { |
|
|
|
|
if(res.message == 'false'){ |
|
|
|
|
this.isSubmit = true; |
|
|
|
|
newmain.$emit("isSubmit", this.isSubmit); |
|
|
|
|
// 获取上次缓存记录 |
|
|
|
|
getCache(projectId, judgmentId) { |
|
|
|
|
this.$post(this.api.getLastCache, { |
|
|
|
|
bcId: judgmentId ? judgmentId : this.judgmentId, |
|
|
|
|
cid: this.courseId, |
|
|
|
|
projectId: projectId ? projectId : this.projectId |
|
|
|
|
}).then(res => { |
|
|
|
|
const code = res.getLastCache |
|
|
|
|
if (code) { |
|
|
|
|
this.$confirm('是否要继续上次的实验?', '提示', { |
|
|
|
|
confirmButtonText: '是', |
|
|
|
|
cancelButtonText: '否', |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.projectId = projectId |
|
|
|
|
this.judgmentId = judgmentId |
|
|
|
|
this.points[0].code = code |
|
|
|
|
this.$emit("tell", this.projectId, this.projectPermissions, this.points) |
|
|
|
|
// this.$emit('recoveryCode', cache.curTab) |
|
|
|
|
}).catch(() => { |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
//重新开始 |
|
|
|
|
reload() { |
|
|
|
|
this.$post(this.api.DeleteCodes, this.codeIds).then(res => { |
|
|
|
|
this.$post(this.api.DeleteCodes).then(res => { |
|
|
|
|
this.getClearTime() |
|
|
|
|
this.grade = '00' |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.codeIds = [] |
|
|
|
|
this.isSubmit = false |
|
|
|
|
newmain.$emit("isSubmit", this.isSubmit) |
|
|
|
|
let workbench = this.workbench |
|
|
|
|
workbench.map(n => { |
|
|
|
|
n.code = { |
|
|
|
|
code: '', |
|
|
|
|
codeId: '' |
|
|
|
|
code: '' |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.$emit('recoveryCode',workbench) |
|
|
|
@ -334,29 +313,24 @@ export default { |
|
|
|
|
this.startCountFn() |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
Submit() { |
|
|
|
|
if(!this.codeIds.length) return this.$message.error('请先完成实验') |
|
|
|
|
// if(!this.codeIds.length) return this.$message.error('请先完成实验') |
|
|
|
|
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
center: true |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
}).then(() => { |
|
|
|
|
this.actEndTime = new Date().getTime(); |
|
|
|
|
this.getClearTime(); |
|
|
|
|
//提交代码与判分点进行判断 |
|
|
|
|
this.$post(this.api.Submit, { |
|
|
|
|
// projectPermissions: 0, |
|
|
|
|
createTime: this.startTime, |
|
|
|
|
endTime: this.stopTime, |
|
|
|
|
projectId: this.projectId, |
|
|
|
|
projectPermissions: this.projectPermissions, |
|
|
|
|
// assessmentId: 1, |
|
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
|
codeIds: this.codeIds, |
|
|
|
|
judgmentPointsIds: this.judgmentPointsIds, |
|
|
|
|
// studentId: 54, |
|
|
|
|
studentId: this.studentId, |
|
|
|
|
record: { |
|
|
|
|
courseId: 1, |
|
|
|
@ -394,20 +368,17 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "info", |
|
|
|
|
message: "已取消提交" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 倒计时 |
|
|
|
|
timeFormat(param) { |
|
|
|
|
return param < 10 ? "0" + param : param; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//控制面板 |
|
|
|
|
step() { |
|
|
|
|
$(".m_step").toggleClass("n_step"); |
|
|
|
@ -428,45 +399,26 @@ export default { |
|
|
|
|
// this.text = '所用' |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleData(project,type){ |
|
|
|
|
if(!this.isSelected){ |
|
|
|
|
this.value = project; |
|
|
|
|
this.value1 = project[0].projectId; |
|
|
|
|
} |
|
|
|
|
this.projectId = type == 2 ? project[0].projectId : this.projectId |
|
|
|
|
if(type == 2) this.getQueryProject(0,1) |
|
|
|
|
this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions |
|
|
|
|
this.experimentTarget = project[0].experimentTarget; |
|
|
|
|
this.experimentDescription = project[0].experimentDescription; |
|
|
|
|
this.experimentHint = project[0].experimentHint; |
|
|
|
|
this.actEndTime = project[0].endTime; |
|
|
|
|
this.isRecovery = false |
|
|
|
|
}, |
|
|
|
|
getQueryProject(projectId,type) { |
|
|
|
|
//项目名称+实验目标+案例描述+实验提示+实验要求 |
|
|
|
|
// 获取项目详情 |
|
|
|
|
getProDetail() { |
|
|
|
|
const projectId = this.projectId |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.$get(this.api.QueryProject, { |
|
|
|
|
projectId: projectId ? projectId : this.projectId |
|
|
|
|
projectId |
|
|
|
|
}).then(res => { |
|
|
|
|
const points = res.projectJudgmentVos |
|
|
|
|
const project = res.projectManage |
|
|
|
|
points.map(e => { |
|
|
|
|
e.code = '' |
|
|
|
|
}) |
|
|
|
|
.then(res => { |
|
|
|
|
if(!type){ |
|
|
|
|
this.handleData(res.projectManage,1) |
|
|
|
|
this.projectId = res.projectManage[0].projectId |
|
|
|
|
} |
|
|
|
|
// debugger |
|
|
|
|
this.points = res.projectJudgmentVos; |
|
|
|
|
this.$emit("tell", this.value1, this.projectPermissions, this.points); |
|
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
|
if (this.points.length) { |
|
|
|
|
this.$parent.workbench1 = '0'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.tableData = res.message.projectJudgmentVos; |
|
|
|
|
let arr1 = this.tableData; |
|
|
|
|
let result1 = arr1.map(e => e.judgmentPointsId); |
|
|
|
|
this.judgmentPointsIds = this.judgmentPointsIds.concat(result1) |
|
|
|
|
this.isstartexperimentSuggests = !res.message.project[0].isstartexperimentSuggests //0显示,1不显示 |
|
|
|
|
|
|
|
|
|
this.points = points |
|
|
|
|
this.judgmentId = points[0].judgmentId |
|
|
|
|
this.experimentTarget = project.experimentTarget |
|
|
|
|
this.experimentDescription = project.experimentDescription |
|
|
|
|
this.experimentHint = project.experimentHint |
|
|
|
|
// this.actEndTime = project[0].endTime |
|
|
|
|
this.hintOpen = !res.projectManage.hintOpen // 0显示,1不显示 |
|
|
|
|
this.$emit("tell", projectId, this.projectPermissions, this.points) |
|
|
|
|
if (this.projectPermissions == "1") { |
|
|
|
|
this.text = "剩余"; |
|
|
|
|
var interval = setInterval(() => { |
|
|
|
@ -511,25 +463,41 @@ export default { |
|
|
|
|
this.startCountFn(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
resolve() |
|
|
|
|
}).catch(err => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}); |
|
|
|
|
}, |
|
|
|
|
getProjects(){ |
|
|
|
|
// 获取项目列表 |
|
|
|
|
getList(){ |
|
|
|
|
let data = { |
|
|
|
|
systemId: 1, |
|
|
|
|
cId: this.courseId, |
|
|
|
|
cId: this.courseId, // 课程id |
|
|
|
|
permissions: this.projectPermissions |
|
|
|
|
} |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
|
this.handleData(res.projects,2) |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
const list = res.projects |
|
|
|
|
this.projectList = list |
|
|
|
|
this.projectId = list ? list[0].projectId : 0 |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 项目选择回调 |
|
|
|
|
selectProject(){ |
|
|
|
|
this.isSelected = true |
|
|
|
|
this.assessmentId = '' |
|
|
|
|
this.judgmentPointsIds = [] |
|
|
|
|
this.codeIds = [] |
|
|
|
|
this.getQueryProject(this.value1) |
|
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
|
this.$parent.workbench1 = '0' |
|
|
|
|
this.getProDetail() |
|
|
|
|
this.isSubmit = false |
|
|
|
|
this.countVal = 0 |
|
|
|
|
this.grade = 0 |
|
|
|
@ -552,9 +520,9 @@ export default { |
|
|
|
|
this.minutes = minutes; |
|
|
|
|
this.seconds = seconds; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 倒计时 |
|
|
|
|
startCountFn() { |
|
|
|
|
if (!this.isStart) { |
|
|
|
|
if (!this.isStart) { // 未开始倒计时 |
|
|
|
|
this.countVal = this.countVal ? this.countVal : 0; |
|
|
|
|
let timer = setInterval(() => { |
|
|
|
|
this.counterFn(this.countVal++); |
|
|
|
|