OOP zu BuLi-Tipp hinzugefügt
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
<script lang="js">
|
||||
import * as RitzenbergenLib from '../../ritzenbergenlib';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
users: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
testUsers(){
|
||||
console.log(this.users);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<section class="rangliste" id="rangliste-sektion">
|
||||
<br /><br />
|
||||
|
||||
{{ testUsers }}
|
||||
<h2>Rangliste</h2>
|
||||
<table>
|
||||
<tbody>
|
||||
@@ -26,7 +33,7 @@
|
||||
<!-- <iframe class="iframeRanglisteDetailansicht"
|
||||
data-src="">Detailansicht User 1</iframe> -->
|
||||
|
||||
<span class="as-link">{{ user.name }}</span>
|
||||
<span class="as-link">{{ user.username }}</span>
|
||||
</td>
|
||||
<td>{{ user.points }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -6,13 +6,15 @@ export default {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
spieltage: {
|
||||
ts: {
|
||||
type: null,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
||||
myts(){
|
||||
console.log(this.ts, this.users);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
@@ -21,7 +23,7 @@ export default {
|
||||
<template>
|
||||
<section class="buli-table" id="buli-table">
|
||||
<br /><br />
|
||||
|
||||
{{ myts }}
|
||||
<h2>Punktetabelle</h2>
|
||||
<!--<div id="load-table-btn-container">
|
||||
<button id="load-table-btn">Punkte ausrechnen</button>
|
||||
@@ -30,15 +32,15 @@ export default {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Tag</td>
|
||||
<td v-for="spieltag in spieltage[0]">{{ spieltag.user.name }}</td>
|
||||
<td v-for="spieltag in ts[0]">{{ spieltag.user.username }}</td>
|
||||
</tr>
|
||||
<tr v-for="spieltag, i in spieltage">
|
||||
<td>{{ parseInt(i)+1 }}</td>
|
||||
<tr v-for="spieltag, i in ts">
|
||||
<td>{{ i+1 }}</td>
|
||||
|
||||
<!-- Modal -->
|
||||
|
||||
<!-- Open BTN -->
|
||||
<td class="as-link" v-for="userpoints in spieltag">{{ userpoints.points }}</td>
|
||||
<td class="as-link" v-for="userpoints in spieltag">{{ userpoints.tsPoints }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RitzenbergenLib from "../../ritzenbergenlib.ts";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
RitzenbergenLib
|
||||
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,14 +11,14 @@ export default {
|
||||
return {
|
||||
openedModals,
|
||||
modaltypes: ["text", "html"],
|
||||
RitzenbergenLib,
|
||||
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
events() {
|
||||
let result: any[]=[];
|
||||
|
||||
$.ajax(RitzenbergenLib.api("get_events.php"),{
|
||||
$.ajax(RitzenbergenLib.RitzenbergenLib.api("get_events.php"),{
|
||||
crossDomain: true,
|
||||
async: false,
|
||||
success: function (data:string) {
|
||||
|
||||
@@ -7,13 +7,13 @@ export default {
|
||||
return {
|
||||
openedModals: [],
|
||||
formValues: [],
|
||||
RitzenbergenLib,
|
||||
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
forms() {
|
||||
let result: any[] = [];
|
||||
$.ajax(RitzenbergenLib.api("/get_forms.php"), {
|
||||
$.ajax(RitzenbergenLib.RitzenbergenLib.api("/get_forms.php"), {
|
||||
async: false,
|
||||
crossDomain: true,
|
||||
success: function (data: string) {
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
},
|
||||
formresults(formid){
|
||||
let result: any[] = [];
|
||||
$.ajax(RitzenbergenLib.api("/get_ergebnisse.php"), {
|
||||
$.ajax(RitzenbergenLib.RitzenbergenLib.api("/get_ergebnisse.php"), {
|
||||
async: false,
|
||||
crossDomain: true,
|
||||
success: function (data: string) {
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
export default class RitzenbergenLib {
|
||||
class User {
|
||||
public username: string;
|
||||
public kuerzel: string;
|
||||
public points: number;
|
||||
public id: number;
|
||||
constructor (username: string, kuerzel: string, points: number, id: number) {
|
||||
this.username = username;
|
||||
this.kuerzel = kuerzel;
|
||||
this.points=points;
|
||||
this.id=id;
|
||||
}
|
||||
}
|
||||
|
||||
class SpieltagSumme {
|
||||
public user: User;
|
||||
public tsPoints: number;
|
||||
constructor (user: User, tsPoints: number) {
|
||||
this.user = user;
|
||||
this.tsPoints = tsPoints;
|
||||
}
|
||||
}
|
||||
|
||||
class RitzenbergenLib {
|
||||
static get_img(mypath: string) {
|
||||
if(mypath.startsWith("/")) return "http://bilder.ritzenbergen.de"+mypath;
|
||||
else return "http://bilder.ritzenbergen.de/"+mypath;
|
||||
@@ -8,3 +30,9 @@ export default class RitzenbergenLib {
|
||||
else return "http://192.168.188.38/Jonas/ritzenbergenapi/"+path;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
RitzenbergenLib,
|
||||
User,
|
||||
SpieltagSumme
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import Rangliste from "../components/bulitipp/Rangliste.vue";
|
||||
import Paarungsergebnisse from "../components/bulitipp/Paarungsergebnisse.vue";
|
||||
import Tabelle from "../components/bulitipp/Tabelle.vue";
|
||||
import RitzenbergenLib from "../ritzenbergenlib.ts";
|
||||
import SpieltagSumme from "../ritzenbergenlib.ts";
|
||||
import Loading from "../components/bulitipp/Loading.vue";
|
||||
|
||||
export default {
|
||||
@@ -23,46 +24,59 @@ export default {
|
||||
asyncComputed: {
|
||||
users: {
|
||||
get(){
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/get-users.php"))
|
||||
return fetch(RitzenbergenLib.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);
|
||||
result.forEach((user, i) => {
|
||||
let sum = 0;
|
||||
this.spieltage.forEach((spieltag) => {
|
||||
this.ts.forEach((spieltag) => {
|
||||
console.log(spieltag);
|
||||
let points = spieltag.find((element) => {
|
||||
return element.user.id === user.id;
|
||||
});
|
||||
sum += points.points;
|
||||
sum += points.tsPoints;
|
||||
});
|
||||
user.points = sum;
|
||||
});
|
||||
return result;
|
||||
}).catch((error) => {
|
||||
})
|
||||
.then((result) => {
|
||||
return result.map(el => new RitzenbergenLib.User(el.name,el.kuerzel, el.points, el.id));
|
||||
})
|
||||
.catch((error) => {
|
||||
return null;
|
||||
});
|
||||
},
|
||||
default: [],
|
||||
watch: ["spieltage"]
|
||||
watch: ["ts"]
|
||||
},
|
||||
spieltage: {
|
||||
ts: {
|
||||
get() {
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/ts.php"))
|
||||
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/ts.php"))
|
||||
.then((response) => response.json())
|
||||
.then((result2) => {
|
||||
if(result2.reload) this.update();
|
||||
return result2.data;
|
||||
});
|
||||
})
|
||||
.then((result)=>{
|
||||
result.map(element => element.map((element) => {
|
||||
|
||||
element.user=new RitzenbergenLib.User(element.user.name, element.user.kuerzel,0, element.user.id);
|
||||
return element;
|
||||
}));
|
||||
return result;
|
||||
})
|
||||
.then((result)=>result.map((el) => el.map((el)=> new RitzenbergenLib.SpieltagSumme(el.user,el.points))));
|
||||
},
|
||||
default: []
|
||||
},
|
||||
saison:{
|
||||
get(){
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/saison.php"))
|
||||
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/saison.php"))
|
||||
.then((response) => response.text())
|
||||
.then((result)=> parseInt(result));
|
||||
},
|
||||
@@ -200,7 +214,7 @@ export default {
|
||||
];
|
||||
},
|
||||
loading(){
|
||||
return this.$asyncComputed.users.updating || this.$asyncComputed.spieltage.updating;
|
||||
return this.$asyncComputed.users.updating || this.$asyncComputed.ts.updating;
|
||||
},
|
||||
|
||||
},
|
||||
@@ -267,7 +281,7 @@ export default {
|
||||
<Paarungsergebnisse :paarungen="paarungen" :teams="teams" />
|
||||
|
||||
<!-- Punktetabelle -->
|
||||
<Tabelle :users="users" :spieltage="spieltage" />
|
||||
<Tabelle :users="users" :ts="ts" />
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
RitzenbergenLib,
|
||||
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib,
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
|
||||
Reference in New Issue
Block a user