|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-container class="scrollbar" v-if="ishow"> |
|
|
|
|
<el-container class="scrollbar" v-if="pannelVisible"> |
|
|
|
|
<el-header> |
|
|
|
|
<div class="flex between"> |
|
|
|
|
<div class="flex" style="width: 28%"> |
|
|
|
@ -23,7 +23,7 @@ |
|
|
|
|
</div> |
|
|
|
|
<div class="countDownBox"> |
|
|
|
|
<div style="margin-left: -40px;"> |
|
|
|
|
<div :sendSync="sendSync" :autoStart="autoStart" :defaultVal="defaultVal"> |
|
|
|
|
<div :autoStart="autoStart"> |
|
|
|
|
实训{{text}}时间 |
|
|
|
|
<span class="timeSpan">{{day}}</span>天 |
|
|
|
|
<span class="timeSpan">{{hour}}</span>小时 |
|
|
|
@ -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> |
|
|
|
@ -70,9 +70,9 @@ |
|
|
|
|
<el-row> |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-card shadow="hover"> |
|
|
|
|
<el-table :data="tableData" :stripe="true" height="405"> |
|
|
|
|
<el-table :data="taskList" :stripe="true" height="405"> |
|
|
|
|
<el-table-column type="index"></el-table-column> |
|
|
|
|
<el-table-column prop="judgmentPointsName" label="判分标准" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="name" label="判分标准" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="right" label="完成结果" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<i |
|
|
|
@ -87,7 +87,7 @@ |
|
|
|
|
></i> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="score" label="得分" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="score1" label="得分" align="center"></el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</el-card> |
|
|
|
|
</el-col> |
|
|
|
@ -101,7 +101,7 @@ |
|
|
|
|
<div class="break-all" v-html="experimentDescription"></div> |
|
|
|
|
</el-tab-pane> |
|
|
|
|
<el-tab-pane label="实验要求" name="second"> |
|
|
|
|
<el-collapse v-model="activeNames"> |
|
|
|
|
<el-collapse v-model="curReq"> |
|
|
|
|
<el-collapse-item v-for="(loop, index) in points" :key="index"> |
|
|
|
|
<template slot="title"> |
|
|
|
|
<i class="el-icon-s-ticket"></i> |
|
|
|
@ -121,11 +121,11 @@ |
|
|
|
|
<!-- </div> --> |
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
:style="ishow ? {position: 'fixed', left: '85%',top:'50%'} : {position: 'fixed',top:'50%'}" |
|
|
|
|
:style="pannelVisible ? {position: 'fixed', left: '85%',top:'50%'} : {position: 'fixed',top:'50%'}" |
|
|
|
|
> |
|
|
|
|
<div @click="step()"> |
|
|
|
|
<img src="../assets/img/left.png" alt class="m_step" v-if="ishow" /> |
|
|
|
|
<img src="../assets/img/right.png" alt class="n_step" v-if="!ishow" /> |
|
|
|
|
<div @click="togglePannel"> |
|
|
|
|
<img src="../assets/img/left.png" alt class="left-btn" v-if="pannelVisible" /> |
|
|
|
|
<img src="../assets/img/right.png" alt class="right-btn" v-if="!pannelVisible" /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -133,107 +133,44 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import newmain from "../util/newMain"; |
|
|
|
|
import * as $ from "jquery"; |
|
|
|
|
import { get } from "http"; |
|
|
|
|
import util from '@/util' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
userId: util.getCookie("userId"), |
|
|
|
|
studentId: util.getCookie("studentId"), |
|
|
|
|
classId: util.getCookie('classId'), |
|
|
|
|
className: util.getCookie("className"), |
|
|
|
|
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'), |
|
|
|
|
isSubmit: false, // 是否提交的标识 |
|
|
|
|
entryTime: new Date(), |
|
|
|
|
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: "", |
|
|
|
|
text: "", |
|
|
|
|
isStart: false, // 是否开启倒计时的标识 |
|
|
|
|
globalTimer: null, //获取setInterval对象值 |
|
|
|
|
millisecond: 0, |
|
|
|
|
countVal: this.defaultVal, //获取初始值 |
|
|
|
|
pauseTime: 0, |
|
|
|
|
day: 0, |
|
|
|
|
seconds: 0, |
|
|
|
|
minutes: 0, |
|
|
|
|
hour: 0, |
|
|
|
|
endTime: util.getCookie("stopTime") ? new Date(util.getCookie("stopTime")).getTime() : '', |
|
|
|
|
autoStart: true, |
|
|
|
|
pannelVisible: true, // 实验面板显示标识 |
|
|
|
|
grade: '00', // 得分 |
|
|
|
|
text: '', // 倒计时前面的文字,练习:所用;考核:剩余。练习是计时,考核是倒计时 |
|
|
|
|
counterTimer: null, // 获取setInterval对象值 |
|
|
|
|
day: 0, // 天数 |
|
|
|
|
seconds: 0, // 秒数 |
|
|
|
|
minutes: 0, // 分钟数 |
|
|
|
|
hour: 0, // 小时数 |
|
|
|
|
createTime: '', // 开始时间 |
|
|
|
|
actEndTime: '', // 倒计时结束时间 |
|
|
|
|
projectList: [], |
|
|
|
|
projectList: [], // 项目列表 |
|
|
|
|
experimentTarget: "", //实验目标 |
|
|
|
|
experimentDescription: "", //案例描述 |
|
|
|
|
experimentHint: "", //实验提示 |
|
|
|
|
judgmentPointsName: "", // 判分点名称 |
|
|
|
|
points: [], |
|
|
|
|
activeNames: [], |
|
|
|
|
tableData: [], |
|
|
|
|
pannelTab: "first", |
|
|
|
|
isSelected: false, // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
hintOpen: 1 // 是否显示实验提示 |
|
|
|
|
hintOpen: 1, // 是否显示实验提示 |
|
|
|
|
points: [], // 判分点列表 |
|
|
|
|
judgmentId: '', // 当前判分点id |
|
|
|
|
curReq: [], // 当前实验要求 |
|
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
|
pannelTab: "first", // 面板信息切换值 |
|
|
|
|
isSelected: false // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
countVal: { |
|
|
|
|
deep: true, |
|
|
|
|
handler: function(val, oldVal) { |
|
|
|
|
let vm = this; |
|
|
|
|
// console.log(11,vm) |
|
|
|
|
if (vm.needSendSunc) { |
|
|
|
|
vm.passToParent(val); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
needSendSunc: { |
|
|
|
|
deep: true, |
|
|
|
|
handler: function(val) { |
|
|
|
|
let vm = this; |
|
|
|
|
if (val) { |
|
|
|
|
vm.passToParent(vm.countString); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
sendSync: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false |
|
|
|
|
}, |
|
|
|
|
autoStart: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false |
|
|
|
|
}, |
|
|
|
|
defaultVal: { |
|
|
|
|
type: Number, |
|
|
|
|
default: null |
|
|
|
|
}, |
|
|
|
|
codeId: { |
|
|
|
|
type: Number, |
|
|
|
|
default: 0 |
|
|
|
|
}, |
|
|
|
|
workbench: { |
|
|
|
|
type: Array, |
|
|
|
|
default: [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
needSendSunc: function() { |
|
|
|
|
return this.sendSync; |
|
|
|
|
}, |
|
|
|
|
// 倒计时 |
|
|
|
|
second: function() { |
|
|
|
|
return this.num(this.seconds); |
|
|
|
|
}, |
|
|
|
|
minute: function() { |
|
|
|
|
return this.num(this.minutes); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 |
|
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
@ -241,163 +178,39 @@ export default { |
|
|
|
|
}else{ // 练习 |
|
|
|
|
// 获取项目列表 |
|
|
|
|
this.getList().then(() => { |
|
|
|
|
let cache = localStorage.getItem('codeCache') |
|
|
|
|
let cache = localStorage.getItem('codeCache') // 获取本地缓存 |
|
|
|
|
// 如果有缓存,再调接口取上次运行的代码 |
|
|
|
|
if (cache) { |
|
|
|
|
cache = JSON.parse(cache) |
|
|
|
|
this.getCache(cache.projectId, cache.judgmentId) |
|
|
|
|
} else { |
|
|
|
|
this.getCache() |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
//兄弟组件传值 |
|
|
|
|
newmain.$on("codeid", val => { |
|
|
|
|
this.codeid = val; |
|
|
|
|
let codeId = this.codeid; |
|
|
|
|
}); |
|
|
|
|
// 更改tableData |
|
|
|
|
newmain.$on("updateJud", item => { |
|
|
|
|
let list = this.tableData |
|
|
|
|
list.map(n => { |
|
|
|
|
if(n.judgmentPointsId == item.id) n.isError = item.isError |
|
|
|
|
}) |
|
|
|
|
this.tableData = list |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取上次缓存记录 |
|
|
|
|
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).then(res => { |
|
|
|
|
this.getClearTime() |
|
|
|
|
this.grade = '00' |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.isSubmit = false |
|
|
|
|
newmain.$emit("isSubmit", this.isSubmit) |
|
|
|
|
let workbench = this.workbench |
|
|
|
|
workbench.map(n => { |
|
|
|
|
n.code = { |
|
|
|
|
code: '' |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.$emit('recoveryCode',workbench) |
|
|
|
|
let tableData = this.tableData |
|
|
|
|
tableData.map(n => { |
|
|
|
|
delete n.score |
|
|
|
|
delete n.right |
|
|
|
|
}) |
|
|
|
|
this.tableData = JSON.parse(JSON.stringify(tableData)) |
|
|
|
|
this.startCountFn() |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
Submit() { |
|
|
|
|
// if(!this.codeIds.length) return this.$message.error('请先完成实验') |
|
|
|
|
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
center: true |
|
|
|
|
}).then(() => { |
|
|
|
|
this.actEndTime = new Date().getTime(); |
|
|
|
|
this.getClearTime(); |
|
|
|
|
//提交代码与判分点进行判断 |
|
|
|
|
this.$post(this.api.Submit, { |
|
|
|
|
createTime: this.startTime, |
|
|
|
|
endTime: this.stopTime, |
|
|
|
|
projectId: this.projectId, |
|
|
|
|
projectPermissions: this.projectPermissions, |
|
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
|
studentId: this.studentId, |
|
|
|
|
record: { |
|
|
|
|
courseId: 1, |
|
|
|
|
// courseId: this.courseId, |
|
|
|
|
projectId: this.projectId, |
|
|
|
|
createTime: this.startTime, |
|
|
|
|
endTime: this.stopTime, |
|
|
|
|
startTime: this.entryTime |
|
|
|
|
// 获取项目列表 |
|
|
|
|
getList(){ |
|
|
|
|
let data = { |
|
|
|
|
systemId: 1, |
|
|
|
|
cId: this.courseId, // 课程id |
|
|
|
|
permissions: this.projectPermissions // 练习/考核 |
|
|
|
|
} |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
|
const list = res.projects |
|
|
|
|
this.projectList = list |
|
|
|
|
this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
.then(res => { |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.isSubmit = true |
|
|
|
|
newmain.$emit("isSubmit", this.isSubmit); |
|
|
|
|
let list = res.message |
|
|
|
|
let workbench = this.workbenchCus.length ? this.workbenchCus : this.workbench |
|
|
|
|
let result = [] |
|
|
|
|
workbench.map(n => { |
|
|
|
|
result.push(list.find(e => e.judgmentPointsId == n.judgmentPointsId)) |
|
|
|
|
}) |
|
|
|
|
let tableData = this.tableData |
|
|
|
|
result.map(n => { |
|
|
|
|
if(tableData.find(e => e.judgmentPointsId == n.judgmentPointsId).isError){ |
|
|
|
|
n.score = 0 |
|
|
|
|
n.right = -1 |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
this.tableData = result |
|
|
|
|
//计算总分 |
|
|
|
|
var s = 0; |
|
|
|
|
this.tableData.forEach(element => { |
|
|
|
|
this.test = element.score; |
|
|
|
|
s += this.test; |
|
|
|
|
this.grade = s; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "info", |
|
|
|
|
message: "已取消提交" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 倒计时 |
|
|
|
|
timeFormat(param) { |
|
|
|
|
return param < 10 ? "0" + param : param; |
|
|
|
|
}, |
|
|
|
|
//控制面板 |
|
|
|
|
step() { |
|
|
|
|
$(".m_step").toggleClass("n_step"); |
|
|
|
|
this.ishow = !this.ishow; |
|
|
|
|
}, |
|
|
|
|
// 清除时间 |
|
|
|
|
getClearTime() { |
|
|
|
|
// clearInterval(this.globalTimer); |
|
|
|
|
clearInterval(this.countVal); |
|
|
|
|
this.globalTimer = ""; |
|
|
|
|
// if(this.projectPermissions != 0){ |
|
|
|
|
this.countVal = ""; |
|
|
|
|
this.day = "00"; |
|
|
|
|
this.seconds = "00"; |
|
|
|
|
this.minutes = "00"; |
|
|
|
|
this.hour = "00"; |
|
|
|
|
// }else{ |
|
|
|
|
// this.text = '所用' |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
// 获取项目详情 |
|
|
|
|
getProDetail() { |
|
|
|
@ -409,18 +222,20 @@ export default { |
|
|
|
|
const points = res.projectJudgmentVos |
|
|
|
|
const project = res.projectManage |
|
|
|
|
points.map(e => { |
|
|
|
|
e.code = '' |
|
|
|
|
e.code = '' // 后端返回的字段没有code,要手动加上以存储运行的代码 |
|
|
|
|
e.codeId = '' // 代码通过接口传给后端运行后,接口会返回一个codeId,提交的时候需要传这个codeId |
|
|
|
|
}) |
|
|
|
|
this.points = points |
|
|
|
|
this.judgmentId = points[0].judgmentId |
|
|
|
|
this.taskList = 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 = "剩余"; |
|
|
|
|
if (this.projectPermissions == 1) { |
|
|
|
|
this.text = "剩余" |
|
|
|
|
var interval = setInterval(() => { |
|
|
|
|
// 获取当前时间,同时得到活动结束时间数组 |
|
|
|
|
let newTime = new Date().getTime(); |
|
|
|
@ -454,13 +269,13 @@ export default { |
|
|
|
|
this.minutes = obj.min; |
|
|
|
|
this.seconds = obj.sec; |
|
|
|
|
}, 1000); |
|
|
|
|
} else if (this.projectPermissions == "0") { |
|
|
|
|
} else { |
|
|
|
|
this.text = "已用"; |
|
|
|
|
// 获取当前时间 |
|
|
|
|
this.createTime = new Date().getTime(); |
|
|
|
|
//自动开始 |
|
|
|
|
if (this.autoStart) { |
|
|
|
|
this.startCountFn(); |
|
|
|
|
this.startCount() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
resolve() |
|
|
|
@ -469,44 +284,158 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 获取项目列表 |
|
|
|
|
getList(){ |
|
|
|
|
let data = { |
|
|
|
|
systemId: 1, |
|
|
|
|
cId: this.courseId, // 课程id |
|
|
|
|
permissions: this.projectPermissions |
|
|
|
|
} |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(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() |
|
|
|
|
}) |
|
|
|
|
// 获取上次缓存记录 |
|
|
|
|
getCache(pId, jId) { |
|
|
|
|
const projectId = pId ? pId : this.projectId |
|
|
|
|
const judgmentId = jId ? jId : this.judgmentId |
|
|
|
|
this.$post(this.api.getLastCache, { |
|
|
|
|
bcId: judgmentId, // 如果传进来了判分点id,说明本地有缓存,则直接取本地缓存的判分点id,否则,取第一个项目的第一个判分点id |
|
|
|
|
projectId, // 项目id,同上 |
|
|
|
|
cid: this.courseId // 课程id |
|
|
|
|
}).then(res => { |
|
|
|
|
const code = res.getLastCache |
|
|
|
|
// 如果有缓存代码,再提示用户是否要继续上次的实验 |
|
|
|
|
if (code) { |
|
|
|
|
this.$confirm('是否要继续上次的实验?', '提示', { |
|
|
|
|
confirmButtonText: '是', |
|
|
|
|
cancelButtonText: '否', |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
localStorage.removeItem('codeCache') // 恢复代码后清除本地缓存 |
|
|
|
|
this.projectId = projectId |
|
|
|
|
this.judgmentId = judgmentId |
|
|
|
|
const item = this.points.find(e => e.judgmentId === judgmentId) |
|
|
|
|
if (item) item.code = code |
|
|
|
|
// debugger |
|
|
|
|
this.$emit("tell", this.projectId, this.projectPermissions, this.points) |
|
|
|
|
this.$emit('recoveryCode', judgmentId + '') |
|
|
|
|
}).catch(() => { |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 项目选择回调 |
|
|
|
|
selectProject(){ |
|
|
|
|
this.isSelected = true |
|
|
|
|
this.assessmentId = '' |
|
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
|
this.$parent.workbench1 = '0' |
|
|
|
|
this.getProDetail() |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
this.getCache() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.isSubmit = false |
|
|
|
|
this.countVal = 0 |
|
|
|
|
this.grade = 0 |
|
|
|
|
newmain.$emit("isSubmit", this.isSubmit) |
|
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
|
this.$emit('recoveryCode') |
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
}, |
|
|
|
|
//重新开始 |
|
|
|
|
reload() { |
|
|
|
|
this.reloadCount() |
|
|
|
|
this.grade = '00' |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.isSubmit = false |
|
|
|
|
newmain.$emit('isSubmit', this.isSubmit) |
|
|
|
|
this.$emit('recoveryCode') |
|
|
|
|
this.startCount() |
|
|
|
|
// let taskList = this.taskList |
|
|
|
|
// taskList.map(n => { |
|
|
|
|
// delete n.score |
|
|
|
|
// delete n.right |
|
|
|
|
// }) |
|
|
|
|
// this.taskList = JSON.parse(JSON.stringify(taskList)) |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit() { |
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
|
if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验') |
|
|
|
|
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
center: true |
|
|
|
|
}).then(() => { |
|
|
|
|
const date = new Date() |
|
|
|
|
const entryTime = this.entryTime |
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
const endTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) // 结束时间 |
|
|
|
|
const projectId = this.projectId |
|
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
|
this.actEndTime = date |
|
|
|
|
this.reloadCount() |
|
|
|
|
const attributesReqList = [] |
|
|
|
|
pointList.map(e => { |
|
|
|
|
e.codeId && attributesReqList.push({ |
|
|
|
|
codeId: e.codeId, |
|
|
|
|
bcId: e.judgmentId, |
|
|
|
|
isSubmit: 0 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
const data = { |
|
|
|
|
classId: this.classId ? this.classId : '', |
|
|
|
|
className: this.className ? this.className : '', |
|
|
|
|
curriculumId: this.courseId, |
|
|
|
|
startTime: util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), |
|
|
|
|
endTime, |
|
|
|
|
submitTime: endTime, |
|
|
|
|
timeSum, |
|
|
|
|
projectId, |
|
|
|
|
projectName, |
|
|
|
|
assessmentId: this.assessmentId ? this.assessmentId : '', |
|
|
|
|
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.message |
|
|
|
|
let result = [] |
|
|
|
|
let taskList = this.taskList |
|
|
|
|
result.map(n => { |
|
|
|
|
if(taskList.find(e => e.judgmentPointsId == n.judgmentPointsId).isError){ |
|
|
|
|
n.score = 0 |
|
|
|
|
n.right = -1 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.taskList = result |
|
|
|
|
//计算总分 |
|
|
|
|
var s = 0; |
|
|
|
|
this.taskList.forEach(element => { |
|
|
|
|
// this.test = element.score; |
|
|
|
|
// s += this.test; |
|
|
|
|
this.grade = s; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}) |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "info", |
|
|
|
|
message: "已取消提交" |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 实验面板显示隐藏 |
|
|
|
|
togglePannel() { |
|
|
|
|
this.pannelVisible = !this.pannelVisible |
|
|
|
|
}, |
|
|
|
|
// 倒计时 |
|
|
|
|
timeFormat(param) { |
|
|
|
|
return param < 10 ? '0' + param : param |
|
|
|
|
}, |
|
|
|
|
// 清除时间 |
|
|
|
|
reloadCount() { |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.countVal = '' |
|
|
|
|
this.day = '00' |
|
|
|
|
this.seconds = '00' |
|
|
|
|
this.minutes = '00' |
|
|
|
|
this.hour = '00' |
|
|
|
|
}, |
|
|
|
|
counterFn(counterTime) { |
|
|
|
|
let leave1 = counterTime % (24 * 3600 * 1); //计算天数后剩余的毫秒数 |
|
|
|
|
let leave2 = leave1 % (3600 * 1); //计算小时数后剩余的毫秒数 |
|
|
|
|
let leave3 = leave2 % (60 * 1); //计算分钟数后剩余的毫秒数 |
|
|
|
|
let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数 |
|
|
|
|
let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数 |
|
|
|
|
let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数 |
|
|
|
|
let day = Math.floor(counterTime / (24 * 3600 * 1)); //计算相差天数 |
|
|
|
|
let hour = Math.floor(leave1 / (3600 * 1)); //计算相差小时 |
|
|
|
|
let minutes = Math.floor(leave2 / (60 * 1)); //计算相差分钟 |
|
|
|
@ -521,18 +450,12 @@ export default { |
|
|
|
|
this.seconds = seconds; |
|
|
|
|
}, |
|
|
|
|
// 倒计时 |
|
|
|
|
startCountFn() { |
|
|
|
|
if (!this.isStart) { // 未开始倒计时 |
|
|
|
|
this.countVal = this.countVal ? this.countVal : 0; |
|
|
|
|
let timer = setInterval(() => { |
|
|
|
|
this.counterFn(this.countVal++); |
|
|
|
|
}, 1000); |
|
|
|
|
this.globalTimer = timer; |
|
|
|
|
this.isStart = true; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
passToParent(data) { |
|
|
|
|
this.$emit("getDataFromChild", data); |
|
|
|
|
startCount() { |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.countVal = this.countVal ? this.countVal : 0 |
|
|
|
|
this.counterTimer = setInterval(() => { |
|
|
|
|
this.counterFn(this.countVal++) |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -542,13 +465,13 @@ export default { |
|
|
|
|
.break-all{ |
|
|
|
|
word-break: break-all; |
|
|
|
|
} |
|
|
|
|
.m_step { |
|
|
|
|
.left-btn { |
|
|
|
|
height: 150px; |
|
|
|
|
width: 35px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
display: block !important; |
|
|
|
|
} |
|
|
|
|
.n_step { |
|
|
|
|
.right-btn { |
|
|
|
|
height: 150px; |
|
|
|
|
width: 35px; |
|
|
|
|
cursor: pointer; |
|
|
|
|