finished user story angefangene und abgeschlossene Caches ansehen

This commit is contained in:
rchrist 2019-04-11 00:52:27 +02:00
parent 46ac72ffa2
commit d810d782cb

View File

@ -25,38 +25,66 @@
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="startedCaches" class=" fit"> <q-tab-panel name="startedCaches" class=" fit">
<!--<q-list>--> <q-list>
<!--<q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id">--> <q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id">
<!--<q-expansion-item--> <q-expansion-item
<!--class=""--> class=""
<!--expand-icon-toggle--> v-if="startedCache.cacheAccesDefinition.description == 'angefangen'"
<!--expand-separator--> expand-icon-toggle
<!--icon="location_on"--> expand-separator
<!--:label="startedCache.cache.name"--> icon="location_on"
<!--:caption="'Hallo'"--> :label="startedCache.cache.name"
<!--&gt;--> :caption=" startedCache.cache.description"
<!--<q-item>--> >
<!--<q-item-section top avatar class="self-center">--> <q-item>
<!--&lt;!&ndash;<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>&ndash;&gt;--> <q-item-section top avatar class="self-center">
<!--</q-item-section>--> <!--<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>-->
<!--<q-item-section>--> </q-item-section>
<!--<q-item-label caption>{{ startedCache.cache.description }}</q-item-label>--> <q-item-section>
<!--</q-item-section>--> <q-item-label caption>{{'Nächste Aufgabe: ' + startedCache.aktuelleStation.description }}
</q-item-label>
<q-item-label caption>{{'Ranglistenpunkte für diesen Cache: ' + startedCache.cache.rankingPoints}}
</q-item-label>
</q-item-section>
<!--<q-item-section side top class="self-center">--> <q-item-section side top class="self-center">
<!--</q-item-section>--> </q-item-section>
<!--</q-item>--> </q-item>
<!--<q-item class="q-pr-sm reverse q-gutter-x-sm">--> <q-item class="q-pr-sm reverse q-gutter-x-sm">
<!--<q-btn @click="startCache(startedCache.id)" unelevated color="positive" stack icon="arrow_forward"--> <q-btn @click="startCache(startedCache.id)" unelevated color="positive" stack icon="arrow_forward"
<!--label="Starten" size="sm"/>--> label="Fortfahren" size="sm"/>
<!--</q-item>--> </q-item>
<!--</q-expansion-item>--> </q-expansion-item>
<!--</q-card>--> </q-card>
<!--</q-list>--> </q-list>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="finishedCaches" class="fit"> <q-tab-panel name="finishedCaches" class="fit">
<q-list>
<q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id">
<q-expansion-item
class=""
v-if="startedCache.cacheAccesDefinition.description == 'abgeschlossen'"
expand-icon-toggle
expand-separator
icon="location_on"
:label="startedCache.cache.name"
:caption=" startedCache.cache.description"
>
<q-item>
<q-item-section top avatar class="self-center">
<!--<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>-->
</q-item-section>
<q-item-section>
<q-item-label caption>{{'Erhaltene Punkte für diesen Cache: ' + startedCache.cache.rankingPoints }}</q-item-label>
</q-item-section>
<q-item-section side top class="self-center">
</q-item-section>
</q-item>
</q-expansion-item>
</q-card>
</q-list>
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
@ -77,10 +105,7 @@
export default { export default {
data() { data() {
return { return {
tab: 'startedCaches', tab: 'startedCaches' + 'finishedCaches',
// hheight: 71.0,
// fheight: 36.0, //37
//header: {h: '0px', w: 0}
startedCaches: [], startedCaches: [],
} }
}, },
@ -92,45 +117,36 @@
} }
}, },
created: function() { created: function() {
console.log("created(): " + this.startedCaches); this.fetchUserCaches();
this.fetchStartedCaches();
// this.fetchFinishedCaches();
this.$store.commit('auth/SET_AUTHENTICATED'); this.$store.commit('auth/SET_AUTHENTICATED');
this.$store.commit('auth/SET_USER'); this.$store.commit('auth/SET_USER');
}, },
methods: { methods: {
fetchStartedCaches() { fetchUserCaches: function() {
this.$axios.get('http://localhost:8080/api/getMyCaches') const token = JSON.parse(localStorage.getItem('userToken'));
this.$axios.get('http://localhost:8080/api/getMyCaches', { params: {token}} )
.then((response) => { .then((response) => {
console.log("Caches: " + this.startedCaches); this.startedCaches = response.data;
this.startedCaches = response.data; });
})
}, },
// fetchFinishedCaches() { startCache(cacheID) {
// this.$axios.get('http://localhost:8080/api/getMyCaches') const userToken = JSON.parse(localStorage.getItem('userToken'));
// .then((response) => { let params = {cacheID: cacheID};
// console.log("Caches: " + this.finishedCaches); if (userToken != null) {
// this.finishedCaches = response.data; params.token = userToken;
// }) }
// }, console.log(params);
// startCache(cacheID) {
// const userToken = JSON.parse(localStorage.getItem('userToken')); this.$axios.get('http://localhost:8080/api/startCache', {params})
// let params = {cacheID: cacheID}; .then((response) => {
// if (userToken != null) { console.log(response.data);
// params.token = userToken; // TODO wenn cache angefangen, dann suche die letzte gefundene Station
// } let stationID = this.caches.find(x => x.id === cacheID).stationen[0].id;
// console.log(params); console.log(stationID);
// //this.$router.push({path: `/station/${stationID}`})
// this.$axios.get('http://localhost:8080/api/startCache', {params}) this.$router.push({path: `/station/${cacheID}/${stationID}`})
// .then((response) => { })
// console.log(response.data); }
// // TODO wenn cache angefangen, dann suche die letzte gefundene Station
// let stationID = this.caches.find(x => x.id === cacheID).stationen[0].id;
// console.log(stationID);
// //this.$router.push({path: `/station/${stationID}`})
// this.$router.push({path: `/station/${cacheID}/${stationID}`})
// })
// }
} }
} }
</script> </script>