|
|
|
@ -133,32 +133,9 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import newmain from "../util/newMain"; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
import * as $ from "jquery"; |
|
|
|
|
import { get } from "http"; |
|
|
|
|
//返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
import util from '@/util' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -197,7 +174,7 @@ export default { |
|
|
|
|
assessmentId: "", |
|
|
|
|
projectPermissions: 0, //项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
|
isSubmit: false, |
|
|
|
|
entryTime: formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
|
entryTime: util.formatDate('yyyy-MM-dd hh:mm:ss'), |
|
|
|
|
startTime: '', |
|
|
|
|
stopTime: '', |
|
|
|
|
isSelected: false, |
|
|
|
@ -263,41 +240,42 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.assessmentId = this.getCookie("assessmentId"); |
|
|
|
|
this.userId = this.getCookie("userId"); |
|
|
|
|
this.studentId = this.getCookie("studentId"); |
|
|
|
|
this.projectId = this.getCookie("projectId"); |
|
|
|
|
this.courseId = this.getCookie("courseId"); |
|
|
|
|
this.startTime = this.getCookie("startTime") ? new Date(this.getCookie("startTime")).getTime() : '' |
|
|
|
|
this.stopTime = this.getCookie("stopTime") ? new Date(this.getCookie("stopTime")).getTime() : '' |
|
|
|
|
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') |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// 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.assessmentId && this.projectId && this.checkVer() |
|
|
|
@ -475,6 +453,7 @@ export default { |
|
|
|
|
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); |
|
|
|
|
// 切换实训项目-标签页回到第一个位置 |
|
|
|
@ -539,7 +518,7 @@ export default { |
|
|
|
|
let data = { |
|
|
|
|
systemId: 1, |
|
|
|
|
cId: this.courseId, |
|
|
|
|
permissions: 0 |
|
|
|
|
permissions: this.projectPermissions |
|
|
|
|
} |
|
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
|
this.handleData(res.projects,2) |
|
|
|
@ -586,24 +565,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
passToParent(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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|