Paarungsergebnisse hinzugefügt

This commit is contained in:
R40fendt
2025-05-06 11:25:10 +02:00
parent 3323ee1f8f
commit 2a306c7b6d
4 changed files with 96 additions and 146 deletions

View File

@@ -1,28 +1,34 @@
<script lang="ts">
<script lang="js">
import RitzenbergenLib from "../../ritzenbergenlib.ts";
export default {
props: {
paarungen: {
type: Array,
ergebnisse: {
type: Object,
required: true
},
teams: {
type: Array,
maxspieltag: {
type: Number,
required: true
}
},
data(){
return {
RitzenbergenLib
}
}
}
</script>
<template>
<section class="buli-results scroll-x" id="buliresults-section">
<br /><br />
<h2>Paarungsergebnisse . Spieltag</h2>
<h2>Paarungsergebnisse {{ maxspieltag }}. Spieltag</h2>
<table>
<tbody>
<tr>
<td>Paarung</td>
<td>Ergebnis</td>
</tr>
<tr v-for="paarung in paarungen">
<tr v-for="ergebnis in ergebnisse">
<td>
<!-- Modal -->
<!--
@@ -30,19 +36,19 @@
<span class="as-link">
<span class="teams">
<span class="team">
<img src="" alt="" />
<p>{{ teams[paarung.team1].name }}</p>
<img :src='RitzenbergenLib.RitzenbergenLib.api("/bulitipp/get-image.php?team="+ergebnis.paarung.heim)' alt="" />
<p>{{ ergebnis.paarung.heim }}</p>
</span>
<span class="vs"></span>
<span class="team">
<p>{{ teams[paarung.team2].name }}</p>
<img src="" alt="" />
<p>{{ ergebnis.paarung.gast }}</p>
<img :src='RitzenbergenLib.RitzenbergenLib.api("/bulitipp/get-image.php?team="+ergebnis.paarung.gast)' alt="" />
</span>
</span>
</span>
</td>
<td>
<p>{{ paarung.result1 }} - {{ paarung.result2 }}</p>
<p>{{ ergebnis.heim }} - {{ ergebnis.gast }}</p>
</td>
</tr>
</tbody>

View File

@@ -31,8 +31,30 @@ class RitzenbergenLib {
}
}
class Paarung {
public heim: string;
public gast: string;
constructor (heim: string, gast: string) {
this.heim = heim;
this.gast = gast;
}
}
class Ergebnis {
paarung: Paarung;
heim: number;
gast: number;
constructor (paarung: Paarung, heim: number, gast: number) {
this.paarung = paarung;
this.heim = heim;
this.gast = gast;
}
}
export default {
RitzenbergenLib,
User,
SpieltagSumme
SpieltagSumme,
Paarung,
Ergebnis
}

View File

@@ -21,7 +21,7 @@ export default {
bilder() {
let result: any[] = [];
$.ajax(RitzenbergenLib.api("/galerie/get_bilder.php"), {
$.ajax(RitzenbergenLib.RitzenbergenLib.api("/galerie/get_bilder.php"), {
async: false,
success(data: string) {
result = JSON.parse(data);
@@ -50,7 +50,7 @@ export default {
}"
:style="{
backgroundImage:
'url('+RitzenbergenLib.get_img(bildel)+')',
'url('+RitzenbergenLib.RitzenbergenLib.get_img(bildel)+')',
}"
v-for="(bildel, i) in bilder"
@click="bild=i"

View File

@@ -81,138 +81,56 @@ export default {
.then((result)=> parseInt(result));
},
default: ""
},
maxspieltag: {
get(){
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/maxspieltag.php"))
.then((response) => response.text())
.then((result)=> parseInt(result));
}
},
paarungen: {
get(){
const params = new URLSearchParams({
spieltag: this.maxspieltag
});
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/paarungen.php?"+params.toString()))
.then((response) => response.json())
.then((result2) => {
if(result2.reload) this.update();
return result2.data;
})
.then((result) => {
return result.map(el => new RitzenbergenLib.Paarung(el[0],el[1]));
})
.catch((error) => {
return null;
});
},
watch: ["maxspieltag"],
default: [new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade..."),new RitzenbergenLib.Paarung("Lade...","Lade...")]
},
ergebnisse: {
get(){
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/ergebnisse.php"))
.then((response) => response.json())
.then((result2) => {
if(result2.reload) this.update();
return result2.data;
})
.then((result) => {
return result.map((el,i) => new RitzenbergenLib.Ergebnis(this.paarungen[i],el[0],el[1]));
})
},
watch: ["paarungen"]
}
},
computed: {
sortedUsers() {
if(this.users instanceof Array) return [...this.users].sort((a, b) => b.points - a.points);
},
teams() {
return {
1: {
name: "Team 1",
},
2: {
name: "Team 2",
},
3: {
name: "Team 3",
},
4: {
name: "Team 4",
},
5: {
name: "Team 5",
},
6: {
name: "Team 6",
},
7: {
name: "Team 7",
},
8: {
name: "Team 8",
},
9: {
name: "Team 9",
},
10: {
name: "Team 10",
},
11: {
name: "Team 11",
},
12: {
name: "Team 12",
},
13: {
name: "Team 13",
},
14: {
name: "Team 14",
},
15: {
name: "Team 15",
},
16: {
name: "Team 16",
},
17: {
name: "Team 17",
},
18: {
name: "Team 18",
},
};
},
paarungen() {
return [
{
id: 1,
team1: 1,
team2: 2,
result1: 1,
result2: 0,
},
{
id: 2,
team1: 3,
team2: 4,
result1: 1,
result2: 0,
},
{
id: 3,
team1: 5,
team2: 6,
result1: 1,
result2: 0,
},
{
id: 4,
team1: 7,
team2: 8,
result1: 2,
result2: 1,
},
{
id: 5,
team1: 9,
team2: 10,
result1: 0,
result2: 0,
},
{
id: 6,
team1: 11,
team2: 12,
result1: 3,
result2: 2,
},
{
id: 7,
team1: 13,
team2: 14,
result1: 2,
result2: 2,
},
{
id: 8,
team1: 15,
team2: 16,
result1: 0,
result2: 1,
},
{
id: 9,
team1: 17,
team2: 18,
result1: 3,
result2: 3,
},
];
},
loading(){
return this.$asyncComputed.users.updating || this.$asyncComputed.ts.updating;
},
@@ -241,7 +159,6 @@ export default {
<template>
<Loading v-show="loading && !debug" />
<Navbar buttontext="Tippen" @clickbtn="tippenoffen = true" />
<section
class="header16 cid-u6k7q0xIhk bulitipp mbr-fullscreen mbr-parallax-background"
id="hero-17-u6k7q0xIhk"
@@ -270,6 +187,8 @@ export default {
<Modal v-show="tippenoffen" @closemodal="tippenoffen = false">
<h1>Test</h1>
</Modal>
<Uebersicht :users="users" />
<!-- Rangliste -->
@@ -278,7 +197,10 @@ export default {
<!-- Paarungsergebnisse -->
<Paarungsergebnisse :paarungen="paarungen" :teams="teams" />
<Paarungsergebnisse
:ergebnisse="ergebnisse"
:maxspieltag="maxspieltag"
/>
<!-- Punktetabelle -->
<Tabelle :users="users" :ts="ts" />