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