20240205
e 3 years ago
parent 25d2bde53f
commit 64a2057423
  1. 89
      src/components/case/index.vue
  2. 7
      src/pages/index/list/index.vue

@ -184,6 +184,7 @@ export default {
loading:false, loading:false,
sss:1, sss:1,
popContainer:false, popContainer:false,
timestamp:'',
} }
}, },
watch: { watch: {
@ -243,6 +244,13 @@ export default {
let projectId = this.getQueryVariable('projectId') let projectId = this.getQueryVariable('projectId')
let assessmentId = this.getQueryVariable('assessmentId') let assessmentId = this.getQueryVariable('assessmentId')
let classId = this.getQueryVariable('classId') let classId = this.getQueryVariable('classId')
let stopTime = this.getQueryVariable('stopTime')
let timestamp = +stopTime;
if (timestamp != null){
sessionStorage.setItem('timestamp', timestamp)
}else{
sessionStorage.setItem('timestamp', null)
}
if (token != null){ if (token != null){
sessionStorage.setItem('token', token) sessionStorage.setItem('token', token)
sessionStorage.setItem('cid', cid) sessionStorage.setItem('cid', cid)
@ -379,14 +387,16 @@ export default {
getProjectDetail(params).then((data)=>{ getProjectDetail(params).then((data)=>{
if(data.status == 200){ if(data.status == 200){
this.globalTimer = ""; this.globalTimer = "";
this.countVal = ""; let stopTime = sessionStorage.getItem('timestamp')
this.day = "00"; let timestamp = +stopTime;
this.seconds = "00"; this.countVal = timestamp;
this.minutes = "00"; // this.day = "00";
this.hour = "00"; // this.seconds = "00";
// this.minutes = "00";
// this.hour = "00";
this.sss = 1; this.sss = 1;
this.hintOpen = data.data.projectManage.hintOpen this.hintOpen = data.data.projectManage.hintOpen;
this.startCountFn(); this.countDown(timestamp);
let projectId = this.getQueryVariable('projectId') let projectId = this.getQueryVariable('projectId')
if(projectId != null){ if(projectId != null){
// //
@ -511,14 +521,17 @@ export default {
}); });
}); });
}, },
//
//
startCountFn() { startCountFn() {
if (!this.isStart) { if (!this.isStart) {
this.countVal = this.countVal ? this.countVal : 0; // this.countVal = this.countVal ? this.countVal : 0;
this.globalTimer = setInterval(() => { this.globalTimer = setInterval(() => {
if(this.sss == 0){ if(this.sss == 0){
this.globalTimer = null; this.globalTimer = null;
clearInterval(this.globalTimer); clearInterval(this.globalTimer);
}else if (this.timestamp){
this.counterFn(this.countVal--);
}else{ }else{
this.counterFn(this.countVal++); this.counterFn(this.countVal++);
} }
@ -526,22 +539,50 @@ export default {
this.isStart = true; this.isStart = true;
} }
}, },
//
countDown(timestamp){
this.timestamp = timestamp
console.log(this.timestamp)
this.sss = 1;
this.globalTimer = null;
clearInterval(this.globalTimer);
this.startCountFn()
},
counterFn(counterTime) { counterFn(counterTime) {
let leave1 = counterTime % (24 * 3600 * 1); // if (this.timestamp){
let leave2 = leave1 % (3600 * 1); // let countDown = (new Date(counterTime).getTime() - new Date().getTime()) / 1000
let leave3 = leave2 % (60 * 1); // if (countDown > 0) {
let day = Math.floor(counterTime / (24 * 3600 * 1)); // let d = Math.floor(countDown / (60 * 60 * 24));
let hour = Math.floor(leave1 / (3600 * 1)); // let h = Math.floor(countDown / (60 * 60));
let minutes = Math.floor(leave2 / (60 * 1)); // let m = Math.floor(countDown % (60 * 60) / 60);
let seconds = Math.round(leave3 / 1); // let s = Math.floor(countDown % (60 * 60) % 60);
day = day >= 10 ? day : "0" + day; this.day = `${d > 9 ? d : `0${d}`}`;
hour = hour >= 10 ? hour : "0" + hour; this.hour = `${h > 9 ? h : `0${h}`}`;
minutes = minutes >= 10 ? minutes : "0" + minutes; this.minutes = `${m > 9 ? m : `0${m}`}`;
seconds = seconds >= 10 ? seconds : "0" + seconds; this.seconds = `${s > 9 ? s : `0${s}`}`;
this.day = day; } else {
this.hour = hour; this.day = '00';
this.minutes = minutes; this.hour = '00';
this.seconds = seconds; this.minutes = '00';
this.seconds = '00';
}
}else{
let leave1 = counterTime % (24 * 3600 * 1); //
let leave2 = leave1 % (3600 * 1); //
let leave3 = leave2 % (60 * 1); //
let day = Math.floor(counterTime / (24 * 3600 * 1)); //
let hour = Math.floor(leave1 / (3600 * 1)); //
let minutes = Math.floor(leave2 / (60 * 1)); //
let seconds = Math.round(leave3 / 1); //
day = day >= 10 ? day : "0" + day;
hour = hour >= 10 ? hour : "0" + hour;
minutes = minutes >= 10 ? minutes : "0" + minutes;
seconds = seconds >= 10 ? seconds : "0" + seconds;
this.day = day;
this.hour = hour;
this.minutes = minutes;
this.seconds = seconds;
}
}, },
// //
reload() { reload() {

@ -40,11 +40,18 @@ export default {
let token = this.getQueryVariable('token') let token = this.getQueryVariable('token')
let cid = this.getQueryVariable('cid') let cid = this.getQueryVariable('cid')
let systemId = this.getQueryVariable('systemId') let systemId = this.getQueryVariable('systemId')
let stopTime = this.getQueryVariable('stopTime')
let timestamp =+stopTime;
if (token != null){ if (token != null){
sessionStorage.setItem('token', token) sessionStorage.setItem('token', token)
sessionStorage.setItem('cid', cid) sessionStorage.setItem('cid', cid)
sessionStorage.setItem('systemId', systemId) sessionStorage.setItem('systemId', systemId)
} }
if (timestamp != null){
sessionStorage.setItem('timestamp', timestamp)
}else{
sessionStorage.setItem('timestamp', null)
}
}, },
methods: { methods: {
getQueryVariable(name) { getQueryVariable(name) {

Loading…
Cancel
Save