|
|
@ -133,32 +133,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import newmain from "../util/newMain"; |
|
|
|
import newmain from "../util/newMain"; |
|
|
|
import axios from "axios"; |
|
|
|
|
|
|
|
import * as $ from "jquery"; |
|
|
|
import * as $ from "jquery"; |
|
|
|
import { get } from "http"; |
|
|
|
import { get } from "http"; |
|
|
|
//返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" |
|
|
|
import util from '@/util' |
|
|
|
function formatDate(fmt,date) { |
|
|
|
|
|
|
|
var date = date ? date : new Date() |
|
|
|
|
|
|
|
var o = { |
|
|
|
|
|
|
|
"M+" : date.getMonth()+1, //月份 |
|
|
|
|
|
|
|
"d+" : date.getDate(), //日 |
|
|
|
|
|
|
|
"h+" : date.getHours(), //小时 |
|
|
|
|
|
|
|
"m+" : date.getMinutes(), //分 |
|
|
|
|
|
|
|
"s+" : date.getSeconds(), //秒 |
|
|
|
|
|
|
|
"q+" : Math.floor((date.getMonth()+3)/3), //季度 |
|
|
|
|
|
|
|
"S" : date.getMilliseconds() //毫秒 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if(/(y+)/.test(fmt)) { |
|
|
|
|
|
|
|
fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(var k in o) { |
|
|
|
|
|
|
|
if(new RegExp("("+ k +")").test(fmt)){ |
|
|
|
|
|
|
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return fmt; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -197,7 +174,7 @@ export default { |
|
|
|
assessmentId: "", |
|
|
|
assessmentId: "", |
|
|
|
projectPermissions: 0, //项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
projectPermissions: 0, //项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
isSubmit: false, |
|
|
|
isSubmit: false, |
|
|
|
entryTime: formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
entryTime: util.formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
startTime: '', |
|
|
|
startTime: '', |
|
|
|
stopTime: '', |
|
|
|
stopTime: '', |
|
|
|
isSelected: false, |
|
|
|
isSelected: false, |
|
|
@ -263,41 +240,42 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.assessmentId = this.getCookie("assessmentId"); |
|
|
|
this.assessmentId = util.getCookie("assessmentId"); |
|
|
|
this.userId = this.getCookie("userId"); |
|
|
|
this.userId = util.getCookie("userId"); |
|
|
|
this.studentId = this.getCookie("studentId"); |
|
|
|
this.studentId = util.getCookie("studentId"); |
|
|
|
this.projectId = this.getCookie("projectId"); |
|
|
|
this.projectId = util.getCookie("projectId"); |
|
|
|
this.courseId = this.getCookie("courseId"); |
|
|
|
this.courseId = util.getCookie("courseId"); |
|
|
|
this.startTime = this.getCookie("startTime") ? new Date(this.getCookie("startTime")).getTime() : '' |
|
|
|
this.startTime = util.getCookie("startTime") ? new Date(util.getCookie("startTime")).getTime() : '' |
|
|
|
this.stopTime = this.getCookie("stopTime") ? new Date(this.getCookie("stopTime")).getTime() : '' |
|
|
|
this.stopTime = util.getCookie("stopTime") ? new Date(util.getCookie("stopTime")).getTime() : '' |
|
|
|
|
|
|
|
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 |
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 |
|
|
|
if(this.projectId){ |
|
|
|
if(this.projectId){ |
|
|
|
this.getQueryProject(); |
|
|
|
this.getQueryProject(); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
|
|
|
|
console.log(33) |
|
|
|
this.getProjects(); |
|
|
|
this.getProjects(); |
|
|
|
let codeCache = localStorage.getItem('codeCache') |
|
|
|
let codeCache = localStorage.getItem('codeCache') |
|
|
|
if(codeCache){ |
|
|
|
if(codeCache){ |
|
|
|
codeCache = JSON.parse(codeCache) |
|
|
|
codeCache = JSON.parse(codeCache) |
|
|
|
if(codeCache.systemId && codeCache.systemId == this.$config.systemId){ |
|
|
|
// if(codeCache.systemId && codeCache.systemId == this.$config.systemId){ |
|
|
|
this.$confirm('是否要继续上次的实验?', '提示', { |
|
|
|
// this.$confirm('是否要继续上次的实验?', '提示', { |
|
|
|
confirmButtonText: '是', |
|
|
|
// confirmButtonText: '是', |
|
|
|
cancelButtonText: '否', |
|
|
|
// cancelButtonText: '否', |
|
|
|
type: 'success' |
|
|
|
// type: 'success' |
|
|
|
}).then(() => { |
|
|
|
// }).then(() => { |
|
|
|
this.value1 = codeCache.projectId |
|
|
|
// this.value1 = codeCache.projectId |
|
|
|
this.workbenchCus = codeCache.workbench |
|
|
|
// this.workbenchCus = codeCache.workbench |
|
|
|
this.isRecovery = true |
|
|
|
// this.isRecovery = true |
|
|
|
this.selectProject() |
|
|
|
// this.selectProject() |
|
|
|
let codeIds = [] |
|
|
|
// let codeIds = [] |
|
|
|
codeCache.workbench.map(n => codeIds.push(n.code.codeId)) |
|
|
|
// codeCache.workbench.map(n => codeIds.push(n.code.codeId)) |
|
|
|
codeIds = codeIds.filter(n => n) |
|
|
|
// codeIds = codeIds.filter(n => n) |
|
|
|
this.codeIds = codeIds |
|
|
|
// this.codeIds = codeIds |
|
|
|
this.$emit('recoveryCode',codeCache.workbench1) |
|
|
|
// this.$emit('recoveryCode',codeCache.workbench1) |
|
|
|
}).catch(() => { |
|
|
|
// }).catch(() => { |
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
// localStorage.removeItem('codeCache') |
|
|
|
}) |
|
|
|
// }) |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.assessmentId && this.projectId && this.checkVer() |
|
|
|
this.assessmentId && this.projectId && this.checkVer() |
|
|
@ -475,6 +453,7 @@ export default { |
|
|
|
this.handleData(res.projectManage,1) |
|
|
|
this.handleData(res.projectManage,1) |
|
|
|
this.projectId = res.projectManage[0].projectId |
|
|
|
this.projectId = res.projectManage[0].projectId |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// debugger |
|
|
|
this.points = res.projectJudgmentVos; |
|
|
|
this.points = res.projectJudgmentVos; |
|
|
|
this.$emit("tell", this.value1, this.projectPermissions, this.points); |
|
|
|
this.$emit("tell", this.value1, this.projectPermissions, this.points); |
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
@ -539,7 +518,7 @@ export default { |
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
systemId: 1, |
|
|
|
systemId: 1, |
|
|
|
cId: this.courseId, |
|
|
|
cId: this.courseId, |
|
|
|
permissions: 0 |
|
|
|
permissions: this.projectPermissions |
|
|
|
} |
|
|
|
} |
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
this.handleData(res.projects,2) |
|
|
|
this.handleData(res.projects,2) |
|
|
@ -586,24 +565,6 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
passToParent(data) { |
|
|
|
passToParent(data) { |
|
|
|
this.$emit("getDataFromChild", data); |
|
|
|
this.$emit("getDataFromChild", data); |
|
|
|
}, |
|
|
|
|
|
|
|
getCookie(cookie_name) { |
|
|
|
|
|
|
|
//获取cookie中指定key的value |
|
|
|
|
|
|
|
var allcookies = document.cookie; //索引长度,开始索引的位置 |
|
|
|
|
|
|
|
var cookie_pos = allcookies.indexOf(cookie_name); // 如果找到了索引,就代表cookie存在,否则不存在 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cookie_pos != -1) { |
|
|
|
|
|
|
|
// 把cookie_pos放在值的开始,只要给值加1即可 |
|
|
|
|
|
|
|
//计算取cookie值得开始索引,加的1为“=” |
|
|
|
|
|
|
|
cookie_pos = cookie_pos + cookie_name.length + 1; //计算取cookie值得结束索引 |
|
|
|
|
|
|
|
var cookie_end = allcookies.indexOf(";", cookie_pos); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cookie_end == -1) { |
|
|
|
|
|
|
|
cookie_end = allcookies.length; |
|
|
|
|
|
|
|
} //得到想要的cookie的值 |
|
|
|
|
|
|
|
var value = unescape(allcookies.substring(cookie_pos, cookie_end)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return value; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|