From d3ba026dc641b39a65be0f270448582e228b0d26 Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Thu, 18 Nov 2021 17:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/case/index.vue | 264 +++++++++++++------------------ src/pages/counter/list/index.vue | 1 - 2 files changed, 112 insertions(+), 153 deletions(-) diff --git a/src/components/case/index.vue b/src/components/case/index.vue index 6173785..b8863de 100644 --- a/src/components/case/index.vue +++ b/src/components/case/index.vue @@ -168,6 +168,7 @@ export default { courseId: "", // projectId: "", assessmentId: "", + classId:'', projectPermissions: 0, //项目权限(0、练习 1、考核 2、竞赛) isSubmit: false, entryTime: util.formatDate('yyyy-MM-dd hh:mm:ss'), @@ -240,11 +241,22 @@ export default { let cid = this.getQueryVariable('cid') let systemId = this.getQueryVariable('systemId') let projectId = this.getQueryVariable('projectId') + let assessmentId = this.getQueryVariable('assessmentId') + let classId = this.getQueryVariable('classId') if (token != null){ sessionStorage.setItem('token', token) sessionStorage.setItem('cid', cid) sessionStorage.setItem('systemId', systemId) + } + if (projectId){ sessionStorage.setItem('projectId', projectId) + sessionStorage.setItem('assessmentId', assessmentId) + sessionStorage.setItem('classId', classId) + this.assessmentId = assessmentId + this.classId = classId + }else{ + this.assessmentId = '' + this.classId = '' } let tokens = sessionStorage.getItem('token') if(tokens || token){ @@ -277,126 +289,110 @@ export default { //获取项目列表 getData(){ let params = { - systemId:sessionStorage.getItem('systemId'), + "systemId":sessionStorage.getItem('systemId'), + "cId":sessionStorage.getItem('cid'), "permissions":0, } getProjectBySystemId(params).then((data)=>{ if(data.status == 200){ - let dates = new Date().getTime(); - let date = new Date(dates) - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - let startTime = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; - sessionStorage.setItem('startTime', startTime) - this.topicList = data.data.projects; - if(this.topicList.length > 0){ - let projectId = this.getQueryVariable('projectId') - if(projectId){ - this.projectId = projectId - }else{ - this.projectId = this.topicList[0].projectId; + //获取当前时间 + this.getBeginTime() + this.topicList = [] + for (var i=0;i{ - if(data.data.status == 200){ - this.$confirm('有项目未做完,是否回到未做完的项目?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.$message({ - type: 'success', - message: '切换成功!' - }); - this.projectId=data.data.projectId - let params = { - "projectId":data.data.projectId, - } - sessionStorage.setItem('projectId', data.data.projectId) - this.selectProjects(params) - }).catch(() => { - deleteCache().then((data)=>{ - this.$message({ - type: 'info', - message: '已取消' - }); - }).catch(() => { - - }) - let projectId = this.getQueryVariable('projectId') - if(projectId){ - this.projectId = projectId - }else{ - this.projectId = this.topicList[0].projectId; - } - sessionStorage.setItem('projectId', this.projectId) - let params = { - "projectId":this.projectId, - } - this.selectProjects(params) - }); - }else{ - let projectId = this.getQueryVariable('projectId') - if(projectId){ - this.projectId = projectId - }else{ - this.projectId = this.topicList[0].projectId; - } - sessionStorage.setItem('projectId', this.projectId) - let params = { - "projectId":this.projectId, - } - this.selectProjects(params) - } - }).catch((error)=>{ - }) - //获取当前时间 - this.globalTimer = ""; - this.countVal = ""; - this.day = "00"; - this.seconds = "00"; - this.minutes = "00"; - this.hour = "00"; - // this.getClearTime(); - this.sss = 1 - this.startCountFn(); + if(this.topicList.length > 0){ + this.gotuQueryVariable() + } + this.getQueryCaches() } }).catch((error)=>{ }) }, + getBeginTime(){ + let dates = new Date().getTime(); + let date = new Date(dates) + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? ('0' + MM) : MM; + let d = date.getDate(); + d = d < 10 ? ('0' + d) : d; + let h = date.getHours(); + h = h < 10 ? ('0' + h) : h; + let m = date.getMinutes(); + m = m < 10 ? ('0' + m) : m; + let s = date.getSeconds(); + s = s < 10 ? ('0' + s) : s; + this.startTime = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; + sessionStorage.setItem('startTime', this.startTime) + }, + getQueryCaches(){ + getQueryCache(params).then((data)=>{ + if(data.data.status == 200){ + this.$confirm('有项目未做完,是否回到未做完的项目?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$message({ + type: 'success', + message: '切换成功!' + }); + this.projectId=data.data.projectId + let params = { + "projectId":data.data.projectId, + } + sessionStorage.setItem('projectId', data.data.projectId) + this.selectProjects(params) + }).catch(() => { + deleteCache().then((data)=>{ + this.$message({ + type: 'info', + message: '已取消' + }); + }).catch(() => { + }) + this.gotuQueryVariable() + }); + }else{ + this.gotuQueryVariable() + } + }).catch((error)=>{ + this.gotuQueryVariable() + }) + }, + gotuQueryVariable(){ + let projectId = this.getQueryVariable('projectId') + if(projectId){ + this.projectId = projectId + }else{ + this.projectId = this.topicList[0].projectId; + } + sessionStorage.setItem('projectId', this.projectId) + let params = { + "projectId":this.projectId, + } + this.selectProjects(params) + }, selectProjects(params){ getProjectDetail(params).then((data)=>{ if(data.status == 200){ + this.globalTimer = ""; + this.countVal = ""; + this.day = "00"; + this.seconds = "00"; + this.minutes = "00"; + this.hour = "00"; + this.sss = 1 + this.startCountFn(); let projectId = this.getQueryVariable('projectId') if(projectId != null){ - let dates = new Date().getTime(); - let date = new Date(dates) - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - let startTime = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; - sessionStorage.setItem('startTime', startTime) + //获取当前时间 + this.getBeginTime() this.topicList = [data.data.projectManage]; this.projectId = +params.projectId - console.log(this.projectId) - console.log(this.topicList) this.projectName = data.data.projectManage.projectName this.projectManage = data.data.projectManage; this.requires = data.data.projectJudgmentVos; @@ -430,34 +426,18 @@ export default { }).catch((error)=>{ }) //获取当前时间 - let dates = new Date().getTime(); - let date = new Date(dates) - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - let startTime = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; - sessionStorage.setItem('startTime', startTime) + this.getBeginTime() this.globalTimer = ""; this.countVal = ""; this.day = "00"; this.seconds = "00"; this.minutes = "00"; this.hour = "00"; - // this.getClearTime(); this.sss = 1 this.startCountFn(); }, //提交 Submit() { - // if(!this.codeIds.length) return this.$message.error('请先完成实验') this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -475,16 +455,18 @@ export default { let systemId = sessionStorage.getItem('systemId') let cid = sessionStorage.getItem('cid') let params = { - "curriculumId":+cid, - "endTime": this.actEndTime, - "lcId": lcld, - "projectId": this.projectId, - "projectName":this.projectName, - "purpose":this.projectManage.experimentTarget, - "ruleReqs": ruleReqsList, - "startTime": startTime, - "submitTime": this.actEndTime, - "systemId": systemId, + "assessmentId":this.assessmentId, + "classId":this.classId, + "curriculumId":+cid, + "endTime": this.actEndTime, + "lcId": lcld, + "projectId": this.projectId, + "projectName":this.projectName, + "purpose":this.projectManage.experimentTarget, + "ruleReqs": ruleReqsList, + "startTime": startTime, + "submitTime": this.actEndTime, + "systemId": systemId, } this.loading = true; submit(params).then((data)=>{ @@ -507,11 +489,6 @@ export default { } this.sss = 0; this.popContainer = true; - // this.countVal = ""; - // this.day = "00"; - // this.seconds = "00"; - // this.minutes = "00"; - // this.hour = "00"; this.$message({ type: 'success', message: '提交成功' @@ -522,7 +499,6 @@ export default { }).catch((error)=>{ this.loading = false }) - // this.getClearTime(); }).catch(() => { this.$message({ type: "info", @@ -541,7 +517,6 @@ export default { }else{ this.counterFn(this.countVal++); } - }, 1000); this.isStart = true; } @@ -590,13 +565,7 @@ export default { this.grade = '00' location.href = 'http://39.108.250.202/banksystem/#/index/list?'+'token='+token+'&cid='+cid+'&systemId='+systemId // location.href = "http://192.168.31.254:8093/#/index/list?"+'token='+token+'&cid='+cid+'&systemId='+systemId - - // this.getClearTime() }, - // 清除时间 - // getClearTime() { - // - // }, checkVer() { let data = { userId: this.userId, @@ -605,7 +574,6 @@ export default { this.$get(this.api.qualifications,data).then(res => { if(res.message == 'false'){ this.isSubmit = true; - // newmain.$emit("isSubmit", this.isSubmit); } }); }, @@ -616,12 +584,6 @@ export default { toggleCase() { this.caseVisible = !this.caseVisible }, - // getProjects(){ - // let data = { - // systemId: this.systemId, - // schoolId: '' - // } - // }, collapse(){ }, @@ -632,13 +594,11 @@ export default { //获取cookie中指定key的value var allcookies = document.cookie; //索引长度,开始索引的位置 var cookie_pos = allcookies.indexOf(cookie_name); // 如果找到了索引,就代表cookie存在,否则不存在 - if (cookie_pos != -1) { // 把cookie_pos放在值的开始,只要给值加1即可 //计算取cookie值得开始索引,加的1为“=” cookie_pos = cookie_pos + cookie_name.length + 1; //计算取cookie值得结束索引 var cookie_end = allcookies.indexOf(";", cookie_pos); - if (cookie_end == -1) { cookie_end = allcookies.length; } //得到想要的cookie的值 diff --git a/src/pages/counter/list/index.vue b/src/pages/counter/list/index.vue index c6d6b03..3162e7c 100644 --- a/src/pages/counter/list/index.vue +++ b/src/pages/counter/list/index.vue @@ -217,7 +217,6 @@ export default { callback(new Error('请再次输入密码')); } else if (value.length == 6) { if(value !== this.passwordForm.password){ - console.log('=========') callback(new Error('两次输入密码不一致!')); } } else {