From 5342a2809a2a45d17b6196600de0bb2d842e30ba Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 19 Jan 2024 11:31:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BB=A3=E7=A0=81=E5=8F=8A?= =?UTF-8?q?=E8=80=83=E6=A0=B8=E5=A4=A7=E8=B5=9B=E6=97=B6=E9=97=B4=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 4 + src/components/TestPanel.vue | 45 ++++++--- src/components/codemirror.vue | 179 ++++++++++++++++++++++++++++------ src/config/index.js | 1 - src/main.js | 12 +-- src/styles/theme/theme9.scss | 8 +- 6 files changed, 195 insertions(+), 54 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 35f7b86..152c14d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -39,4 +39,8 @@ export default { modelClassListByStudent: `nakadai/nakadai/model/student/modelClassListByStudent`, studentModelListBySystem: `nakadai/nakadai/model/student/studentModelListBySystem`, detailsOfGoods: `nakadai/mall/detailsOfGoods`, + importCode: `occupationlab/occupationlab/experimentalReport/importCode`, + removeImport: `occupationlab/occupationlab/experimentalReport/removeImport`, + saveStartTime: `python/python/saveStartTime`, + getProductSystemTheme: `nakadai/mall/getProductSystemTheme`, } \ No newline at end of file diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index db10098..0493950 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -405,14 +405,27 @@ export default { mavonEditor }, mounted () { - this.getNow().then(now => { - this.entryTime = now + this.init() + }, + methods: { + // 初始化 + async init () { // 2:竞赛,1:考核,0:练习 this.projectPermissions = this.assessmentId ? 1 : this.competitionId ? 2 : 0 + + let now + if (!this.projectPermissions) { + now = await this.getNow() + } else { + now = await this.getSumTime() // 考核、赛事获取第一次进入系统的时间,练习不需要 + if (!now) now = await this.getNow() + } + + this.entryTime = now if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId) this.getAssList() } else { // 练习 @@ -435,9 +448,7 @@ export default { this.getUserDetail() this.drag() this.tableHeight = window.innerHeight - 360 - }) - }, - methods: { + }, // 获取项目列表 getList () { let data = { @@ -468,7 +479,7 @@ export default { this.$get(this.api.getProjectDetail, { projectId, stuAssessent: 1 - }).then(res => { + }).then(async (res) => { const points = res.projectJudgmentVos const project = res.projectManage const curReq = [] @@ -515,14 +526,14 @@ export default { this.experimentHint = project.experimentHint this.hintOpen = project.founder ? !project.hintOpenBySchool : !project.hintOpen // 0显示,1不显示,系统跟老师的禁用字段不一样 this.$emit('tell', projectId, systemId, this.points) + // this.getSumTime() const isPrac = this.projectPermissions == 0 // 是否是练习 this.text = isPrac ? '已用' : '剩余' // 竞赛不需要 if (!this.competitionId) { - this.getNow().then(now => { - this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 - this.startCount() - }) + const now = await this.getNow() + this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 如果是考核,取考核的结束时间减去当前时间去做倒计时,练习则直接给0做计时 + this.startCount() } resolve() }).catch(err => { @@ -531,6 +542,16 @@ export default { }) }, // 获取当前时间 + getSumTime () { + return new Promise(async (resolve, reject) => { + const res = await this.$get(this.api.getStartTime, { + permissions: this.projectPermissions, + projectId: this.projectId + }) + resolve(res.startTime ? new Date(res.startTime) : '') + }) + }, + // 获取当前时间 getNow () { return new Promise(async (resolve, reject) => { const res = await this.$get(this.api.getCurrentTime) @@ -879,11 +900,13 @@ export default { const attributesReqList = [] pointList.map(e => { attributesReqList.push({ + code: e.code, codeId: e.codeId, bcId: e.judgmentId, isSubmit: e.codeId ? 1 : 0, answer: e.answer, - retResult: e.retResult + retResult: e.retResult, + judgmentName: e.name }) }) const data = { diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index b99fbdc..7cdc891 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -9,11 +9,12 @@