|
|
|
@ -128,16 +128,19 @@ |
|
|
|
|
<script> |
|
|
|
|
import newmain from "../util/newMain"; |
|
|
|
|
import util from '@/util' |
|
|
|
|
import Config from '@/config' |
|
|
|
|
import Cookie from 'js-cookie' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
token: Cookie.get('admin-token'), |
|
|
|
|
systemId: Cookie.get('admin-systemId') || 1, |
|
|
|
|
classId: Cookie.get('admin-classId'), |
|
|
|
|
className: Cookie.get('admin-className') ? decodeURI(Cookie.get('admin-className')) : '', |
|
|
|
|
courseId: Cookie.get('admin-courseId'), |
|
|
|
|
projectId: Cookie.get('admin-projectId') ? Number(Cookie.get('admin-projectId')) : '', |
|
|
|
|
assessmentId: Cookie.get('admin-assessmentId'), |
|
|
|
|
curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 |
|
|
|
|
curSystemId: 1, |
|
|
|
|
projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
|
isSubmit: false, // 是否提交的标识 |
|
|
|
@ -167,8 +170,8 @@ export default { |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.projectPermissions = this.projectId ? 1 : 0 // 1:考核,0:练习 |
|
|
|
|
if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) |
|
|
|
|
this.projectPermissions = this.assessmentId ? 1 : 0 // 1:考核,0:练习 |
|
|
|
|
if(this.assessmentId){ // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目) |
|
|
|
|
this.getAssList() |
|
|
|
|
}else{ // 练习 |
|
|
|
|
// 获取项目列表 |
|
|
|
@ -195,7 +198,7 @@ export default { |
|
|
|
|
this.$get(`${this.api.queryTestProject}`,data).then(res => { |
|
|
|
|
const list = res.projects |
|
|
|
|
this.projectList = list |
|
|
|
|
if (!this.projectPermissions) this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
|
if (!this.projectPermissions && !this.projectId) this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目 |
|
|
|
|
this.getProDetail().then(() => { |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
@ -217,6 +220,10 @@ export default { |
|
|
|
|
const points = res.projectJudgmentVos |
|
|
|
|
const project = res.projectManage |
|
|
|
|
const curReq = [] |
|
|
|
|
// 跳转银行 |
|
|
|
|
if (project.systemId == 11) { |
|
|
|
|
return location.href = `${Config.bankPath}/#/index/list?curriculumName=${this.curriculumName}&token=${this.token}&cid=${this.courseId}&systemId=${this.systemId}&projectId=${projectId}&assessmentId=&classId=&stopTime=&test=true` |
|
|
|
|
} |
|
|
|
|
if (!points.length) { |
|
|
|
|
this.$message.error('该项目没有判分点,请换个项目重试') |
|
|
|
|
this.projectId = this.projectList[0].projectId |
|
|
|
@ -231,7 +238,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
if (this.projectPermissions) { |
|
|
|
|
this.projectList = [{ |
|
|
|
|
projectId: projectId, |
|
|
|
|
projectId, |
|
|
|
|
projectName: project.projectName |
|
|
|
|
}] |
|
|
|
|
} |
|
|
|
@ -302,7 +309,7 @@ export default { |
|
|
|
|
const assessmentId = this.assessmentId |
|
|
|
|
const list = this.projectList |
|
|
|
|
let points = [] |
|
|
|
|
if (pId && cache.judgmentIdList) { |
|
|
|
|
if (pId && cache.judgmentIdList && !Cookie.get('admin-projectId')) { |
|
|
|
|
cache.judgmentIdList.map(e => { |
|
|
|
|
points.push({ |
|
|
|
|
judgmentId: e |
|
|
|
@ -313,12 +320,19 @@ export default { |
|
|
|
|
points = JSON.parse(JSON.stringify(this.points)) |
|
|
|
|
} |
|
|
|
|
// 如果是没有代码的缓存,则只需要恢复项目,否则,就调接口查询缓存代码 |
|
|
|
|
if (cache && cache.empty && list.find(e => e.projectId === projectId)) { |
|
|
|
|
if (cache && cache.empty && list.find(e => e.projectId === projectId) && !Cookie.get('admin-projectId')) { |
|
|
|
|
if (Cookie.get('admin-projectId')) { |
|
|
|
|
Cookie.remove('admin-projectId') |
|
|
|
|
} else { |
|
|
|
|
this.projectId = projectId |
|
|
|
|
this.getProDetail() |
|
|
|
|
} |
|
|
|
|
this.closeLoad() |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
} else { |
|
|
|
|
if (Cookie.get('admin-projectId')) { |
|
|
|
|
Cookie.remove('admin-projectId') |
|
|
|
|
} |
|
|
|
|
let newJudgmentId = '' // 要恢复到第一个有代码的判分规则,因为有代码的规则可能不是第一个,所以要判断如果这个为空,才把索引赋给该变量 |
|
|
|
|
const promiseList = [] // promise数组 |
|
|
|
|
let hasCache = 0 // 是否有缓存 |
|
|
|
|