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 @@