|
|
|
@ -325,7 +325,7 @@ export default { |
|
|
|
|
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')) : '', |
|
|
|
|
className: Cookie.get('admin-className') ? Cookie.get('admin-className') : '', |
|
|
|
|
courseId: Cookie.get('admin-courseId'), |
|
|
|
|
projectId: Cookie.get('admin-projectId') ? Number(Cookie.get('admin-projectId')) : '', |
|
|
|
|
assessmentId: Cookie.get('admin-assessmentId'), |
|
|
|
@ -363,7 +363,6 @@ export default { |
|
|
|
|
taskList: [], // 实验任务列表 |
|
|
|
|
pannelTab: 'first', // 面板信息切换值 |
|
|
|
|
isSelected: false, // 是否选择过项目的标识,选择了会置为true |
|
|
|
|
statusTimer: null, // 查询考核状态定时器 |
|
|
|
|
reportId: '', |
|
|
|
|
|
|
|
|
|
cmOption: { |
|
|
|
@ -395,7 +394,8 @@ export default { |
|
|
|
|
reportPoints: [], |
|
|
|
|
reportVisible: false, |
|
|
|
|
tableHeight: 0, |
|
|
|
|
dragIds: ['panelHeader', 'aside', 'main', 'infoContainer'] |
|
|
|
|
dragIds: ['panelHeader', 'aside', 'main', 'infoContainer'], |
|
|
|
|
submiting: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -427,13 +427,9 @@ export default { |
|
|
|
|
this.getCache() |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
if (this.competitionId) { |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
this.getCompetitionStatus() |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.competitionId && this.getCompetitionStatus() // 查询竞赛信息 |
|
|
|
|
this.getUserDetail() |
|
|
|
|
// this.drag() |
|
|
|
|
this.tableHeight = window.innerHeight - 360 |
|
|
|
|
}, |
|
|
|
@ -564,9 +560,7 @@ export default { |
|
|
|
|
this.getCache() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
// 查询考核状态定时器 |
|
|
|
|
this.statusTimer = setInterval(_ => { |
|
|
|
|
this.getAssStatus() |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
@ -599,7 +593,7 @@ export default { |
|
|
|
|
this.closeLoad() |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
} else { |
|
|
|
|
if (Cookie.get('admin-projectId') && !this.competitionId) { |
|
|
|
|
if (Cookie.get('admin-projectId') && this.projectPermissions == 0) { |
|
|
|
|
Cookie.remove('admin-projectId') |
|
|
|
|
} |
|
|
|
|
let newJudgmentId = '' // 要恢复到第一个有代码的判分规则,因为有代码的规则可能不是第一个,所以要判断如果这个为空,才把索引赋给该变量 |
|
|
|
@ -672,7 +666,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 定时查询考核状态(查到考核如果结束后,直接提交考核) |
|
|
|
|
// 查询考核状态(查到考核如果结束后,直接提交考核) |
|
|
|
|
getAssStatus () { |
|
|
|
|
// 未提交才需要查询状态 |
|
|
|
|
this.isSubmit || this.$get(this.api.getDetailById, { |
|
|
|
@ -681,7 +675,6 @@ export default { |
|
|
|
|
const done = res.data ? res.data.status === 2 : false // 状态(0、待开始 1、进行中 2、已结束) |
|
|
|
|
// 如果考核已结束,则清除查询考核状态的定时器,并且自动提交 |
|
|
|
|
if (done) { |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.$alert('考核时间已到,系统已自动交卷', '提示', { |
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
}) |
|
|
|
@ -689,7 +682,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 定时查询竞赛状态(查到竞赛如果结束后,直接提交竞赛) |
|
|
|
|
// 查询竞赛状态(查到竞赛如果结束后,直接提交竞赛) |
|
|
|
|
getCompetitionStatus () { |
|
|
|
|
// 未提交才需要查询状态 |
|
|
|
|
this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => { |
|
|
|
@ -700,13 +693,13 @@ export default { |
|
|
|
|
const now = Date.now() |
|
|
|
|
// 如果已经结束 |
|
|
|
|
if (now >= new Date(stage.endTime)) { |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.$alert('竞赛时间已到,系统已自动交卷', '提示', { |
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
}) |
|
|
|
|
this.submit() |
|
|
|
|
} else { // 没结束,则显示倒计时(竞赛才需要通过定时调接口来显示倒计时,因为中台可以修改结束时间,所以需要时刻获取最新的结束时间) |
|
|
|
|
this.counter((endTime - now) / 1000) |
|
|
|
|
} else { // 没结束,则显示倒计时 |
|
|
|
|
this.countVal = (endTime - Date.now()) / 1000 |
|
|
|
|
this.startCount() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
@ -776,7 +769,6 @@ export default { |
|
|
|
|
ready () { |
|
|
|
|
for (let i = 0; i < this.points.length; i++) { |
|
|
|
|
const code = this.$refs['codemirror' + i][0].codemirror |
|
|
|
|
console.log('ready', code) |
|
|
|
|
|
|
|
|
|
// code && code.setSize('auto', 'calc(100vh - 150px)') |
|
|
|
|
code && code.setSize('auto', '300px') |
|
|
|
@ -784,6 +776,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 提交询问 |
|
|
|
|
confirmSubmit () { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
this.submiting = true |
|
|
|
|
const isVscode = this.$parent.language // 是否选择了vscode |
|
|
|
|
const { taskList } = this |
|
|
|
|
const pointList = this.$parent.workbench |
|
|
|
@ -842,7 +836,9 @@ export default { |
|
|
|
|
this.submit() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit () { |
|
|
|
@ -891,7 +887,6 @@ export default { |
|
|
|
|
this.$post(this.api.submit, data).then(({ retInfo, reportId }) => { |
|
|
|
|
localStorage.removeItem('codeCache') |
|
|
|
|
this.setSubmit(true) |
|
|
|
|
clearInterval(this.statusTimer) |
|
|
|
|
this.reportVisible = false |
|
|
|
|
let list = retInfo |
|
|
|
|
let { taskList } = this |
|
|
|
@ -912,14 +907,17 @@ export default { |
|
|
|
|
this.$store.commit('setReportId', reportId) |
|
|
|
|
this.$store.commit('setTaskList', taskList) |
|
|
|
|
this.editReport(reportId) |
|
|
|
|
this.submiting = false |
|
|
|
|
// 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 |
|
|
|
|
this.competitionId && this.resultsDetails == 0 && this.$alert(`提交成功${this.resultAnnouncementTime != 0 ? ',成绩将在' + this.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: action => { |
|
|
|
|
this.$parent.back() |
|
|
|
|
} |
|
|
|
|
// this.competitionId && this.resultsDetails == 0 && this.$alert(`提交成功${this.resultAnnouncementTime != 0 ? ',成绩将在' + this.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { |
|
|
|
|
// confirmButtonText: '确定', |
|
|
|
|
// callback: action => { |
|
|
|
|
// this.$parent.back() |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 编辑实验报告 |
|
|
|
|
editReport (reportId) { |
|
|
|
@ -981,8 +979,24 @@ export default { |
|
|
|
|
this.minutes = '00' |
|
|
|
|
this.hour = '00' |
|
|
|
|
}, |
|
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
|
// 计时前的判断 |
|
|
|
|
counter (counterTime) { |
|
|
|
|
if (counterTime <= 0) { |
|
|
|
|
if (this.projectPermissions) { // 竞赛/考核 |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.$alert(`${this.projectPermissions == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
}) |
|
|
|
|
this.submit() |
|
|
|
|
} else { |
|
|
|
|
this.handleCounter(counterTime) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.handleCounter(counterTime) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
|
handleCounter (counterTime) { |
|
|
|
|
let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数 |
|
|
|
|
let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数 |
|
|
|
|
let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数 |
|
|
|
@ -1065,7 +1079,51 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
document.querySelector('#toggle').onmousedown = this.pannelVisible ? this.togglePannel : drag1 |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// websocket获取考核及竞赛信息,用于自动提交 |
|
|
|
|
// socket连接成功 |
|
|
|
|
open () { |
|
|
|
|
console.log("socket连接成功"); |
|
|
|
|
}, |
|
|
|
|
// socket连接失败 |
|
|
|
|
error () { |
|
|
|
|
console.log("连接错误"); |
|
|
|
|
}, |
|
|
|
|
// 接收消息 |
|
|
|
|
getMessage (msg) { |
|
|
|
|
console.log("==websocket接收数据=="); |
|
|
|
|
console.log(JSON.parse(msg.data)); |
|
|
|
|
const { content } = JSON.parse(msg.data) |
|
|
|
|
// 1赛事、2创业、3考核、4模型。-号拼接携带id |
|
|
|
|
if (content == 1) { |
|
|
|
|
this.getCompetitionStatus() |
|
|
|
|
} else if (content === '3-' + this.assessmentId) { // 考核:3-考核id |
|
|
|
|
this.getAssStatus() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 关闭socket |
|
|
|
|
close () { |
|
|
|
|
console.log("socket已经关闭"); |
|
|
|
|
}, |
|
|
|
|
// 初始化socket |
|
|
|
|
initSocket ({ id, account }) { |
|
|
|
|
// 实例化socket |
|
|
|
|
this.socket = new WebSocket(`${this.$config.isTest ? 'ws' : 'wss'}://${this.$config.isDev ? '192.168.31.51:9100' : location.host}/nakadai/websocket/${id}/${account}`) |
|
|
|
|
// this.socket = new WebSocket(`ws://121.37.12.51:9100/nakadai/websocket/${id}/${account}`) |
|
|
|
|
// 监听socket连接 |
|
|
|
|
this.socket.onopen = this.open; |
|
|
|
|
// 监听socket错误信息 |
|
|
|
|
this.socket.onerror = this.error; |
|
|
|
|
// 监听socket消息 |
|
|
|
|
this.socket.onmessage = this.getMessage; |
|
|
|
|
}, |
|
|
|
|
// 获取用户详情 |
|
|
|
|
getUserDetail () { |
|
|
|
|
this.$get(this.api.queryUserInfoDetails).then(res => { |
|
|
|
|
this.initSocket(res.result.userAccount) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|