Browse Source

Sincronização dos cronometros e conserto do cronometro do painel

Websocket_painel
AlGouvea 3 years ago
parent
commit
186e909e0a
  1. 16
      frontend/src/__apps/painel/main.js
  2. 2
      sapl/templates/sessao/painel.html

16
frontend/src/__apps/painel/main.js

@ -196,12 +196,7 @@ const v = new Vue({ // eslint-disable-line
this.running = 0 this.running = 0
clearInterval(this.started) clearInterval(this.started)
this.stopped = setInterval(() => { console.log(time)
this.timeStopped()
}, 100)
},
timeStopped () {
timeEnd.setMilliseconds(timeEnd.getMilliseconds() + 100)
}, },
reset: function reset () { reset: function reset () {
this.running = 0 this.running = 0
@ -239,17 +234,20 @@ const v = new Vue({ // eslint-disable-line
crono = temp_crono crono = temp_crono
if (time === null) { if (time === null) {
time = cronometroStart[crono - 1] time = cronometroStart[crono - 1]
console.log(time)
timeEnd = new Date() timeEnd = new Date()
timeEnd.setSeconds(timeEnd.getSeconds() + time) timeEnd.setSeconds(timeEnd.getSeconds() + time)
console.log(timeEnd)
} else { } else {
clearInterval(this.stopped) timeEnd = new Date()
timeEnd.setMinutes(timeEnd.getMinutes() + time.getMinutes())
timeEnd.setSeconds(timeEnd.getSeconds() + time.getSeconds() + 1)
clearInterval(this.timeStopped)
} }
this.running = crono this.running = crono
this.started = setInterval(() => { this.started = setInterval(() => {
this.clockRunning(crono) this.clockRunning(crono)
}, 100) }, 50)
} }
}, },
created () { created () {

2
sapl/templates/sessao/painel.html

@ -113,7 +113,7 @@ $(function() {
$("#relogio").text(h+":"+m+":"+s) $("#relogio").text(h+":"+m+":"+s)
var t = setTimeout(function(){ var t = setTimeout(function(){
startTime() startTime()
},500); },100);
} }
startTime(); startTime();

Loading…
Cancel
Save