countdown more places

This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-24 11:08:34 +01:00
parent 08af1e8825
commit 86baef131f
4 changed files with 67 additions and 11 deletions

View File

@@ -2,16 +2,14 @@
<div class="container"> <div class="container">
<banner /> <banner />
<router-view /> <router-view />
<Countdown />
</div> </div>
</template> </template>
<script> <script>
import banner from "@/ui/Banner"; import banner from "@/ui/Banner";
import Countdown from "@/ui/Countdown";
export default { export default {
name: "vinlottis", name: "vinlottis",
components: { banner, Countdown }, components: { banner },
props: {}, props: {},
data() { data() {
return {}; return {};

View File

@@ -1,7 +1,9 @@
<template> <template>
<div class="container"> <div class="container">
<h1 class="title">Loddgenerator</h1> <h1 class="title" @click="startCountdown">Loddgenerator</h1>
<p class="subtext">Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'</p> <p class="subtext">
Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'
</p>
<div class="input-line"> <div class="input-line">
<label for="redCheckbox"> <label for="redCheckbox">
<input type="checkbox" id="redCheckbox" v-model="redCheckbox" /> <input type="checkbox" id="redCheckbox" v-model="redCheckbox" />
@@ -52,6 +54,7 @@
</div> </div>
<Vipps class="vipps" /> <Vipps class="vipps" />
<Countdown :hardEnable="hardStart" @countdown="changeEnabled" />
</div> </div>
</template> </template>
@@ -59,11 +62,13 @@
import { page, event } from "vue-analytics"; import { page, event } from "vue-analytics";
import Vipps from "@/ui/Vipps"; import Vipps from "@/ui/Vipps";
import Banner from "@/ui/Banner"; import Banner from "@/ui/Banner";
import Countdown from "@/ui/Countdown";
export default { export default {
components: { components: {
Banner, Banner,
Vipps Vipps,
Countdown
}, },
data() { data() {
return { return {
@@ -77,7 +82,8 @@ export default {
redCheckbox: true, redCheckbox: true,
greenCheckbox: true, greenCheckbox: true,
yellowCheckbox: true, yellowCheckbox: true,
blueCheckbox: true blueCheckbox: true,
hardStart: false
}; };
}, },
watch: { watch: {
@@ -92,10 +98,16 @@ export default {
this.track(); this.track();
}, },
methods: { methods: {
changeEnabled: function(way) {
this.hardStart = way;
},
startCountdown: function() {
this.hardStart = true;
},
generateColors: function(event, time) { generateColors: function(event, time) {
if (time == 5) { if (time == 5) {
if (this.numberOfBallots > 1 && new Set(this.colors).size == 1) { if (this.numberOfBallots > 1 && new Set(this.colors).size == 1) {
alert('BINGO') alert("BINGO");
} }
if (window.location.hostname == "localhost") { if (window.location.hostname == "localhost") {
@@ -187,7 +199,9 @@ export default {
@import "../styles/variables.scss"; @import "../styles/variables.scss";
@import "../styles/global.scss"; @import "../styles/global.scss";
@import "../styles/media-queries.scss"; @import "../styles/media-queries.scss";
h1 {
cursor: pointer;
}
.vipps { .vipps {
margin: 20px auto auto auto; margin: 20px auto auto auto;
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="outer"> <div class="outer">
<div class="container"> <div class="container">
<h1 class="title">Vinlotteri</h1> <h1 class="title" @click="startCountdown">Vinlotteri</h1>
<router-link to="generate" class="generate-link"> <router-link to="generate" class="generate-link">
Klarer du ikke velge lodd-farger? Klarer du ikke velge lodd-farger?
<span class="subtext generator-link">Prøv loddgeneratoren</span> <span class="subtext generator-link">Prøv loddgeneratoren</span>
@@ -24,6 +24,7 @@
</div> </div>
</div> </div>
</div> </div>
<Countdown :hardEnable="hardStart" @countdown="changeEnabled" />
</div> </div>
</template> </template>
@@ -36,6 +37,7 @@ import WinGraph from "@/ui/WinGraph";
import Banner from "@/ui/Banner"; import Banner from "@/ui/Banner";
import Wines from "@/ui/Wines"; import Wines from "@/ui/Wines";
import Vipps from "@/ui/Vipps"; import Vipps from "@/ui/Vipps";
import Countdown from "@/ui/Countdown";
export default { export default {
components: { components: {
@@ -45,7 +47,13 @@ export default {
WinGraph, WinGraph,
Banner, Banner,
Wines, Wines,
Vipps Vipps,
Countdown
},
data() {
return {
hardStart: false
};
}, },
mounted() { mounted() {
if (window.location.hostname == "localhost") { if (window.location.hostname == "localhost") {
@@ -54,8 +62,14 @@ export default {
this.track(); this.track();
}, },
methods: { methods: {
changeEnabled(way) {
this.hardStart = way;
},
track() { track() {
this.$ga.page("/"); this.$ga.page("/");
},
startCountdown() {
this.hardStart = true;
} }
} }
}; };
@@ -75,6 +89,10 @@ export default {
padding: 0 25px; padding: 0 25px;
} }
.title {
cursor: pointer;
}
.left-bottom { .left-bottom {
width: 75%; width: 75%;

View File

@@ -16,6 +16,12 @@
<script> <script>
export default { export default {
props: {
hardEnable: {
type: Boolean,
required: false
}
},
data() { data() {
return { return {
nextLottery: null, nextLottery: null,
@@ -30,6 +36,15 @@ export default {
interval: null interval: null
}; };
}, },
watch: {
hardEnable: function(hardEnable) {
if (hardEnable) {
this.enabled = true;
this.initialize();
this.countdown();
}
}
},
mounted() { mounted() {
window.addEventListener("keydown", this.listenerFunction); window.addEventListener("keydown", this.listenerFunction);
}, },
@@ -74,6 +89,7 @@ export default {
this.enabled = false; this.enabled = false;
document.querySelector("body").style.overflow = "auto"; document.querySelector("body").style.overflow = "auto";
document.querySelector("body").style.height = "initial"; document.querySelector("body").style.height = "initial";
this.$emit("countdown", false);
}, },
countdown: function() { countdown: function() {
// Get today's date and time // Get today's date and time
@@ -103,6 +119,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../styles/media-queries.scss";
.clock { .clock {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
@@ -110,6 +127,11 @@ export default {
background: white; background: white;
top: 0; top: 0;
left: 0; left: 0;
@include mobile {
width: 105vw;
height: 110vh;
}
} }
.cross { .cross {
top: 15px; top: 15px;
@@ -117,6 +139,10 @@ export default {
font-size: 2rem; font-size: 2rem;
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
@include mobile {
right: 45px;
}
} }
h2 { h2 {