|
|
@ -19,9 +19,9 @@ |
|
|
|
style="flex: 1" |
|
|
|
style="flex: 1" |
|
|
|
> |
|
|
|
> |
|
|
|
<el-option |
|
|
|
<el-option |
|
|
|
v-for="item in projectList" |
|
|
|
v-for="(item, i) in projectList" |
|
|
|
:key="item.projectId" |
|
|
|
:key="item.projectId" |
|
|
|
:label="item.projectName" |
|
|
|
:label="i + 1 + '. ' + item.projectName" |
|
|
|
:value="item.projectId" |
|
|
|
:value="item.projectId" |
|
|
|
></el-option> |
|
|
|
></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
@ -193,9 +193,9 @@ export default { |
|
|
|
this.competitionId ? |
|
|
|
this.competitionId ? |
|
|
|
2 : |
|
|
|
2 : |
|
|
|
0 |
|
|
|
0 |
|
|
|
if(this.assessmentId){ // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目) |
|
|
|
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) |
|
|
|
this.getAssList() |
|
|
|
this.getAssList() |
|
|
|
}else{ // 练习 |
|
|
|
} else { // 练习 |
|
|
|
// 获取项目列表 |
|
|
|
// 获取项目列表 |
|
|
|
this.getList().then(() => { |
|
|
|
this.getList().then(() => { |
|
|
|
let cache = localStorage.getItem('codeCache') // 获取本地缓存 |
|
|
|
let cache = localStorage.getItem('codeCache') // 获取本地缓存 |
|
|
@ -206,6 +206,12 @@ export default { |
|
|
|
this.getCache() |
|
|
|
this.getCache() |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
if (this.competitionId) { |
|
|
|
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
|
|
|
this.getCompetitionStatus() |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -278,8 +284,11 @@ export default { |
|
|
|
this.$emit('tell', projectId, systemId, this.points) |
|
|
|
this.$emit('tell', projectId, systemId, this.points) |
|
|
|
const isPrac = this.projectPermissions == 0 // 是否是练习 |
|
|
|
const isPrac = this.projectPermissions == 0 // 是否是练习 |
|
|
|
this.text = isPrac ? '已用' : '剩余' |
|
|
|
this.text = isPrac ? '已用' : '剩余' |
|
|
|
this.countVal = isPrac ? 0 : (new Date(this.endTime).getTime() - Date.now()) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 |
|
|
|
// 竞赛不需要 |
|
|
|
this.startCount() |
|
|
|
if (!this.competitionId) { |
|
|
|
|
|
|
|
this.countVal = isPrac ? 0 : (new Date(this.endTime).getTime() - Date.now()) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 |
|
|
|
|
|
|
|
this.startCount() |
|
|
|
|
|
|
|
} |
|
|
|
resolve() |
|
|
|
resolve() |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
reject() |
|
|
|
reject() |
|
|
@ -318,7 +327,7 @@ export default { |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
// 查询考核状态定时器 |
|
|
|
// 查询考核状态定时器 |
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
this.getStatus() |
|
|
|
this.getAssStatus() |
|
|
|
}, 1000) |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -425,8 +434,8 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 定时查询考核状态(只有考核才需要定时查,查到考核如果结束后,直接提交考核) |
|
|
|
// 定时查询考核状态(查到考核如果结束后,直接提交考核) |
|
|
|
getStatus() { |
|
|
|
getAssStatus() { |
|
|
|
// 未提交才需要查询状态 |
|
|
|
// 未提交才需要查询状态 |
|
|
|
this.isSubmit || this.$get(this.api.getDetailById, { |
|
|
|
this.isSubmit || this.$get(this.api.getDetailById, { |
|
|
|
id: this.assessmentId |
|
|
|
id: this.assessmentId |
|
|
@ -442,6 +451,28 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 定时查询竞赛状态(查到竞赛如果结束后,直接提交竞赛) |
|
|
|
|
|
|
|
getCompetitionStatus() { |
|
|
|
|
|
|
|
// 未提交才需要查询状态 |
|
|
|
|
|
|
|
this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => { |
|
|
|
|
|
|
|
const stages = competition.competitionStage |
|
|
|
|
|
|
|
if (stages) { |
|
|
|
|
|
|
|
const stage = stages.find(e => e.stageId == this.stageId) |
|
|
|
|
|
|
|
const endTime = new Date(stage.endTime).getTime() |
|
|
|
|
|
|
|
const now = Date.now() |
|
|
|
|
|
|
|
// 如果已经结束 |
|
|
|
|
|
|
|
if (now >= new Date(stage.endTime)) { |
|
|
|
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
|
|
|
this.$alert('竞赛时间已到,系统已自动交卷', '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.submit() |
|
|
|
|
|
|
|
} else { // 没结束,则显示倒计时(竞赛才需要通过定时调接口来显示倒计时,因为中台可以修改结束时间,所以需要时刻获取最新的结束时间) |
|
|
|
|
|
|
|
this.counter((endTime - now) / 1000) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
}, |
|
|
|
// 项目选择回调 |
|
|
|
// 项目选择回调 |
|
|
|
selectProject(){ |
|
|
|
selectProject(){ |
|
|
|
this.isSelected = true |
|
|
|
this.isSelected = true |
|
|
@ -514,7 +545,8 @@ export default { |
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
const projectId = this.projectId |
|
|
|
const projectId = this.projectId |
|
|
|
const projectName = this.projectList.find(e => e.projectId == projectId).projectName // 获取项目名称 |
|
|
|
const pro = this.projectList.find(e => e.projectId == projectId) |
|
|
|
|
|
|
|
const projectName = pro ? pro.projectName : '' // 获取项目名称 |
|
|
|
this.reloadCount() |
|
|
|
this.reloadCount() |
|
|
|
// 判分点参数 |
|
|
|
// 判分点参数 |
|
|
|
const attributesReqList = [] |
|
|
|
const attributesReqList = [] |
|
|
|