From ca1a111524ee5b2829a6fa8320d9a01691078569 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 3 Aug 2023 18:13:22 +0800 Subject: [PATCH] fix --- src/components/TestPanel.vue | 23 +++++++++++++++++++---- src/components/codemirror.vue | 17 +++++++++++------ src/config/index.js | 5 +++-- src/store/index.js | 6 +++++- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index e4ff4a7..0af8900 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -278,6 +278,7 @@ export default { resultsDetails: Cookie.get('admin-resultsDetails'), resultAnnouncementTime: Cookie.get('admin-resultAnnouncementTime'), curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 + fromManager: Cookie.get('admin-fromManager'), // 是否是从教师端进入 curSystemId: 1, projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) isSubmit: Cookie.get('admin-isSubmit') == 'true' ? true : false, // 是否提交的标识 @@ -381,6 +382,7 @@ export default { let data = { systemId: this.systemId, cId: this.courseId, // 课程id + mallId: this.mallId, permissions: this.projectPermissions // 练习/考核/竞赛 } return new Promise((resolve, reject) => { @@ -444,8 +446,7 @@ export default { }) this.reportPoints = reportPoints if (points.length) this.reportTab = reportPoints[0].judgmentId + '' - console.log("🚀 ~ file: TestPanel.vue:423 ~ returnnewPromise ~ this.reportTab:", points, this.reportTab) - this.taskList = points // 实验任务 + this.taskList = this.isSubmit ? this.$store.state.taskList : points // 实验任务 this.judgmentId = points[0].judgmentId // 默认取第一个判分点 this.experimentTarget = project.experimentTarget this.experimentDescription = project.experimentDescription @@ -675,7 +676,20 @@ export default { // 查看实验报告 toReport () { Cookie.set('doneProjectId', this.projectId) // 进入实验报告之前先存储当前项目id,从实验报告返回来后把这个id恢复 - this.$router.push(`/report?reportId=${this.$store.state.reportId}`) + const { reportId } = this.$store.state + // 老师端进来的,直接跳转到实验报告,学生端进来的,跳转到实验记录里的实验报告 + if (this.fromManager) { + this.$router.push(`/report?reportId=${reportId}`) + } else { + let href = location.origin + if (!this.$config.isPro && !this.$config.isZxy) href += '/student' + href += `/#/record/show?python=1&reportId=${reportId}` + // 练习 + if (this.projectPermissions == 0) { + href += `&curriculumId=${this.courseId}&projectId=${this.projectId}` + } + location.href = href + } }, //重新开始 reload () { @@ -811,7 +825,7 @@ export default { clearInterval(this.statusTimer) this.reportVisible = false let list = retInfo - let taskList = this.taskList + let { taskList } = this let score = 0 // 给判分列表添加分数和运行结果 taskList.map(e => { @@ -827,6 +841,7 @@ export default { this.grade = util.handleZero(score) // 前置加0(竞赛不显示分数) this.reportId = reportId this.$store.commit('setReportId', reportId) + this.$store.commit('setTaskList', taskList) this.editReport(reportId) // 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 this.competitionId && this.resultsDetails == 0 && this.$alert('提交成功,成绩将在' + this.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看', '提示', { diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index 23a1e4a..3dd26f0 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -532,7 +532,6 @@ export default { } else if (imgList instanceof Array && imgList.length && typeof firtImg === 'string' && (firtImg.includes('.jpg') || firtImg.includes('.png') || firtImg.includes('img'))) { /** * 这段是为要下载图片的项目案例写的,后端会返回图片名称的数组,前端负责循环这个数组,然后下载下来 - * 只有该系统有这段代码,因为其他7个系统没有下载图片的项目,后续如果加了,直接把这段代码复制过去即可 */ imgList.map((n, i) => { util.downloadFile(`${i + 1}.jpg`, n) @@ -567,9 +566,13 @@ export default { }, // 导出运行结果 exportResult () { + let str = this.runResult + // this.picSrcList.forEach(e => { + // str += `` + // }) var FileSaver = require('file-saver'); - var blob = new Blob([this.runResult], { type: "text/plain;charset=utf-8" }); - FileSaver.saveAs(blob, 'result.csv') + var blob = new Blob([str], { type: "text/plain;charset=utf-8" }); + FileSaver.saveAs(blob, 'result.docx') }, // 获取正式答案 getTips () { @@ -732,7 +735,7 @@ export default { margin: 10px; position: absolute; width: calc(100% - 14px); - height: calc(100vh - 340px); + height: calc(100vh - 387px); overflow: auto; } .pic-num0 { @@ -746,7 +749,7 @@ export default { position: absolute; left: 0; right: 0; - bottom: 5px; + bottom: 60px; display: flex; max-width: calc(100% - 50px); margin: 0 auto; @@ -759,13 +762,15 @@ export default { margin: 0 5px 5px; &:only-child { .pic { - width: 80%; + width: 50%; + max-height: none; } } } .pic { display: block; width: 100px; + max-height: 100px; margin: 0 auto 10px; } } diff --git a/src/config/index.js b/src/config/index.js index 9e82727..1e7ceee 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -5,7 +5,7 @@ const isDev = process.env.NODE_ENV === 'development' //是否本地 const isHh = url.includes('10.196.131.73') //是否是河海版本 const isPro = url.includes('occupationlab.com') //是否职站生产 const isZxy = url.includes('izhixinyun.com') //是否智信云 -let vscodeUrl = 'https://vscode.izhixinyun.com' +let vscodeUrl = 'http://121.37.12.51:8088/?folder=/home/coder' let host = location.origin + '/' let bankPath = `${location.origin}/banksystem` // 银行系统 // 121.37.12.51 | 192.168.31.151 @@ -15,11 +15,12 @@ if (isDev) { host = 'http://121.37.12.51:9000/' // host = 'https://occupationlab.com/' bankPath = `http://${location.hostname}:8093` - vscodeUrl = 'http://121.37.12.51:8088/?folder=/home/coder' } else if (isPro) { host = 'https://occupationlab.com/' bankPath = `https://www.huorantech.cn/banksystem` vscodeUrl = 'https://vscode.occupationlab.com/' +} else if (isZxy) { + vscodeUrl = 'https://vscode.izhixinyun.com' } const systemId = Cookie.get('admin-systemId') export default { diff --git a/src/store/index.js b/src/store/index.js index ea9df33..c13185e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,7 +4,8 @@ Vue.use(Vuex); const store = new Vuex.Store({ state: { language: 0, - reportId: '' + reportId: '', + taskList: [] }, mutations: { setLanguage: (state, id) => { @@ -13,6 +14,9 @@ const store = new Vuex.Store({ setReportId: (state, id) => { state.reportId = id }, + setTaskList: (state, taskList) => { + state.taskList = taskList + }, } }); export default store; \ No newline at end of file