added logic for get timetogame and object doubledata

This commit is contained in:
Kostya
2024-03-23 20:28:52 +03:00
parent fc4e3f460c
commit 407c535ee5

View File

@@ -6,6 +6,7 @@
<div class="bg-gradient-left"></div> <div class="bg-gradient-left"></div>
<section class="double"> <section class="double">
<h1>double</h1> <h1>double</h1>
<h2 v-if="timeToGame !== null">time to game - {{ timeToGame.toFixed(0) }}</h2>
<div class="jackpot-game"> <div class="jackpot-game">
<div class="bootstrap-wrapper"> <div class="bootstrap-wrapper">
<div class="container"> <div class="container">
@@ -63,11 +64,15 @@ export default {
}, },
setup() { setup() {
const slides = reactive([]) const slides = reactive([])
let doubleData = reactive({})
let autoPlay = ref(0) let autoPlay = ref(0)
let targetColor = ref('') let targetColor = ref('')
let timeToGame = ref(0)
let endGame = ref(false) let endGame = ref(false)
onMounted(() => { onMounted(() => {
if (slides.length == 0) {
for (let i = 1; i < 29; i++) { for (let i = 1; i < 29; i++) {
if (i === 15) { if (i === 15) {
slides.push({ slides.push({
@@ -92,18 +97,22 @@ export default {
} }
} }
} }
}
eventBus.on('doubleGame', (dataDouble) => { eventBus.on('doubleGame', (dataDouble) => {
const dataDoubleParse = JSON.parse(dataDouble) const dataDoubleParse = JSON.parse(dataDouble)
doubleData = Object.assign(doubleData, dataDoubleParse)
console.log(dataDoubleParse) console.log(dataDoubleParse)
timeToGame.value = doubleData.WaitingTime
if (dataDoubleParse.Status === 'InGame') { if (dataDoubleParse.Status === 'InGame') {
autoPlay.value = 500 autoPlay.value = 500
targetColor.value = dataDoubleParse.WInColor targetColor.value = dataDoubleParse.WInColor
} }
else if (dataDoubleParse.Status === 'GameEnd') { else if (dataDoubleParse.Status === 'GameEnd') {
endGame.value = true endGame.value = true
autoPlay.value = 200 autoPlay.value = 350
} }
}) })
}) })
@@ -126,7 +135,7 @@ export default {
autoPlay.value = 0; autoPlay.value = 0;
} }
return { slides, autoPlay, handleStepCarousel, stopAutoPlay, targetColor }; return { slides, autoPlay, doubleData, targetColor, timeToGame, handleStepCarousel, stopAutoPlay };
}, },
} }
</script> </script>