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