diff --git a/src/api/api.js b/src/api/api.js index 95597c7..ccda07c 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -2,10 +2,10 @@ import axios from 'axios'; import router from '../router'; // 创建axios实例 const service = axios.create({ - // baseURL: "http://39.108.250.202:9000/", // 中台测试服 + baseURL: "http://39.108.250.202:9000/", // 中台测试服 // baseURL: "http://192.168.31.137:9000/", // 赓 // baseURL: "http://192.168.31.151:9000/", // 榕 - baseURL: "http://192.168.31.125:9000/", // 坤 + // baseURL: "http://192.168.31.125:9000/", // 坤 // baseURL: 'http://39.108.250.202:9000', timeout: 30000 // 请求超时时间 }) diff --git a/src/components/case/index.vue b/src/components/case/index.vue index 1fd65d9..2b9a38f 100644 --- a/src/components/case/index.vue +++ b/src/components/case/index.vue @@ -37,7 +37,7 @@ v-show="projectPermissions == 0" @click="reload" >重新开始 - 提交 + 提交 @@ -64,9 +64,9 @@ - + - + @@ -179,6 +180,9 @@ export default { projectManage:{}, requires:[], projectName:'', + loading:false, + sss:1, + popContainer:false } }, watch: { @@ -241,14 +245,8 @@ export default { sessionStorage.setItem('systemId', systemId) } let tokens = sessionStorage.getItem('token') - console.log(tokens) - if(tokens){ + if(tokens || token){ this.projectPermissions = this.projectId ? 1 : 0 - if(this.projectId){ - this.getQueryProject(); - }else{ - this.getProjects(); - } this.assessmentId && this.projectId && this.checkVer() this.codeId && this.codeIds.push(this.codeId) this.getData() @@ -274,11 +272,26 @@ export default { } 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; this.projectId = this.topicList[0].projectId; getQueryCache(params).then((data)=>{ if(data.data.status == 200){ - this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { + this.$confirm('有项目未做完,是否回到未做完的项目?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -291,21 +304,6 @@ export default { let params = { "projectId":data.data.projectId, } - 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) sessionStorage.setItem('projectId', data.data.projectId) this.selectProjects(params) }).catch(() => { @@ -317,24 +315,31 @@ export default { }).catch(() => { }) + sessionStorage.setItem('projectId', this.topicList[0].projectId) + this.projectId = this.topicList[0].projectId let params = { - "projectId":this.projectId, + "projectId":this.topicList[0].projectId, } this.selectProjects(params) }); }else{ - + sessionStorage.setItem('projectId', this.topicList[0].projectId) + let params = { + "projectId":this.topicList[0].projectId, + } + this.selectProjects(params) } }).catch((error)=>{ }) //获取当前时间 - let startTime = new Date().getTime(); - sessionStorage.setItem('startTime', startTime) - this.day = '00'; - this.hour = '00'; - this.minutes = '00'; - this.seconds = '00'; - this.getClearTime(); + this.globalTimer = ""; + this.countVal = ""; + this.day = "00"; + this.seconds = "00"; + this.minutes = "00"; + this.hour = "00"; + // this.getClearTime(); + this.sss = 1 this.startCountFn(); } }).catch((error)=>{ @@ -358,14 +363,15 @@ export default { sessionStorage.setItem('projectId', this.projectId) getProjectDetail(params).then((data)=>{ if(data.status == 200){ + this.popContainer = false let token = sessionStorage.getItem('token') let cid = sessionStorage.getItem('cid') let systemId = sessionStorage.getItem('systemId') this.projectName = data.data.projectManage.projectName; this.projectManage = data.data.projectManage; this.requires = data.data.projectJudgmentVos; - // 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 + 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 } }).catch((error)=>{ }) @@ -385,11 +391,14 @@ export default { s = s < 10 ? ('0' + s) : s; let startTime = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; sessionStorage.setItem('startTime', startTime) - this.day = '00'; - this.hour = '00'; - this.minutes = '00'; - this.seconds = '00'; - this.getClearTime(); + this.globalTimer = ""; + this.countVal = ""; + this.day = "00"; + this.seconds = "00"; + this.minutes = "00"; + this.hour = "00"; + // this.getClearTime(); + this.sss = 1 this.startCountFn(); }, //提交 @@ -412,9 +421,6 @@ export default { let systemId = sessionStorage.getItem('systemId') let cid = sessionStorage.getItem('cid') let params = { - // "accountId": 0, - // "classId": 0, - // "className":0, "curriculumId":+cid, "endTime": this.actEndTime, "lcId": lcld, @@ -422,11 +428,11 @@ export default { "projectName":this.projectName, "purpose":this.projectManage.experimentTarget, "ruleReqs": ruleReqsList, - "startTime": +startTime, + "startTime": startTime, "submitTime": this.actEndTime, "systemId": systemId, - // "timeSum": 0 } + this.loading = true; submit(params).then((data)=>{ if(data.status == 200){ let datas= data.data.retMap.scoreInfo; @@ -445,12 +451,24 @@ 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: '提交成功' + }); this.requires = list } - console.log(this.requires) + this.loading = false }).catch((error)=>{ + this.loading = false }) - this.getClearTime(); + // this.getClearTime(); }).catch(() => { this.$message({ type: "info", @@ -462,10 +480,15 @@ export default { startCountFn() { if (!this.isStart) { this.countVal = this.countVal ? this.countVal : 0; - let timer = setInterval(() => { - this.counterFn(this.countVal++); + this.globalTimer = setInterval(() => { + if(this.sss == 0){ + this.globalTimer = null; + clearInterval(this.globalTimer); + }else{ + this.counterFn(this.countVal++); + } + }, 1000); - this.globalTimer = timer; this.isStart = true; } }, @@ -488,18 +511,38 @@ export default { }, //重新开始 reload() { - this.getClearTime() + let token = sessionStorage.getItem('token') + let cid = sessionStorage.getItem('cid') + let systemId = sessionStorage.getItem('systemId') + let projectId = sessionStorage.getItem('projectId') + let params = { + "projectId":projectId, + } + this.selectProjects(params) + this.popContainer = false + this.sss = 1 + this.startCountFn(); + deleteCache().then((data)=>{ + + }).catch(() => { + + }) + this.globalTimer = ""; + this.countVal = ""; + this.day = "00"; + this.seconds = "00"; + this.minutes = "00"; + this.hour = "00"; + 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() { - clearInterval(this.countVal); - this.globalTimer = ""; - this.countVal = ""; - this.day = "00"; - this.seconds = "00"; - this.minutes = "00"; - this.hour = "00"; - }, + // getClearTime() { + // + // }, checkVer() { let data = { userId: this.userId, @@ -519,97 +562,12 @@ export default { toggleCase() { this.caseVisible = !this.caseVisible }, - handleData(project,type){ - if(!this.isSelected){ - this.value = project; - this.projectId = project[0].projectId; - } - this.projectId = type == 2 ? project[0].projectId : this.projectId - if(type == 2) this.getQueryProject(0,1) - this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions - this.experimentalGoal = project[0].experimentalGoal; - this.caseDescription = project[0].caseDescription; - this.experimentSuggests = project[0].experimentSuggests; - this.actEndTime = project[0].endTime; - }, - getQueryProject(projectId,type) { - //项目名称+实验目标+案例描述+实验提示+实验要求 - this.$get(this.api.QueryProject, { - // studentId: 54, - // projectId: 305, - // assessmentId: 1, - studentId: this.studentId, - projectId: projectId ? projectId : this.projectId, - assessmentId: this.assessmentId - }).then(res => { - if(!type){ - this.handleData(res.message.project,1) - this.projectId = res.message.project[0].projectId - } - this.points = res.message.points; - this.tableData = res.message.points; - let arr1 = this.tableData; - let result1 = arr1.map(e => e.judgmentPointsId); - this.judgmentPointsIds = this.judgmentPointsIds.concat(result1); - this.isstartexperimentSuggests = !res.message.project[0].isstartexperimentSuggests //0显示,1不显示 - - if (this.projectPermissions == "1") { - this.text = "剩余"; - var interval = setInterval(() => { - // 获取当前时间,同时得到活动结束时间数组 - let newTime = new Date().getTime(); - // 对结束时间进行处理渲染到页面 - let endTime = new Date(this.actEndTime).getTime(); - let obj = null; // 如果活动未结束,对时间进行处理 - if (endTime - newTime > 0) { - let time = (endTime - newTime) / 1000; // 获取天、时、分、秒 - let day = parseInt(time / (60 * 60 * 24)); - let hou = parseInt((time % (60 * 60 * 24)) / 3600); - let min = parseInt(((time % (60 * 60 * 24)) % 3600) / 60); - let sec = parseInt(((time % (60 * 60 * 24)) % 3600) % 60); - obj = { - day: this.timeFormat(day), - hou: this.timeFormat(hou), - min: this.timeFormat(min), - sec: this.timeFormat(sec) - }; - } else { - // 活动已结束,全部设置为'00' - obj = { - day: "00", - hou: "00", - min: "00", - sec: "00" - }; - clearInterval(interval); - } - this.day = obj.day; - this.hour = obj.hou; - this.minutes = obj.min; - this.seconds = obj.sec; - }, 1000); - } else if (this.projectPermissions == "0") { - this.text = "已用"; - // 获取当前时间 - this.createTime = new Date().getTime(); - //自动开始 - if (this.autoStart) { - this.startCountFn(); - } - } - }) - .catch(err => {}); - }, - getProjects(){ - let data = { - systemId: this.systemId, - // schoolId: this.schoolId - schoolId: '' - } - // this.$get(`${this.api.queryTestProject}`,data).then(res => { - // this.handleData(res.message,2) - // }).catch(res => {}); - }, + // getProjects(){ + // let data = { + // systemId: this.systemId, + // schoolId: '' + // } + // }, collapse(){ }, @@ -639,6 +597,17 @@ export default {