|
|
|
@ -19,9 +19,9 @@ |
|
|
|
|
style="flex: 1" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in projectList" |
|
|
|
|
v-for="(item, i) in projectList" |
|
|
|
|
:key="item.projectId" |
|
|
|
|
:label="item.projectName" |
|
|
|
|
:label="i + 1 + '. ' + item.projectName" |
|
|
|
|
:value="item.projectId" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
@ -193,9 +193,9 @@ export default { |
|
|
|
|
this.competitionId ? |
|
|
|
|
2 : |
|
|
|
|
0 |
|
|
|
|
if(this.assessmentId){ // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目) |
|
|
|
|
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) |
|
|
|
|
this.getAssList() |
|
|
|
|
}else{ // 练习 |
|
|
|
|
} else { // 练习 |
|
|
|
|
// 获取项目列表 |
|
|
|
|
this.getList().then(() => { |
|
|
|
|
let cache = localStorage.getItem('codeCache') // 获取本地缓存 |
|
|
|
@ -206,6 +206,12 @@ export default { |
|
|
|
|
this.getCache() |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
if (this.competitionId) { |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
this.getCompetitionStatus() |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
@ -278,8 +284,11 @@ export default { |
|
|
|
|
this.$emit('tell', projectId, systemId, this.points) |
|
|
|
|
const isPrac = this.projectPermissions == 0 // 是否是练习 |
|
|
|
|
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() |
|
|
|
|
}).catch(err => { |
|
|
|
|
reject() |
|
|
|
@ -318,7 +327,7 @@ export default { |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
// 查询考核状态定时器 |
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
this.getStatus() |
|
|
|
|
this.getAssStatus() |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -425,8 +434,8 @@ export default { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 定时查询考核状态(只有考核才需要定时查,查到考核如果结束后,直接提交考核) |
|
|
|
|
getStatus() { |
|
|
|
|
// 定时查询考核状态(查到考核如果结束后,直接提交考核) |
|
|
|
|
getAssStatus() { |
|
|
|
|
// 未提交才需要查询状态 |
|
|
|
|
this.isSubmit || this.$get(this.api.getDetailById, { |
|
|
|
|
id: this.assessmentId |
|
|
|
@ -442,6 +451,28 @@ export default { |
|
|
|
|
} |
|
|
|
|
}).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(){ |
|
|
|
|
this.isSelected = true |
|
|
|
@ -514,7 +545,8 @@ export default { |
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) |
|
|
|
|
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() |
|
|
|
|
// 判分点参数 |
|
|
|
|
const attributesReqList = [] |
|
|
|
|