BuLi-Tipp weiter gemacht

This commit is contained in:
R40fendt
2025-05-05 16:22:47 +02:00
parent dfc0420121
commit 85db79ba5d
2 changed files with 40 additions and 22 deletions

View File

@@ -1,9 +1,9 @@
<script lang="ts">
<script lang="js">
export default {
props: {
users: {
type: Array<any>,
type: Array,
required: true,
},
spieltage: {
@@ -33,7 +33,7 @@ export default {
<td v-for="spieltag in spieltage[0]">{{ spieltag.user.name }}</td>
</tr>
<tr v-for="spieltag, i in spieltage">
<td>{{ i+1 }}</td>
<td>{{ parseInt(i)+1 }}</td>
<!-- Modal -->

View File

@@ -25,20 +25,23 @@ export default {
get(){
return fetch(RitzenbergenLib.api("/bulitipp/get-users.php"))
.then((response) => response.json())
.then((result2) => {
if(result2.reload) this.update();
return result2.data;
})
.then((result) => {
console.log(result);
console.log(this.spieltage);
result.forEach((user, i) => {
let sum = 0;
this.spieltage.forEach((spieltag) => {
let points = spieltag.find((element) => {
return element.user.id === user.id;
let sum = 0;
this.spieltage.forEach((spieltag) => {
let points = spieltag.find((element) => {
return element.user.id === user.id;
});
sum += points.points;
});
sum += points.points;
user.points = sum;
});
user.points = sum;
});
return result;
return result;
}).catch((error) => {
return null;
});
@@ -49,10 +52,22 @@ export default {
spieltage: {
get() {
return fetch(RitzenbergenLib.api("/bulitipp/ts.php"))
.then((response) => response.json());
.then((response) => response.json())
.then((result2) => {
if(result2.reload) this.update();
return result2.data;
});
},
default: []
}
},
saison:{
get(){
return fetch(RitzenbergenLib.api("/bulitipp/saison.php"))
.then((response) => response.text())
.then((result)=> parseInt(result));
},
default: ""
}
},
computed: {
@@ -185,9 +200,9 @@ export default {
];
},
loading(){
console.log(this.$asyncComputed.users);
return this.$asyncComputed.users.updating || this.$asyncComputed.spieltage.updating;
}
},
},
methods: {
gs(i) {
@@ -197,17 +212,21 @@ export default {
});
return result;
},
update(){
location.reload();
}
},
data(){
return {
tippenoffen: false
tippenoffen: false,
debug: true
}
}
};
</script>
<template>
<Loading v-show="loading"/>
<Navbar buttontext="Tippen" @clickbtn="tippenoffen=true" />
<Loading v-show="loading && !debug" />
<Navbar buttontext="Tippen" @clickbtn="tippenoffen = true" />
<section
class="header16 cid-u6k7q0xIhk bulitipp mbr-fullscreen mbr-parallax-background"
@@ -226,7 +245,7 @@ export default {
<strong>Willkommen im Bundesliga Tippspiel</strong>
</h1>
<p class="mbr-fonts-style mbr-text mbr-white mb-4 display-7">
Saison
Saison {{ saison }}/{{ saison + 1 }}
</p>
<br /><br />
</div>
@@ -234,7 +253,7 @@ export default {
</div>
</section>
<Modal v-show="tippenoffen" @closemodal="tippenoffen=false">
<Modal v-show="tippenoffen" @closemodal="tippenoffen = false">
<h1>Test</h1>
</Modal>
<Uebersicht :users="users" />
@@ -255,7 +274,6 @@ export default {
<br />
<MyFooter />
</template>
<style scoped>
@import "../assets/css/bulitipp2.css";