From b7ed849f54ae26fc94e4ffaca54a3b765ec109bf Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 19 Mar 2024 18:19:26 +0800 Subject: [PATCH] fix --- src/api/index.js | 1 + src/components/TestPanel.vue | 20 ++++++++++++++++---- src/components/codemirror.vue | 21 ++++++++++++++------- src/config/index.js | 4 ++-- src/views/Home.vue | 19 +++++++++++++++++++ 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 53dc5c8..03b35bd 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -43,4 +43,5 @@ export default { removeImport: `occupationlab/occupationlab/experimentalReport/removeImport`, getStartTime: `python/python/getStartTime`, getProductSystemTheme: `nakadai/mall/getProductSystemTheme`, + heartbeatDetection : `nakadai/message/heartbeatDetection`, } \ No newline at end of file diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index c702619..d70e0ef 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -439,6 +439,7 @@ export default { } this.competitionId && this.getCompetitionStatus() // 查询竞赛信息 this.getUserDetail() + this.heartbeatDetection() this.drag() this.tableHeight = window.innerHeight - 360 }, @@ -815,6 +816,8 @@ export default { const points = this.points // code和codeId,还有运行结果全部清空 points.map(e => { + e.finalCode = '' + e.photoUrl = '' e.code = '' e.codeId = '' e.answer = '' @@ -922,7 +925,7 @@ export default { const attributesReqList = [] pointList.map(e => { attributesReqList.push({ - code: e.code, + code: e.finalCode, codeId: e.codeId, bcId: e.judgmentId, isSubmit: e.codeId ? 1 : 0, @@ -979,7 +982,10 @@ export default { this.submiting = false // 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 if (this.competitionId) { - this.$alert(`提交成功!${this.resultAnnouncementTime != 0 ? '成绩将在' + this.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { + const time = this.resultAnnouncementTime + const msg = + time === '0' ? '提交成功!成绩将在比赛结束后公布,请前往参赛信息模块查看' : time > 0 ? `提交成功!成绩将在比赛结束后${time}小时公布,请前往参赛信息模块查看` : '提交成功'; + this.$alert(msg, '提示', { confirmButtonText: '确定', callback: action => { this.$parent.back() @@ -1170,9 +1176,9 @@ export default { console.log(JSON.parse(msg.data)); const { content } = JSON.parse(msg.data) // 1赛事、2创业、3考核、4模型。-号拼接携带id - if (content == 1) { + if (content == 1 && this.projectPermissions === 2) { this.getCompetitionStatus() - } else if (content === '3-' + this.assessmentId) { // 考核:3-考核id + } else if ((content === '3-' + this.assessmentId) && this.projectPermissions === 1) { // 考核:3-考核id this.getAssStatus() } }, @@ -1192,6 +1198,12 @@ export default { // 监听socket消息 this.socket.onmessage = this.getMessage; }, + // 心跳检测 + heartbeatDetection () { + setInterval(async () => { + await this.$get(this.api.heartbeatDetection) + }, 58 * 1000) + }, // 获取用户详情 getUserDetail () { this.$get(this.api.queryUserInfoDetails).then(res => { diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index 997a21b..4182104 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -201,7 +201,7 @@ 查看代码 导入代码 + @click="importCode(scope.row)">插入代码 删除 @@ -222,7 +222,7 @@ -
+ v-html="curRow.runResults">
导入代码 + @click="showSubmit">插入代码
@@ -314,7 +314,7 @@ import config from '@/config' import { saveAs } from 'file-saver' const CANCEL_TOKEN = axios.CancelToken // 用于input中中断请求 export default { - props: ['judgmentId', 'code', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow', 'photoUrl', 'answer'], + props: ['judgmentId', 'code', 'finalCode', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow', 'photoUrl', 'answer'], data () { return { token: Cookie.get('admin-token'), @@ -417,8 +417,8 @@ export default { showVisible: false, showActive: 'code', + curRow: {}, curCode: '', - curResult: '', curPhotoUrl: [], }; }, @@ -471,12 +471,15 @@ export default { }, // 清屏 clearCode () { + this.picSrcList = [] this.codeVal = '' this.isError = '' this.runResult = '' + this.$emit('update:finalCode', '') this.$emit('update:codeId', '') // 更新coddeId this.$emit('update:answer', '') // 更新运行结果 this.$emit('update:retResult', '') // 更新返回结果 + this.$emit('update:photoUrl', '') // 更新返回结果 }, // 导入模型 importModel () { @@ -608,6 +611,7 @@ export default { this.isError = 1 this.runResult += result } + this.$emit('update:finalCode', this.sourceCode) this.$emit('update:codeId', res.codeId) // 更新coddeId this.$emit('update:answer', this.runResult) // 更新运行结果 this.$emit('update:retResult', data.retResult) // 更新返回结果 @@ -674,6 +678,7 @@ export default { this.isError = 1 this.confirmInput(result) } + this.$emit('update:finalCode', code) this.$emit('update:codeId', res.codeId) // 更新coddeId this.$emit('update:answer', this.runResult) // 更新运行结果 this.$emit('update:retResult', data.retResult) // 更新返回结果 @@ -710,6 +715,7 @@ export default { this.picSrcList = photo.split(',') this.$emit('update:photoUrl', photo) } + this.$emit('update:finalCode', code) this.$emit('update:codeId', res.codeId) // 更新coddeId this.$emit('update:answer', result) // 更新运行结果 this.$emit('update:retResult', data.retResult) // 更新返回结果 @@ -864,9 +870,10 @@ export default { }, // 查看代码 showCode (row) { + this.curRow = row this.curCode = row.runCode - this.curResult = row.runResults this.curPhotoUrl = row.photoUrl ? row.photoUrl.split(',') : [] + this.showActive = 'code' this.showVisible = true }, // 导入代码 diff --git a/src/config/index.js b/src/config/index.js index f8d56c7..acebe26 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -13,9 +13,9 @@ let host = location.origin + '/' let bankPath = `${location.origin}/banksystem` // 银行系统 // 121.37.12.51 | 192.168.31.151 if (isDev) { - host = 'http://192.168.31.217:9000/' + // host = 'http://192.168.31.217:9000/' // host = 'http://121.37.12.51:9000/' - // host = 'https://occupationlab.com/' + host = 'https://occupationlab.com/' bankPath = `http://${location.hostname}:8093` } else if (isPro) { host = 'https://occupationlab.com/' diff --git a/src/views/Home.vue b/src/views/Home.vue index 335afb9..d08af0d 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -60,6 +60,7 @@ :projectId.sync="projectId" :systemId.sync="systemId" :code.sync="item.code" + :finalCode.sync="item.finalCode" :judgmentId="item.judgmentId" :codeId.sync="item.codeId" :answer.sync="item.answer" @@ -82,10 +83,14 @@ ref="mainindex" :workbench.sync="workbench">
+ +