diff --git a/src/assets/images/system/5/right.png b/src/assets/images/system/5/right.png index 0968305..9c74e25 100644 Binary files a/src/assets/images/system/5/right.png and b/src/assets/images/system/5/right.png differ diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index 420f651..587eba0 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -283,7 +283,7 @@ export default { const cid = this.courseId const assessmentId = this.assessmentId let points = [] - if (pId) { + if (pId && cache.judgmentIdList) { cache.judgmentIdList.map(e => { points.push({ judgmentId: e @@ -310,7 +310,7 @@ export default { // 如果有缓存代码 if (code) { hasCache = 1 - if (!newJudgmentId) newJudgmentId = i + if (newJudgmentId === '') newJudgmentId = i e.code = code } resolve() @@ -329,7 +329,6 @@ export default { }).then(() => { localStorage.removeItem('codeCache') // 恢复代码后清除本地缓存 this.projectId = projectId - // this.judgmentId = newJudgmentId // 如果是本地缓存里有项目id,则要再次获取项目详情,取判分列表再次赋值;本地没有缓存则取只恢复第一个判分点的代码 if (pId) { this.getProDetail().then(() => { diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index d9a35ae..9311b0e 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -308,16 +308,18 @@ export default { this.$emit('update:codeId', res.codeId) // 更新coddeId this.$emit('update:answer', result) // 更新运行结果 let imgList = '' + let firtImg = '' try { imgList = eval(result) } catch (error) {} + if (imgList.length) firtImg = imgList[0] // 如果是下载图片的代码,则要显示图片和运行结果,不用显示对错,换成显示下载图片 if (photo) { this.isError = '' // 对错隐藏 const text = result.replace(photo, '') // 结果里包含了图片路径,所以要把图片路径给去掉 this.runResult = text this.picSrc = photo - } else if (imgList instanceof Array && imgList.length && (imgList[0].includes('.jpg') || imgList[0].includes('.png') || imgList[0].includes('img'))) { + } else if (imgList instanceof Array && imgList.length && typeof firtImg === 'string' && (firtImg.includes('.jpg') || firtImg.includes('.png') || firtImg.includes('img'))) { /** * 这段是为要下载图片的项目案例写的,后端会返回图片名称的数组,前端负责循环这个数组,然后下载下来 * 只有该系统有这段代码,因为其他7个系统没有下载图片的项目,后续如果加了,直接把这段代码复制过去即可 diff --git a/src/views/Home.vue b/src/views/Home.vue index 0b0302a..2ef2005 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -122,9 +122,11 @@ export default { }, // 判分规则切换 judChange() { - const code = this.$refs['code' + this.curTab][0].$refs.codemirror.codemirror - code.focus() - code.setCursor(code.lineCount(), 0) + this.$nextTick(_ => { + const code = this.$refs['code' + this.curTab][0].$refs.codemirror.codemirror // 获取codemirror实例 + code.focus() // 编辑器聚焦 + code.setCursor(code.lineCount(), 0) // 焦点移动至最后面 + }) }, // 重置编辑器 recoveryCode(curTab = '0'){