From 26628a094c017c28ce6191590af2b900aef4e24a Mon Sep 17 00:00:00 2001 From: "jialong.yu" Date: Tue, 21 Dec 2021 16:08:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E8=80=83=E6=A0=B8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 1 + src/components/TestPanel.vue | 22 ++++++++++++++++++---- src/config/index.js | 17 +++++++---------- src/views/Home.vue | 1 + 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 40f2bec..f4b2414 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,6 +6,7 @@ export default { queryTestProject: 'occupationlab/projectManage/getProjectBySystemId', saveCache: 'python/python/saveCache', getLastCache: 'python/python/getLastCache', + delCache: 'python/python/delCache', getDetailById: 'occupationlab/assessment/getDetailById', pageStuAssessment: 'occupationlab/assessment/pageStuAssessment' } \ No newline at end of file diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index 3b235c8..f7fe41d 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -175,7 +175,7 @@ export default { }; }, mounted() { - this.projectPermissions = this.projectId ? 1 : 0 // 考核/练习 + this.projectPermissions = this.projectId ? 1 : 0 // 1:考核,0:练习 if(this.projectId){ // 考核(考核才会从外面带进来projectId,练习是默认显示第一个项目) this.getAssList() }else{ // 练习 @@ -269,7 +269,9 @@ export default { } }) if (!done) { - this.getList() + this.getList().then(() => { + this.getCache() + }).catch(res => {}) // 查询考核状态定时器 this.statusTimer = setInterval(_ => { this.getStatus() @@ -281,10 +283,13 @@ export default { getCache(pId, jId) { const projectId = pId || this.projectId const judgmentId = jId || this.judgmentId + const cid = this.courseId + const assessmentId = this.assessmentId this.$post(this.api.getLastCache, { + assessmentId: assessmentId ? Number(assessmentId) : '', bcId: judgmentId, // 如果传进来了判分点id,说明本地有缓存,则直接取本地缓存的判分点id,否则,取第一个项目的第一个判分点id projectId, // 项目id,同上 - cid: this.courseId // 课程id + cid // 课程id }).then(res => { const code = res.getLastCache // 如果有缓存代码,再提示用户是否要继续上次的实验 @@ -314,13 +319,20 @@ export default { } }).catch(() => { localStorage.removeItem('codeCache') + this.$post(`${this.api.delCache}`, { + assessmentId, + bcId: judgmentId, + projectId, + cid + }).then(res => {}).catch(() => {}) }) } }).catch(res => {}) }, // 定时查询考核状态(只有考核才需要定时查,查到考核如果结束后,直接提交考核) getStatus() { - this.$get(this.api.getDetailById, { + // 未提交才需要查询状态 + this.isSubmit || this.$get(this.api.getDetailById, { id: this.assessmentId }).then(res => { const done = res.data ? res.data.status === 2 : false // 状态(0、待开始 1、进行中 2、已结束) @@ -376,6 +388,7 @@ export default { }, // 提交 submit() { + if (this.isSubmit) return false const pointList = this.$parent.workbench const date = new Date() const entryTime = this.entryTime @@ -414,6 +427,7 @@ export default { localStorage.removeItem('codeCache') this.isSubmit = true newmain.$emit('isSubmit', this.isSubmit) + clearInterval(this.statusTimer) let list = res.retInfo let taskList = this.taskList var score = 0 diff --git a/src/config/index.js b/src/config/index.js index fdfc3c9..c11f8f4 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -1,15 +1,12 @@ const isHh = location.host.includes('10.196.131.73') //是否是河海版本 -const isBeta = process.env.NODE_ENV === 'development' || location.host.includes('120.78.198.231') //是否是职站测试 -const isPro = location.host.includes('occupationlab.com') //是否是职站生产 +const isBeta = process.env.NODE_ENV === 'development' || location.host.includes('39.108.250.202') //是否是职站测试 -let host = ""; -if(isHh) { - host = "http://10.196.131.73/"; -} else if(isBeta) { - host = "http://39.108.250.202:9000/"; - host = "http://192.168.31.151:9000/"; -} else if(isPro) { - host = "http://www.occupationlab.com/"; +let host = '' +if(isBeta) { + host = 'http://39.108.250.202:9000' + // host = 'http://192.168.31.151:9000' +} else { + host = location.origin + '/' } export default { diff --git a/src/views/Home.vue b/src/views/Home.vue index 6c85d85..d210e5a 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -86,6 +86,7 @@ export default { list.map(e => { if (e.code) { let data = { + assessmentId: this.assessmentId, code: e.code, bcId: e.judgmentId, cid: this.courseId,