Merge branch 'develop' into frontend/kathy
This commit is contained in:
commit
ebdea962ae
20
aaa.html
Normal file
20
aaa.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>BuGa Lageplan</title>
|
||||||
|
<script src="/config.js"></script>
|
||||||
|
<!--get local copy of openlayers javascript file-->
|
||||||
|
<script src="/scripts/ol.js"></script>
|
||||||
|
<!--get openlayers support javascript file-->
|
||||||
|
<script src="/scripts/mapScript.js"></script>
|
||||||
|
<link rel="stylesheet" href="/stylesheets/map.css">
|
||||||
|
<link rel="stylesheet" href="/stylesheets/style.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="fullscreen">
|
||||||
|
<div id="map" class="map fullscreen"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
const map = createMapFromPoiSet([{"Name":"Wolfszipfel_Station1","Latitude":49.14709,"Longitude":9.208993,"CategoryID":0},{"Name":"Live Demo Cache_Station1","Latitude":49,"Longitude":9,"CategoryID":0},{"Name":"GeoCaching für alle_Station1","Latitude":49,"Longitude":9,"CategoryID":0},{"Name":"Test Cache_Station1","Latitude":49.1,"Longitude":9.207,"CategoryID":0},{"Name":"GeoCaching für alle_Station2","Latitude":49,"Longitude":9,"CategoryID":1},{"Name":"GeoCaching für alle_Station3","Latitude":49,"Longitude":9,"CategoryID":1},{"Name":"GeoCaching für alle_Station4","Latitude":49,"Longitude":9,"CategoryID":1},{"Name":"GeoCaching für alle_Station5","Latitude":49,"Longitude":9,"CategoryID":1}]);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -109,14 +109,14 @@ module.exports = function (ctx) {
|
|||||||
},
|
},
|
||||||
env: ctx.dev
|
env: ctx.dev
|
||||||
? { // Base URL for API-Calls: DEV
|
? { // Base URL for API-Calls: DEV
|
||||||
//API: JSON.stringify('http://localhost:8080')
|
API: JSON.stringify('http://localhost:8080'),
|
||||||
API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
|
// API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
|
||||||
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
|
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
|
||||||
}
|
}
|
||||||
: { // Base URL for API-Calls: PRODUCTION (build)
|
: { // Base URL for API-Calls: PRODUCTION (build)
|
||||||
API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
|
API: JSON.stringify('http://localhost:8080'),
|
||||||
|
//API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
|
||||||
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
|
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
|
||||||
//API: JSON.stringify('http://localhost:8080')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import VueQrcodeReader from "vue-qrcode-reader";
|
import VueQrcodeReader from "vue-qrcode-reader";
|
||||||
// import qrscanner from "../components/qr-scanner";
|
// import qrscanner from "../components/qrscanner";
|
||||||
|
|
||||||
// "async" is optional
|
// "async" is optional
|
||||||
export default async ({ Vue }) => {
|
export default async ({ Vue }) => {
|
||||||
|
|||||||
210
frontend/src/components/qrscanner.vue
Normal file
210
frontend/src/components/qrscanner.vue
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="q-ma-md" v-if="askForPermission">
|
||||||
|
|
||||||
|
<q-btn @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="positive" stack
|
||||||
|
icon="filter_center_focus"
|
||||||
|
label="QR-Code scannen" class="full-width q-mt-sm"/>
|
||||||
|
<p class="q-mt-sm"><b>Hinweis:</b> Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.</p>
|
||||||
|
</div>
|
||||||
|
<div v-if="activateCamera">
|
||||||
|
<qrcode-drop-zone @decode="onDecode" @init="logErrors">
|
||||||
|
<qrcode-stream :paused="paused" @decode="onDecode" @init="onInit">
|
||||||
|
<div v-if="validating" >
|
||||||
|
<div class="light-dimmed fit">
|
||||||
|
</div>
|
||||||
|
<q-spinner-oval
|
||||||
|
class="absolute-center"
|
||||||
|
color="primary"
|
||||||
|
size="10em"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</qrcode-stream>
|
||||||
|
</qrcode-drop-zone>
|
||||||
|
<div class="q-ma-md">
|
||||||
|
<q-btn v-if="!askForPermission" @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="primary" stack
|
||||||
|
label="Schließen" class="full-width"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<qrcode-capture v-if="noStreamApiSupport" @decode="onDecode"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'qrscanner',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
askForPermission: true,
|
||||||
|
activateCamera: false,
|
||||||
|
isValid: false,
|
||||||
|
validating: false,
|
||||||
|
loading: false,
|
||||||
|
paused: false,
|
||||||
|
result: null,
|
||||||
|
params: null,
|
||||||
|
noStreamApiSupport: false,
|
||||||
|
|
||||||
|
cacheID: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.setCacheId();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setCacheId() {
|
||||||
|
console.log("qr-code: 'cache' from url: " + this.$route.params.cache);
|
||||||
|
this.cacheID = this.$route.params.cache ? this.$route.params.cache : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
async onDecode(content) {
|
||||||
|
this.result = content;
|
||||||
|
|
||||||
|
this.pauseCamera();
|
||||||
|
|
||||||
|
this.validating = true;
|
||||||
|
this.isValid = await this.validate();
|
||||||
|
|
||||||
|
this.validating = false;
|
||||||
|
this.unPauseCamera();
|
||||||
|
// window.setTimeout(() => {
|
||||||
|
// }, 2000)
|
||||||
|
// //this.unPauseCamera();
|
||||||
|
},
|
||||||
|
|
||||||
|
validate() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let params = this.setParams();
|
||||||
|
console.log(params);
|
||||||
|
if (!params.cacheID || !params.stationID || !params.durchgefuehrterCacheID || !params.token) {
|
||||||
|
console.log("Mindestens 1 Parameter konnte nicht erkannt werden!");
|
||||||
|
resolve(false);
|
||||||
|
} else if (isNaN(params.cacheID) || isNaN(params.stationID) || isNaN(params.durchgefuehrterCacheID)) {
|
||||||
|
console.log("Mindestens 1 Parameter ist fehlerhaft!");
|
||||||
|
resolve(false);
|
||||||
|
} else {
|
||||||
|
this.$axios.put('/api/checkStation', null, { params })
|
||||||
|
.then((response) => {
|
||||||
|
console.log("resolve(true)");
|
||||||
|
console.log("cache access definition");
|
||||||
|
console.log(response.data.cacheAccesDefinition);
|
||||||
|
resolve(true);
|
||||||
|
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
||||||
|
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
||||||
|
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
||||||
|
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log("resolve(false)");
|
||||||
|
let header = "";
|
||||||
|
let message = "";
|
||||||
|
if (error.response) {
|
||||||
|
console.log(error.response);
|
||||||
|
if (this.$route.path === "/qr-scanner") {
|
||||||
|
console.log(this.$route);
|
||||||
|
header = "Falsche Station!";
|
||||||
|
message = "Bitte setze einen bereits angefangenen Cache " +
|
||||||
|
"an der richtigen Station fort oder beginne einen neuen Cache indem du eine der " +
|
||||||
|
"Startstationen einscannst. Du findest die Startstationen über die Karte.";
|
||||||
|
} else {
|
||||||
|
header = "Falsche Station!";
|
||||||
|
message = "Du hast diese Station schon gescannt oder sie ist nicht die korrekte Folgestation.";
|
||||||
|
message += "Prüfe ob du das Rätsel korrekt gelöst hast und finde die richtige Station.";
|
||||||
|
}
|
||||||
|
} else if (error.request) {
|
||||||
|
console.log(error.request);
|
||||||
|
header = "Server nicht erreichbar!";
|
||||||
|
message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal.";
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
console.log('Error', error.message);
|
||||||
|
header = "Fehler!";
|
||||||
|
message = error.message;
|
||||||
|
}
|
||||||
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
window.setTimeout(() => {
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
setParams() {
|
||||||
|
console.log("setParams: ");
|
||||||
|
let params = {};
|
||||||
|
if (localStorage.getItem('userToken')) {
|
||||||
|
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||||
|
}
|
||||||
|
params.cacheID = this.result.split('/')[0];
|
||||||
|
params.stationID = this.result.split('/')[1];
|
||||||
|
params.durchgefuehrterCacheID = this.CacheID ? this.cacheID : params.cacheID;
|
||||||
|
console.log(params.cacheID + " und " + params.stationID);
|
||||||
|
this.updateProps();
|
||||||
|
return params;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateProps() {
|
||||||
|
console.log("emit result!")
|
||||||
|
this.$emit('result', this.params)
|
||||||
|
},
|
||||||
|
updateCameraState() {
|
||||||
|
console.log("Camera State:")
|
||||||
|
console.log(!this.askForPermission)
|
||||||
|
this.$emit('camera', !this.askForPermission)
|
||||||
|
},
|
||||||
|
|
||||||
|
pauseCamera() {
|
||||||
|
this.paused = true
|
||||||
|
},
|
||||||
|
|
||||||
|
unPauseCamera() {
|
||||||
|
this.paused = false
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleCamera(bool) {
|
||||||
|
this.activateCamera = bool;
|
||||||
|
if (this.askForPermission === false) {
|
||||||
|
this.askForPermission = true;
|
||||||
|
this.updateCameraState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
logErrors(promise) {
|
||||||
|
promise.catch(console.error)
|
||||||
|
},
|
||||||
|
|
||||||
|
async onInit(promise) {
|
||||||
|
this.loading = true;
|
||||||
|
try {
|
||||||
|
await promise
|
||||||
|
} catch (error) {
|
||||||
|
if (error.name === 'StreamApiNotSupportedError') {
|
||||||
|
this.noStreamApiSupport = true
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
this.askForPermission = false;
|
||||||
|
this.updateCameraState();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeRouteUpdate(to, from, next) {
|
||||||
|
this.askForPermission = true;
|
||||||
|
this.activateCamera = false;
|
||||||
|
this.isValid = false;
|
||||||
|
this.validating = false;
|
||||||
|
this.loading = false;
|
||||||
|
this.paused = false;
|
||||||
|
this.result = null;
|
||||||
|
this.params = null;
|
||||||
|
this.noStreamApiSupport = false;
|
||||||
|
this.setCacheId();
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
to="/qr-scanner"
|
to="/qr-scanner"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon name="camera"/>
|
<q-icon name="filter_center_focus"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>QR-Code Scanner</q-item-label>
|
<q-item-label>QR-Code Scanner</q-item-label>
|
||||||
@ -73,6 +73,7 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
|
v-if="this.$store.state.auth.isAuthenticated"
|
||||||
clickable
|
clickable
|
||||||
class="text-primary"
|
class="text-primary"
|
||||||
v-ripple
|
v-ripple
|
||||||
@ -80,7 +81,7 @@
|
|||||||
to="/mycaches"
|
to="/mycaches"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon name="map"/>
|
<q-icon name="bookmarks"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>Meine Caches</q-item-label>
|
<q-item-label>Meine Caches</q-item-label>
|
||||||
@ -131,6 +132,23 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
|
v-if="this.$store.state.auth.isAuthenticated"
|
||||||
|
clickable
|
||||||
|
class="text-primary"
|
||||||
|
v-ripple
|
||||||
|
tag="a"
|
||||||
|
@click="logout()"
|
||||||
|
to="/"
|
||||||
|
>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="logout"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>Logout</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
v-if="!this.$store.state.auth.isAuthenticated"
|
||||||
clickable
|
clickable
|
||||||
class="text-primary"
|
class="text-primary"
|
||||||
v-ripple
|
v-ripple
|
||||||
@ -141,7 +159,7 @@
|
|||||||
<q-icon name="logout"/>
|
<q-icon name="logout"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>{{ loginText }}</q-item-label>
|
<q-item-label>Login</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
@ -177,22 +195,10 @@
|
|||||||
name: "MyLayout",
|
name: "MyLayout",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// dialog: {
|
|
||||||
// color: this,
|
|
||||||
// show: true,
|
|
||||||
// message: "Hallo Fehler! Dies ist ein Beispiel Fehler."
|
|
||||||
// },
|
|
||||||
leftDrawerOpen: this.$q.platform.is.desktop,
|
leftDrawerOpen: this.$q.platform.is.desktop,
|
||||||
//menuButtonVisible: !this.$q.platform.is.desktop,
|
|
||||||
//leftDrawerOpen: true,
|
|
||||||
//miniState: true
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
loginText() {
|
|
||||||
let text = this.$store.state.auth.isAuthenticated ? "Logout" : "Login";
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
dialogShow: {
|
dialogShow: {
|
||||||
get() {
|
get() {
|
||||||
// console.log("get dialogShow: "+this.$store.state.dialog.dialog.show)
|
// console.log("get dialogShow: "+this.$store.state.dialog.dialog.show)
|
||||||
@ -228,12 +234,25 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.evalAuthentication();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//openURL
|
//openURL
|
||||||
dialogClose() {
|
dialogClose() {
|
||||||
console.log("dialogClose(): ")
|
console.log("dialogClose(): ")
|
||||||
this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
|
this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
|
||||||
},
|
},
|
||||||
|
evalAuthentication: function () {
|
||||||
|
this.$store.commit('auth/SET_AUTHENTICATED');
|
||||||
|
// this.$store.commit('auth/SET_USER');
|
||||||
|
},
|
||||||
|
logout: function () {
|
||||||
|
console.log("logout()");
|
||||||
|
console.log(JSON.parse(localStorage.getItem('userToken')));
|
||||||
|
localStorage.removeItem('userToken');
|
||||||
|
this.evalAuthentication();
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -210,6 +210,7 @@
|
|||||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
this.$router.push({path: '/overview'});
|
this.$router.push({path: '/overview'});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
//TODO: Fehlermeldungen
|
||||||
// Error
|
// Error
|
||||||
let msg;
|
let msg;
|
||||||
let title;
|
let title;
|
||||||
|
|||||||
@ -2,23 +2,15 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="q-ma-md">
|
<div class="q-ma-md">
|
||||||
<p class="text-h4">{{ cacheName }}</p>
|
<p class="text-h4">{{ cacheName }}</p>
|
||||||
<p class="text-h5">{{ end1 + rankingPoints + end2 }}</p>
|
<p class="text-h5">Herzlichen Glückwunsch!</p>
|
||||||
|
<p class="">Du hast alle Stationen gefunden und diesen Cache damit erfolgreich abgeschlossen!</p>
|
||||||
|
<p class="">Dir wurden <b>{{ rankingPoints }} Punkte</b> gutgeschrieben.</p>
|
||||||
|
<p class="text-h5">Deine Belohnung:</p>
|
||||||
|
<p v-html="cache.reward.rewardDescription"></p>
|
||||||
|
|
||||||
<div class="column q-gutter-y-md">
|
<div class="column q-gutter-y-md">
|
||||||
<q-btn unelevated v-if="isLoggedIn" color="primary" label="Zur Rangliste" to="/ranking/"/>
|
<q-btn unelevated color="primary" label="Rangliste" to="/ranking/"/>
|
||||||
<q-btn unelevated v-if="isLoggedIn" color="primary" label="Zur Belohnung" @click="reward = true" />
|
<q-btn unelevated color="primary" label="Startseite" to="/"/>
|
||||||
<q-dialog v-model="reward">
|
|
||||||
<q-card>
|
|
||||||
<q-card-section>
|
|
||||||
<div class="text-h6">Deine Belohnung: </div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-card-section>
|
|
||||||
<div>{{ cache.reward.rewardDescription }}</div>
|
|
||||||
</q-card-section>
|
|
||||||
</q-card>
|
|
||||||
</q-dialog>
|
|
||||||
<q-btn unelevated color="primary" label="Zur Startseite" to="/"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -28,21 +20,15 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reward: false,
|
|
||||||
cacheID: "",
|
cacheID: "",
|
||||||
cacheName: "",
|
cacheName: "",
|
||||||
cache: {
|
cache: {
|
||||||
reward: "",
|
reward: "",
|
||||||
},
|
},
|
||||||
rankingPoints: "",
|
rankingPoints: "",
|
||||||
end1: "Gut gemacht, Du hast alle Stationen dieses Cache gefunden. Dir wurden ",
|
|
||||||
end2: " Punkte gutgeschrieben." //TODO Punkte wirklich gutschreiben, ggf. Cache auf erledigt setzen
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isLoggedIn() {
|
|
||||||
return localStorage.getItem('userToken'); //TODO Methode umschreiben --> funktioniert das?
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
|
|||||||
@ -4,44 +4,26 @@
|
|||||||
class="q-mb-md "
|
class="q-mb-md "
|
||||||
height= "200px"
|
height= "200px"
|
||||||
width= "100%"
|
width= "100%"
|
||||||
|
v-if="!cameraActive"
|
||||||
:src= "iFrameURL" frameborder="0"></iframe>
|
:src= "iFrameURL" frameborder="0"></iframe>
|
||||||
<div class="q-ma-md">
|
<div v-if="!cameraActive" class="q-ma-md">
|
||||||
<p class="text-h4">{{ cacheName }}</p>
|
<p class="text-h4">{{ cacheName }}</p>
|
||||||
<p>{{ instruction }}</p>
|
<p>{{ instruction }}</p>
|
||||||
|
|
||||||
<div class="column q-gutter-y-md">
|
|
||||||
<div v-if="askForPermission">
|
|
||||||
<p>Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.</p>
|
|
||||||
|
|
||||||
<q-btn @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="positive" stack
|
|
||||||
icon="photo_camera"
|
|
||||||
label="QR-Code scannen" class="full-width"/>
|
|
||||||
</div>
|
|
||||||
<div v-if="activateCamera">
|
|
||||||
<qrcode-drop-zone @decode="onDecode" @init="logErrors">
|
|
||||||
<qrcode-stream :paused="paused" @decode="onDecode" @init="onInit">
|
|
||||||
<div v-if="validating">
|
|
||||||
<div class="light-dimmed fit">
|
|
||||||
</div>
|
|
||||||
<q-spinner-oval
|
|
||||||
class="absolute-center"
|
|
||||||
color="primary"
|
|
||||||
size="10em"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</qrcode-stream>
|
|
||||||
</qrcode-drop-zone>
|
|
||||||
</div>
|
|
||||||
<qrcode-capture v-if="noStreamApiSupport" @decode="onDecode"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<qrscanner @result="updateResult($event)" @camera="updateCamera($event)" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import qrscanner from "../components/qrscanner";
|
||||||
export default {
|
export default {
|
||||||
|
name: "CacheStart",
|
||||||
|
components: {qrscanner},
|
||||||
data() {
|
data() {
|
||||||
return { //TODO Lageplan einbinden
|
return {
|
||||||
|
result: null,
|
||||||
|
cameraActive: false,
|
||||||
cacheID: "",
|
cacheID: "",
|
||||||
cacheName: "",
|
cacheName: "",
|
||||||
//code: "8/7",
|
//code: "8/7",
|
||||||
@ -108,96 +90,18 @@
|
|||||||
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
},
|
|
||||||
|
|
||||||
async onDecode(content) {
|
|
||||||
this.result = content;
|
|
||||||
|
|
||||||
this.pauseCamera();
|
|
||||||
|
|
||||||
this.validating = true;
|
|
||||||
this.isValid = await this.validate();
|
|
||||||
this.validating = false;
|
|
||||||
|
|
||||||
this.unPauseCamera();
|
|
||||||
// window.setTimeout(() => {
|
|
||||||
// this.unPauseCamera();
|
|
||||||
// }, 2000)
|
|
||||||
},
|
|
||||||
|
|
||||||
validate() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
|
|
||||||
let params = this.setParams();
|
|
||||||
this.$axios.get('/api/checkStation', {params})
|
|
||||||
.then((response) => {
|
|
||||||
console.log("resolve(true)");
|
|
||||||
console.log("cache access definition");
|
|
||||||
console.log(response.data.cacheAccesDefinition);
|
|
||||||
resolve(true);
|
|
||||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
|
||||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
|
||||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
|
||||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.log("resolve(false)");
|
|
||||||
// Error
|
|
||||||
let msg;
|
|
||||||
let title;
|
|
||||||
if (error.response) {
|
|
||||||
// The request was made and the server responded with a status code
|
|
||||||
title = "Problem with response!";
|
|
||||||
msg = error.response.data.message
|
|
||||||
? error.response.data.message
|
|
||||||
: error.response.data;
|
|
||||||
} else if (error.request) {
|
|
||||||
// The request was made but no response was received
|
|
||||||
title = "Problem with request!";
|
|
||||||
msg = "Der Server antwortet nicht."
|
|
||||||
console.log(error.request);
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
title = "Error";
|
|
||||||
msg = error.message;
|
|
||||||
console.log('Error', error.message.data);
|
|
||||||
}
|
|
||||||
console.log(error.config);
|
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
pauseCamera() {
|
|
||||||
this.paused = true
|
|
||||||
},
|
|
||||||
|
|
||||||
unPauseCamera() {
|
|
||||||
this.paused = false
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleCamera(bool) {
|
|
||||||
this.activateCamera = bool
|
|
||||||
},
|
|
||||||
|
|
||||||
logErrors(promise) {
|
|
||||||
promise.catch(console.error)
|
|
||||||
},
|
|
||||||
|
|
||||||
async onInit(promise) {
|
|
||||||
this.loading = true;
|
|
||||||
try {
|
|
||||||
await promise
|
|
||||||
} catch (error) {
|
|
||||||
if (error.name === 'StreamApiNotSupportedError') {
|
|
||||||
this.noStreamApiSupport = true
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
this.askForPermission = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
updateResult(event) {
|
||||||
|
console.log("updateResult()");
|
||||||
|
console.log(event);
|
||||||
|
this.result = event;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateCamera(event) {
|
||||||
|
console.log("updateCamera()");
|
||||||
|
this.cameraActive = event;
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
@click="login"
|
@click="login"
|
||||||
|
@keyup.enter="login"
|
||||||
unelevated
|
unelevated
|
||||||
>
|
>
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
@ -46,6 +47,16 @@
|
|||||||
unelevated
|
unelevated
|
||||||
@click="logout"
|
@click="logout"
|
||||||
/>
|
/>
|
||||||
|
<div class="q-pt-md">
|
||||||
|
<q-btn
|
||||||
|
:disabled="userAuthenticated"
|
||||||
|
label="Registrieren"
|
||||||
|
color="primary"
|
||||||
|
class="full-width q-mt-md"
|
||||||
|
unelevated
|
||||||
|
to="/register"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,17 +74,9 @@
|
|||||||
user: {
|
user: {
|
||||||
email: "",
|
email: "",
|
||||||
password: "",
|
password: "",
|
||||||
//token: "",
|
|
||||||
// evalAuthentication: false
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// beforeMount: {
|
|
||||||
// init: function () {
|
|
||||||
// this.evalAuthentication();
|
|
||||||
// console.log("initiated");
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
created() {
|
created() {
|
||||||
this.evalAuthentication();
|
this.evalAuthentication();
|
||||||
console.log("created: initiated");
|
console.log("created: initiated");
|
||||||
@ -140,16 +143,6 @@
|
|||||||
logout: function () {
|
logout: function () {
|
||||||
console.log("logout()");
|
console.log("logout()");
|
||||||
console.log(JSON.parse(localStorage.getItem('userToken')));
|
console.log(JSON.parse(localStorage.getItem('userToken')));
|
||||||
// this.$axios.get('/api/logout', {
|
|
||||||
// params: {
|
|
||||||
// token: JSON.parse(localStorage.getItem('userToken'))
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .then((response) => {
|
|
||||||
// console.log("GET/POST /api/logout/ - response: " + response.data);
|
|
||||||
// })
|
|
||||||
// .catch((error) => {
|
|
||||||
// });
|
|
||||||
localStorage.removeItem('userToken');
|
localStorage.removeItem('userToken');
|
||||||
this.evalAuthentication();
|
this.evalAuthentication();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
>
|
>
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
class=""
|
class=""
|
||||||
expand-icon-toggle
|
|
||||||
expand-separator
|
expand-separator
|
||||||
icon="location_on"
|
icon="location_on"
|
||||||
:label="startedCache.cache.name"
|
:label="startedCache.cache.name"
|
||||||
@ -62,7 +61,6 @@
|
|||||||
<q-card class="q-mb-md" v-for="finishedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)" :key="finishedCache.id">
|
<q-card class="q-mb-md" v-for="finishedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)" :key="finishedCache.id">
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
class=""
|
class=""
|
||||||
expand-icon-toggle
|
|
||||||
expand-separator
|
expand-separator
|
||||||
icon="location_on"
|
icon="location_on"
|
||||||
:label="finishedCache.cache.name"
|
:label="finishedCache.cache.name"
|
||||||
|
|||||||
@ -44,11 +44,13 @@
|
|||||||
</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(cache.id)" unelevated color="positive" stack icon="arrow_forward"
|
<q-btn @click="startCache(cache.id)" unelevated color="positive" stack icon="arrow_forward"
|
||||||
label="Starten" size="sm"/>
|
label="Starten" size="xs"/>
|
||||||
<q-btn disable v-if="hasAdminState" @click="editCache(cache.id)" unelevated color="amber" stack
|
|
||||||
icon="edit" label="Bearbeiten" size="sm"/>
|
|
||||||
<q-btn v-if="hasAdminState" @click="deleteCache(cache.id)" unelevated color="negative" stack
|
<q-btn v-if="hasAdminState" @click="deleteCache(cache.id)" unelevated color="negative" stack
|
||||||
icon="delete" label="Löschen" size="sm"/>
|
icon="delete" label="Löschen" size="xs"/>
|
||||||
|
<q-btn disable v-if="hasAdminState" @click="editCache(cache.id)" unelevated color="primary" stack
|
||||||
|
icon="edit" label="Bearbeiten" size="xs"/>
|
||||||
|
<q-btn v-if="hasAdminState" @click="generateQrCodes(cache.id)" unelevated color="primary" stack
|
||||||
|
icon="image" label="QR-Codes" size="xs"/>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
</q-card>
|
</q-card>
|
||||||
@ -201,16 +203,13 @@
|
|||||||
},
|
},
|
||||||
startCache(cacheID) {
|
startCache(cacheID) {
|
||||||
console.log("startCache()");
|
console.log("startCache()");
|
||||||
// const userToken = JSON.parse(localStorage.getItem('userToken')).token;
|
|
||||||
// let params = {cacheID: cacheID};
|
|
||||||
// if (userToken != null) {
|
|
||||||
// params.token = userToken;
|
|
||||||
// }
|
|
||||||
// console.log(params);
|
|
||||||
this.$store.state.currentCache.cache = this.caches.find(cache => cache.id === Number(cacheID));
|
this.$store.state.currentCache.cache = this.caches.find(cache => cache.id === Number(cacheID));
|
||||||
console.log(this.$store.state.currentCache.cache);
|
console.log(this.$store.state.currentCache.cache);
|
||||||
this.$store.state.currentCache.currentCacheID = Number(cacheID);
|
this.$store.state.currentCache.currentCacheID = Number(cacheID);
|
||||||
this.$router.push({path: `/CacheStart/${cacheID}`})
|
this.$router.push({path: `/CacheStart/${cacheID}`})
|
||||||
|
},
|
||||||
|
generateQrCodes(cacheID) {
|
||||||
|
this.$router.push({path: `/generator/${cacheID}`})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,17 +100,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.my-custom th {
|
/*.my-custom th {*/
|
||||||
color: #027BE3 !important;
|
/* color: #027BE3 !important;*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
.my-custom tr {
|
/*.my-custom tr {*/
|
||||||
color: #027BE3 !important;
|
/* color: #027BE3 !important;*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
.my-custom td {
|
/*.my-custom td {*/
|
||||||
color: #027BE3 !important;
|
/* color: #027BE3 !important;*/
|
||||||
}
|
/*}*/
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
//import {dom} from 'quasar'
|
//import {dom} from 'quasar'
|
||||||
@ -123,7 +123,6 @@
|
|||||||
inviteMail: "",
|
inviteMail: "",
|
||||||
currentTeamStatus: "Dienstag 15:00 Treffen zum Blumencache",
|
currentTeamStatus: "Dienstag 15:00 Treffen zum Blumencache",
|
||||||
teamStatus: "",
|
teamStatus: "",
|
||||||
userName: null,
|
|
||||||
email: null,
|
email: null,
|
||||||
userRanking: null,
|
userRanking: null,
|
||||||
teamName: null,
|
teamName: null,
|
||||||
@ -146,23 +145,19 @@
|
|||||||
],
|
],
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
name: 'Mein Nutzername',
|
name: 'E-Mail',
|
||||||
userData: this.userName,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Meine Email',
|
|
||||||
userData: this.email,
|
userData: this.email,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Meine Ranglistenposition',
|
name: 'Rang',
|
||||||
userData: this.userRanking,
|
userData: this.userRanking,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Mein Team',
|
name: 'Team',
|
||||||
userData: this.teamName,
|
userData: this.teamName,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Teamranglistenposition',
|
name: 'Team-Rang',
|
||||||
userData: this.teamRanking,
|
userData: this.teamRanking,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -229,17 +224,15 @@
|
|||||||
created: function () {
|
created: function () {
|
||||||
this.$store.commit('auth/SET_AUTHENTICATED');
|
this.$store.commit('auth/SET_AUTHENTICATED');
|
||||||
this.$store.commit('auth/SET_USER');
|
this.$store.commit('auth/SET_USER');
|
||||||
this.userName = JSON.parse(localStorage.getItem('userToken')).name;
|
|
||||||
this.data[0].userData = this.userName;
|
|
||||||
this.email = JSON.parse(localStorage.getItem('userMail'));
|
this.email = JSON.parse(localStorage.getItem('userMail'));
|
||||||
this.data[1].userData = this.email;
|
this.data[0].userData = this.email;
|
||||||
this.userRanking = "1234";
|
this.userRanking = "1234";
|
||||||
this.data[2].userData = this.userRanking;
|
this.data[1].userData = this.userRanking;
|
||||||
this.teamName = "BuGa19Community";
|
this.teamName = "BuGa19Community";
|
||||||
this.data[3].userData = this.teamName;
|
this.data[2].userData = this.teamName;
|
||||||
this.dropDownSelectedItem = this.teamName;
|
this.dropDownSelectedItem = this.teamName;
|
||||||
this.teamRanking = "2019";
|
this.teamRanking = "2019";
|
||||||
this.data[4].userData = this.teamRanking;
|
this.data[3].userData = this.teamRanking;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
validateEmail(email) {
|
validateEmail(email) {
|
||||||
|
|||||||
@ -1,63 +1,59 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="q-pa-md">
|
<div class="q-pa-md">
|
||||||
<form class="register">
|
<form class="register" autocomplete="off">
|
||||||
<div class="q-pa-md">
|
<div class="q-pa-md">
|
||||||
<div class="column q-gutter-lg" style="">
|
<div class="column q-gutter-lg" style="">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="" style="max-width: 440px">
|
<div class="" style="max-width: 440px">
|
||||||
<q-input outlined filled stack-label v-model="user.name" type="text"
|
<q-input lazy-rules outlined filled stack-label v-model="user.email" type="text" label="E-Mail"
|
||||||
label="Nutzername eingeben" :rules="[val=>val.length>=2||'Name muss mindestens 2 Zeichen lang sein!']"/>
|
:rules="[val=>validateEmail(val)||'Bitte gültige E-Mail angeben!']"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="" style="max-width: 440px">
|
<div class="" style="max-width: 440px">
|
||||||
<q-input outlined filled stack-label v-model="user.email" type="text" label="Email eingeben" :rules="[val=>validateEmail(val)||'Email muss valide sein']"/>
|
<q-input lazy-rules outlined filled stack-label v-model="user.checkemail" type="text"
|
||||||
</div>
|
label="E-Mail erneut eingeben" placeholer="Email"
|
||||||
|
:rules="[val=>val===user.email||'E-Mail stimmt nicht überein!']"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
</div>
|
||||||
<div class="">
|
<div class="col">
|
||||||
<div class="" style="max-width: 440px">
|
<div class="">
|
||||||
<q-input outlined filled stack-label v-model="user.checkemail" type="text"
|
<div class="" style="max-width: 440px">
|
||||||
label="Email erneut eingeben" placeholer="Email" :rules="[val=>val===user.email||'Email stimmt nicht überein']"/>
|
<q-input lazy-rules outlined filled stack-label v-model="user.password" type="password"
|
||||||
</div>
|
label="Passwort"
|
||||||
|
:rules="[val=>val.length>=8||'Passwort muss mindestens 8 Zeichen lang sein!']"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
</div>
|
||||||
<div class="">
|
<div class="col">
|
||||||
<div class="" style="max-width: 440px">
|
<div class="">
|
||||||
<q-input outlined filled stack-label v-model="user.password" type="password"
|
<div class="" style="max-width: 440px">
|
||||||
label="Passwort eingeben" :rules="[val=>val.length>=8||'Passwort muss mindestens 8 Zeichen lang sein!']"/>
|
<q-input lazy-rules outlined filled stack-label v-model="user.checkpassword" type="password"
|
||||||
</div>
|
label="Passwort erneut eingeben"
|
||||||
|
:rules="[val=>val===user.password||'Passwort stimmt nicht überein']"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
</div>
|
||||||
<div class="">
|
<div class="col">
|
||||||
<div class="" style="max-width: 440px">
|
<div class="">
|
||||||
<q-input outlined filled stack-label v-model="user.checkpassword" type="password"
|
<div class="" style="max-width: 440px">
|
||||||
label="Passwort erneut eingeben" :rules="[val=>val===user.password||'Passwort stimmt nicht überein']"/>
|
<q-btn
|
||||||
</div>
|
:disabled="!validationSuccesful"
|
||||||
</div>
|
label="Registrieren"
|
||||||
</div>
|
color="primary"
|
||||||
<div class="col">
|
class="full-width"
|
||||||
<div class="">
|
@click="register()"
|
||||||
<div class="" style="max-width: 440px">
|
unelevated
|
||||||
<q-btn
|
/>
|
||||||
:disabled="!validationSuccesful"
|
|
||||||
label="Registrieren"
|
|
||||||
color="primary"
|
|
||||||
class="full-width"
|
|
||||||
@click="register()"
|
|
||||||
unelevated
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -65,23 +61,21 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return{
|
return {
|
||||||
user: {
|
user: {
|
||||||
name:"",
|
email: "",
|
||||||
email:"",
|
checkemail: "",
|
||||||
checkemail:"",
|
|
||||||
password: "",
|
password: "",
|
||||||
checkpassword: "",
|
checkpassword: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
validationSuccesful(){
|
validationSuccesful() {
|
||||||
if(this.user.name.length>=2
|
if (this.validateEmail(this.user.email)
|
||||||
&&this.validateEmail(this.user.email)
|
&& this.user.email === this.user.checkemail
|
||||||
&&this.user.email===this.user.checkemail
|
&& this.user.password.length >= 8
|
||||||
&&this.user.password.length>=8
|
&& this.user.password === this.user.checkpassword) {
|
||||||
&&this.user.password===this.user.checkpassword){
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -97,9 +91,9 @@
|
|||||||
},
|
},
|
||||||
register: function () {
|
register: function () {
|
||||||
|
|
||||||
if(this.user.email===this.user.checkemail&&this.user.password===this.user.checkpassword){
|
if (this.user.email === this.user.checkemail && this.user.password === this.user.checkpassword) {
|
||||||
const data = {
|
const data = {
|
||||||
name: this.user.name,
|
name: this.user.email,
|
||||||
password: this.user.password,
|
password: this.user.password,
|
||||||
email: this.user.email,
|
email: this.user.email,
|
||||||
roles: [
|
roles: [
|
||||||
@ -112,47 +106,46 @@
|
|||||||
|
|
||||||
console.log("POST /api/register/ - json: " + JSON.stringify(data));
|
console.log("POST /api/register/ - json: " + JSON.stringify(data));
|
||||||
const token = JSON.parse(localStorage.getItem('registerToken')).token;
|
const token = JSON.parse(localStorage.getItem('registerToken')).token;
|
||||||
this.$axios.post(process.env.USER_API+'/account/register', data,{
|
this.$axios.post(process.env.USER_API + '/account/register', data, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ' + token,
|
'Authorization': 'Bearer ' + token,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
if(response.status === 201){
|
if (response.status === 201) {
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: "Deine Registrierung war erfolgreich!", title: "Registrierungsprozess", color: "blue"});
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
||||||
|
message: "Deine Registrierung war erfolgreich!",
|
||||||
|
title: "Registrierungsprozess",
|
||||||
|
color: "blue"
|
||||||
|
});
|
||||||
|
this.autoLogin();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
let message;
|
let message;
|
||||||
let header = "Fehler: ";
|
let header = "Unbekannter Fehler...";
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
console.log("ERROR RESPONSE")
|
console.log(error.response)
|
||||||
// The request was made and the server responded with a status code
|
if (error.response.status === 409) {
|
||||||
// that falls out of the range of 2xx
|
message= "Die E-Mail-Adresse wird bereits verwendet!";
|
||||||
message = error.response.data.error;
|
header= "Anmeldedaten überprüfen!";
|
||||||
header += error.response.status;
|
}
|
||||||
} else if (error.request) {
|
} else if (error.request) {
|
||||||
// The request was made but no response was received
|
console.log(error.request);
|
||||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
header = "Anfrage fehlgeschlagen!";
|
||||||
// http.ClientRequest in node.js
|
message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal.";
|
||||||
message = error.request;
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
console.log('Error', error.message);
|
|
||||||
message = error.message;
|
|
||||||
}
|
}
|
||||||
console.log(error.config);
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header});
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header,});
|
});
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.user.email!=this.user.checkemail) {
|
if (this.user.email != this.user.checkemail) {
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
||||||
message: "Email stimmt nicht überein",
|
message: "Email stimmt nicht überein",
|
||||||
title: "Fehler",
|
title: "Fehler",
|
||||||
});
|
});
|
||||||
} else if (this.user.password!=this.user.checkpassword){
|
} else if (this.user.password != this.user.checkpassword) {
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
||||||
message: "Passwort stimmt nicht überein",
|
message: "Passwort stimmt nicht überein",
|
||||||
title: "Fehler",
|
title: "Fehler",
|
||||||
@ -161,40 +154,37 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
login() {
|
login() {
|
||||||
|
console.log("MasterUser()")
|
||||||
const logindata = {
|
const logindata = {
|
||||||
email: "register@bugageocaching.de",
|
email: "register@bugageocaching.de",
|
||||||
password: "reguser2019"
|
password: "reguser2019"
|
||||||
};
|
};
|
||||||
|
this.$axios.post(process.env.USER_API + '/account/login', logindata)
|
||||||
console.log("GET /api/login/ - json: " + JSON.stringify(logindata));
|
|
||||||
|
|
||||||
this.$axios.post(process.env.USER_API+'/account/login', logindata)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
localStorage.setItem('registerToken', JSON.stringify(response.data));
|
localStorage.setItem('registerToken', JSON.stringify(response.data));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
autoLogin() {
|
||||||
|
console.log("autoLogin()");
|
||||||
|
const data = {
|
||||||
|
email: this.user.email,
|
||||||
|
password: this.user.password,
|
||||||
|
};
|
||||||
|
console.log(data);
|
||||||
|
this.$axios.post(process.env.USER_API + '/account/login', data)
|
||||||
|
.then((response) => {
|
||||||
|
localStorage.setItem('userToken', JSON.stringify(response.data));
|
||||||
|
localStorage.setItem('userMail', JSON.stringify(data.email));
|
||||||
|
this.$store.commit('auth/SET_AUTHENTICATED');
|
||||||
|
this.$store.commit('auth/SET_USER');
|
||||||
|
this.$router.push({path: `/overview`});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
let message;
|
this.$router.push("/login");
|
||||||
let header = "Fehler: ";
|
|
||||||
if (error.response) {
|
|
||||||
console.log("ERROR RESPONSE")
|
|
||||||
// The request was made and the server responded with a status code
|
|
||||||
// that falls out of the range of 2xx
|
|
||||||
message = error.response.data.error;
|
|
||||||
header += error.response.status;
|
|
||||||
} else if (error.request) {
|
|
||||||
// The request was made but no response was received
|
|
||||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
||||||
// http.ClientRequest in node.js
|
|
||||||
message = error.request;
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
console.log('Error', error.message);
|
|
||||||
message = error.message;
|
|
||||||
}
|
|
||||||
console.log(error.config);
|
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
|
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,77 +4,38 @@
|
|||||||
class="q-mb-md "
|
class="q-mb-md "
|
||||||
:ratio="16/9"
|
:ratio="16/9"
|
||||||
src="https://www.buga2019.de/we-bilder/3.Gartenausstellung/Gelaendeplan/190320_Gelaendeplan-quadratisch.jpg"
|
src="https://www.buga2019.de/we-bilder/3.Gartenausstellung/Gelaendeplan/190320_Gelaendeplan-quadratisch.jpg"
|
||||||
|
v-if="!cameraActive"
|
||||||
></q-img>
|
></q-img>
|
||||||
<div class="q-ma-md">
|
<div class="q-ma-md" v-if="!cameraActive">
|
||||||
<p class="text-h4">{{ cache.name }}</p>
|
<p class="text-h4">{{ cache.name }}</p>
|
||||||
<p class="text-h5">Station {{ showCacheProgress }}</p>
|
<p class="text-h5">Station {{ showCacheProgress }}</p>
|
||||||
<!-- <p class="text-h5">Station {{ data.station.position }}</p>-->
|
|
||||||
<p>{{ station.description }}</p>
|
<p>{{ station.description }}</p>
|
||||||
<!--<q-input-->
|
|
||||||
<!--v-model="description"-->
|
|
||||||
<!--filled-->
|
|
||||||
<!--type="textarea"-->
|
|
||||||
<!--/>-->
|
|
||||||
<!--<p class="text-h5 q-mt-md">Location</p>-->
|
|
||||||
<div class="column q-gutter-y-md">
|
<div class="column q-gutter-y-md">
|
||||||
<div v-if="askForPermission">
|
|
||||||
<p>Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.</p>
|
|
||||||
|
|
||||||
<q-btn @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="positive" stack
|
|
||||||
icon="photo_camera"
|
|
||||||
label="QR-Code scannen" class="full-width"/>
|
|
||||||
</div>
|
|
||||||
<div v-if="activateCamera">
|
|
||||||
<qrcode-drop-zone @decode="onDecode" @init="logErrors">
|
|
||||||
<qrcode-stream :paused="paused" @decode="onDecode" @init="onInit">
|
|
||||||
<div v-if="validating">
|
|
||||||
<div class="light-dimmed fit">
|
|
||||||
</div>
|
|
||||||
<q-spinner-oval
|
|
||||||
class="absolute-center"
|
|
||||||
color="primary"
|
|
||||||
size="10em"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</qrcode-stream>
|
|
||||||
</qrcode-drop-zone>
|
|
||||||
</div>
|
|
||||||
<qrcode-capture v-if="noStreamApiSupport" @decode="onDecode"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<qrscanner @result="updateResult($event)" @camera="updateCamera($event)" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import qrscanner from "../components/qrscanner";
|
||||||
export default {
|
export default {
|
||||||
name: "Station",
|
name: "Station",
|
||||||
|
components: {qrscanner},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//code: "",
|
|
||||||
cacheID: "",
|
cacheID: "",
|
||||||
cacheName: "",
|
cacheName: "",
|
||||||
//cache: null,
|
|
||||||
cache: {
|
cache: {
|
||||||
name: "",
|
name: "",
|
||||||
stationen: [],
|
stationen: [],
|
||||||
},
|
},
|
||||||
station: {},
|
station: {},
|
||||||
|
cameraActive: false,
|
||||||
// Following Params belong to QR-Code Scanner
|
|
||||||
askForPermission: true,
|
|
||||||
activateCamera: false,
|
|
||||||
isValid: false,
|
|
||||||
validating: false,
|
|
||||||
loading: false,
|
|
||||||
paused: false,
|
|
||||||
result: null,
|
result: null,
|
||||||
params: null,
|
|
||||||
noStreamApiSupport: false
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteUpdate (to, from, next) {
|
beforeRouteUpdate(to, from, next) {
|
||||||
console.log("beforeRouteUpdate: reset data and fetch");
|
console.log("beforeRouteUpdate: reset data and fetch");
|
||||||
this.cacheID = "";
|
this.cacheID = "";
|
||||||
this.cacheName = "";
|
this.cacheName = "";
|
||||||
@ -83,16 +44,6 @@
|
|||||||
stationen: [],
|
stationen: [],
|
||||||
};
|
};
|
||||||
this.station = {};
|
this.station = {};
|
||||||
this.askForPermission = true;
|
|
||||||
this.activateCamera = false;
|
|
||||||
this.isValid = false;
|
|
||||||
this.validating = false;
|
|
||||||
this.loading = false;
|
|
||||||
this.paused = false;
|
|
||||||
this.result = null;
|
|
||||||
this.params = null;
|
|
||||||
this.noStreamApiSupport = false;
|
|
||||||
|
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
@ -136,109 +87,16 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
setParams() {
|
updateResult(event) {
|
||||||
console.log("setParams: ");
|
console.log("updateResult()");
|
||||||
let params = {};
|
console.log(event);
|
||||||
params.cacheID = this.result.split('/')[0];
|
this.result = event;
|
||||||
params.stationID = this.result.split('/')[1];
|
|
||||||
params.durchgefuehrterCacheID = params.cacheID;
|
|
||||||
console.log(params.durchgefuehrterCacheID);
|
|
||||||
console.log(params.cacheID + " und " + params.stationID);
|
|
||||||
if (localStorage.getItem('userToken')) {
|
|
||||||
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async onDecode(content) {
|
updateCamera(event) {
|
||||||
this.result = content;
|
console.log("updateCamera()");
|
||||||
|
this.cameraActive = event;
|
||||||
this.pauseCamera();
|
|
||||||
|
|
||||||
this.validating = true;
|
|
||||||
this.isValid = await this.validate();
|
|
||||||
this.validating = false;
|
|
||||||
|
|
||||||
this.unPauseCamera();
|
|
||||||
// window.setTimeout(() => {
|
|
||||||
// this.unPauseCamera();
|
|
||||||
// }, 2000)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
validate() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
|
|
||||||
let params = this.setParams();
|
|
||||||
this.$axios.get('/api/checkStation', {params})
|
|
||||||
.then((response) => {
|
|
||||||
console.log("resolve(true)");
|
|
||||||
console.log("cache access definition");
|
|
||||||
console.log(response.data.cacheAccesDefinition);
|
|
||||||
resolve(true);
|
|
||||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
|
||||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
|
||||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
|
||||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.log("resolve(false)");
|
|
||||||
// Error
|
|
||||||
let msg;
|
|
||||||
let title;
|
|
||||||
if (error.response) {
|
|
||||||
// The request was made and the server responded with a status code
|
|
||||||
title = "Problem with response!";
|
|
||||||
msg = error.response.data.message
|
|
||||||
? error.response.data.message
|
|
||||||
: error.response.data;
|
|
||||||
} else if (error.request) {
|
|
||||||
// The request was made but no response was received
|
|
||||||
title = "Problem with request!";
|
|
||||||
msg = "Der Server antwortet nicht."
|
|
||||||
console.log(error.request);
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
title = "Error";
|
|
||||||
msg = error.message;
|
|
||||||
console.log('Error', error.message.data);
|
|
||||||
}
|
|
||||||
console.log(error.config);
|
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
pauseCamera() {
|
|
||||||
this.paused = true
|
|
||||||
},
|
|
||||||
|
|
||||||
unPauseCamera() {
|
|
||||||
this.paused = false
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleCamera(bool) {
|
|
||||||
this.activateCamera = bool
|
|
||||||
},
|
|
||||||
|
|
||||||
logErrors(promise) {
|
|
||||||
promise.catch(console.error)
|
|
||||||
},
|
|
||||||
|
|
||||||
async onInit(promise) {
|
|
||||||
this.loading = true;
|
|
||||||
try {
|
|
||||||
await promise
|
|
||||||
} catch (error) {
|
|
||||||
if (error.name === 'StreamApiNotSupportedError') {
|
|
||||||
this.noStreamApiSupport = true
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
this.askForPermission = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
59
frontend/src/pages/qr-generator.vue
Normal file
59
frontend/src/pages/qr-generator.vue
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<div class="q-ma-md">
|
||||||
|
<p class="text-h4">QR-Generator</p>
|
||||||
|
<p class="text-h5">Cache: {{ cacheName }}</p>
|
||||||
|
<div class="row q-col-gutter-md">
|
||||||
|
<div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xl-2 items-start" v-for="(station, index) in stationen" :key="index">
|
||||||
|
<p class="text-h6 q-my-sm">Station {{ index + 1 }}</p>
|
||||||
|
<q-card class="">
|
||||||
|
<img class="full-width q-pa-md bg-white" :src="imgBaseURL + cacheId +'/'+ station.id" alt="">
|
||||||
|
</q-card>
|
||||||
|
<p class="q-my-sm">{{ cacheId }}/{{ station.id }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<q-btn to="/overview" unelevated color="primary" stack
|
||||||
|
label="Schließen" class="full-width"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
// name: 'PageName',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
cacheName: "",
|
||||||
|
cacheId: 0,
|
||||||
|
stationen: [],
|
||||||
|
imgBaseURL: "https://api.qrserver.com/v1/create-qr-code/?size=500x500&data="
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.fetchData();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
fetchData() {
|
||||||
|
this.$axios.get('/api/allCaches')
|
||||||
|
.then((response) => {
|
||||||
|
console.log("/api/allCaches");
|
||||||
|
console.log(response.data);
|
||||||
|
const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
|
||||||
|
this.cacheName = cache.name;
|
||||||
|
this.cacheId = cache.id;
|
||||||
|
this.stationen = cache.stationen;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteUpdate(to, from, next) {
|
||||||
|
this.fetchData();
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@ -1,148 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div >
|
<div>
|
||||||
<div class="q-ma-md" v-if="askForPermission">
|
<div v-if="!cameraActive" class="q-ma-md">
|
||||||
<p>Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.</p>
|
<p class="text-h4">QR-Scanner</p>
|
||||||
|
<p class="">Mit diesem Scanner kannst du die nächste Station deines Caches einscannen
|
||||||
<q-btn @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="positive" stack
|
oder einen neuen Cache beginnen indem du eine der Startstationen einscannst.
|
||||||
icon="photo_camera"
|
Du findest die Startstationen über die Karte.</p>
|
||||||
label="QR-Code scannen" class="full-width"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="activateCamera">
|
<qrscanner @camera="cameraState($event)" />
|
||||||
<qrcode-drop-zone @decode="onDecode" @init="logErrors">
|
|
||||||
<qrcode-stream :paused="paused" @decode="onDecode" @init="onInit">
|
|
||||||
<div v-if="validating" >
|
|
||||||
<div class="light-dimmed fit">
|
|
||||||
</div>
|
|
||||||
<q-spinner-oval
|
|
||||||
class="absolute-center"
|
|
||||||
color="primary"
|
|
||||||
size="10em"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</qrcode-stream>
|
|
||||||
</qrcode-drop-zone>
|
|
||||||
</div>
|
|
||||||
<qrcode-capture v-if="noStreamApiSupport" @decode="onDecode"/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import qrscanner from "../components/qrscanner";
|
||||||
export default {
|
export default {
|
||||||
//name: 'qrscanner',
|
name: 'Scanner',
|
||||||
|
components: {qrscanner},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
askForPermission: true,
|
cameraActive: false,
|
||||||
activateCamera: false,
|
|
||||||
isValid: false,
|
|
||||||
validating: false,
|
|
||||||
loading: false,
|
|
||||||
paused: false,
|
|
||||||
result: null,
|
|
||||||
params: null,
|
|
||||||
noStreamApiSupport: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async onDecode(content) {
|
cameraState(event) {
|
||||||
this.result = content;
|
this.cameraActive = event;
|
||||||
|
|
||||||
this.pauseCamera();
|
|
||||||
|
|
||||||
this.validating = true;
|
|
||||||
this.isValid = await this.validate();
|
|
||||||
this.validating = false;
|
|
||||||
|
|
||||||
this.unPauseCamera();
|
|
||||||
// window.setTimeout(() => {
|
|
||||||
// this.unPauseCamera();
|
|
||||||
// }, 2000)
|
|
||||||
},
|
|
||||||
|
|
||||||
validate() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
let params = this.setParams();
|
|
||||||
this.$axios.get('/api/checkStation', {params})
|
|
||||||
.then((response) => {
|
|
||||||
console.log("resolve(true)");
|
|
||||||
console.log("cache access definition");
|
|
||||||
console.log(response.data.cacheAccesDefinition);
|
|
||||||
resolve(true);
|
|
||||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
|
||||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
|
||||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
|
||||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.log("resolve(false)");
|
|
||||||
// Error
|
|
||||||
let msg;
|
|
||||||
let title;
|
|
||||||
if (error.response) {
|
|
||||||
// The request was made and the server responded with a status code
|
|
||||||
title = "Problem with response!";
|
|
||||||
msg = error.response.data.message
|
|
||||||
? error.response.data.message
|
|
||||||
: error.response.data;
|
|
||||||
} else if (error.request) {
|
|
||||||
// The request was made but no response was received
|
|
||||||
title = "Problem with request!";
|
|
||||||
msg = "Der Server antwortet nicht."
|
|
||||||
console.log(error.request);
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
title = "Error";
|
|
||||||
msg = error.message;
|
|
||||||
console.log('Error', error.message.data);
|
|
||||||
}
|
|
||||||
console.log(error.config);
|
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
setParams() {
|
|
||||||
console.log("setParams: ");
|
|
||||||
let params = {};
|
|
||||||
params.cacheID = this.result.split('/')[0];
|
|
||||||
params.stationID = this.result.split('/')[1];
|
|
||||||
params.durchgefuehrterCacheID = params.cacheID;
|
|
||||||
console.log(params.cacheID + " und " + params.stationID);
|
|
||||||
if (localStorage.getItem('userToken')) {
|
|
||||||
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
},
|
|
||||||
|
|
||||||
pauseCamera() {
|
|
||||||
this.paused = true
|
|
||||||
},
|
|
||||||
|
|
||||||
unPauseCamera() {
|
|
||||||
this.paused = false
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleCamera(bool) {
|
|
||||||
this.activateCamera = bool
|
|
||||||
},
|
|
||||||
|
|
||||||
logErrors(promise) {
|
|
||||||
promise.catch(console.error)
|
|
||||||
},
|
|
||||||
|
|
||||||
async onInit(promise) {
|
|
||||||
this.loading = true;
|
|
||||||
try {
|
|
||||||
await promise
|
|
||||||
} catch (error) {
|
|
||||||
if (error.name === 'StreamApiNotSupportedError') {
|
|
||||||
this.noStreamApiSupport = true
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
this.askForPermission = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,25 +2,86 @@ import Vue from "vue";
|
|||||||
import VueRouter from "vue-router";
|
import VueRouter from "vue-router";
|
||||||
|
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
|
import {axiosInstance} from "../boot/axios";
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
//import store from "../store/index";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If not building with SSR mode, you can
|
* If not building with SSR mode, you can
|
||||||
* directly export the Router instantiation
|
* directly export the Router instantiation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function(/* { store, ssrContext } */) {
|
export default function({ store }/* { store, ssrContext } */) {
|
||||||
const Router = new VueRouter({
|
const Router = new VueRouter({
|
||||||
scrollBehavior: () => ({ x: 0, y: 0 }),
|
scrollBehavior: () => ({ x: 0, y: 0 }),
|
||||||
routes,
|
routes,
|
||||||
|
store,
|
||||||
// Leave these as is and change from quasar.conf.js instead!
|
// Leave these as is and change from quasar.conf.js instead!
|
||||||
// quasar.conf.js -> build -> vueRouterMode
|
// quasar.conf.js -> build -> vueRouterMode
|
||||||
// quasar.conf.js -> build -> publicPath
|
// quasar.conf.js -> build -> publicPath
|
||||||
mode: process.env.VUE_ROUTER_MODE,
|
mode: process.env.VUE_ROUTER_MODE,
|
||||||
base: process.env.VUE_ROUTER_BASE
|
base: process.env.VUE_ROUTER_BASE
|
||||||
});
|
});
|
||||||
|
Router.beforeEach((to, from, next) => {
|
||||||
|
console.log("before Routing...");
|
||||||
|
const isPublic = to.matched.some(record => record.meta.public);
|
||||||
|
const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
|
||||||
|
const onlyAdmin = to.matched.some(record => record.meta.onlyAdmin);
|
||||||
|
const loggedIn = localStorage.getItem('userToken')
|
||||||
|
? JSON.parse(localStorage.getItem('userToken'))
|
||||||
|
: false;
|
||||||
|
console.log(`isPublic: ${isPublic} \nonlyWhenLoggedOut: ${onlyWhenLoggedOut} \nonlyAdmin: ${onlyAdmin}`);
|
||||||
|
console.log("loggedIn");
|
||||||
|
console.log(loggedIn);
|
||||||
|
const isAdmin = loggedIn ? loggedIn.roles.find(x => x.role === "ADMIN" && x.domain === "geocaching.de") : false;
|
||||||
|
//const isAdmin = true;
|
||||||
|
|
||||||
|
if (!isPublic && !loggedIn) {
|
||||||
|
return next({
|
||||||
|
path:'/login',
|
||||||
|
query: {redirect: to.fullPath} // Store the full path to redirect the user to after login
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((loggedIn && onlyWhenLoggedOut) || (loggedIn && onlyAdmin && !isAdmin)) {
|
||||||
|
return next('/')
|
||||||
|
}
|
||||||
|
if (isPublic) {
|
||||||
|
return next()
|
||||||
|
}
|
||||||
|
if (!isPublic && loggedIn) {
|
||||||
|
axiosInstance.get('/api/getUser', {
|
||||||
|
params: {
|
||||||
|
token: loggedIn.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log("Token valid!");
|
||||||
|
return next();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("Catch Block: ");
|
||||||
|
console.log("Token invalid!");
|
||||||
|
if (error.response) {
|
||||||
|
console.log(error.response.data);
|
||||||
|
console.log(error.response.status);
|
||||||
|
console.log(error.response.headers);
|
||||||
|
//store.commit('auth/SET_LOGOUT');
|
||||||
|
store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
||||||
|
message: "Ihr Token ist nicht mehr gültig. Bitte loggen Sie sich erneut ein.",
|
||||||
|
title: "Bitte erneut anmelden.",
|
||||||
|
color: "blue", });
|
||||||
|
localStorage.removeItem('userToken');
|
||||||
|
return next('/Login');
|
||||||
|
} else {
|
||||||
|
console.log("unexpected behaviour");
|
||||||
|
console.log(error);
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(`isPublic: ${isPublic} \nonlyWhenLoggedOut: ${onlyWhenLoggedOut} \nonlyAdmin: ${onlyAdmin}`);
|
||||||
|
//return next();
|
||||||
|
});
|
||||||
return Router;
|
return Router;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,88 +2,183 @@ const routes = [
|
|||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Index.vue") }]
|
children: [{ path: "", component: () => import("pages/Index.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: true, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
path: "/overview/",
|
path: "/overview/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Overview.vue") }]
|
children: [{ path: "", component: () => import("pages/Overview.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: true, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/cache/",
|
path: "/cache/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Cache.vue") }]
|
children: [{ path: "", component: () => import("pages/Cache.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/qr-scanner/",
|
path: "/qr-scanner/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/qr-scanner.vue") }]
|
children: [{ path: "", component: () => import("pages/qr-scanner.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/cache/:id",
|
path: "/cache/:id",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Cache.vue") }]
|
children: [{ path: "", component: () => import("pages/Cache.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/station/",
|
path: "/station/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
|
children: [{ path: "", component: () => import("pages/StationEdit.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/endstation/",
|
path: "/endstation/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/StationEndEdit.vue") }]
|
children: [{ path: "", component: () => import("pages/StationEndEdit.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/tempstation/:pos",
|
path: "/tempstation/:pos",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{path: "", component: () => import("pages/StationEdit.vue")}]
|
children: [{path: "", component: () => import("pages/StationEdit.vue")}],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/tempendstation/",
|
path: "/tempendstation/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{path: "", component: () => import("pages/StationEndEdit.vue")}]
|
children: [{path: "", component: () => import("pages/StationEndEdit.vue")}],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/station/:cache/:id",
|
path: "/station/:cache/:id",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/StationView.vue") }]
|
children: [{ path: "", component: () => import("pages/StationView.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/ranking/",
|
path: "/ranking/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{path: "", component: () => import("pages/ranking.vue")}]
|
children: [{path: "", component: () => import("pages/ranking.vue")}],
|
||||||
|
meta: {
|
||||||
|
public: true, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login/",
|
path: "/login/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Login.vue") }]
|
children: [{ path: "", component: () => import("pages/Login.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: true, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/CacheStart/:cache/",
|
path: "/CacheStart/:cache/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/CacheStart.vue") }]
|
children: [{ path: "", component: () => import("pages/CacheStart.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/CacheEnd/:cache/",
|
path: "/CacheEnd/:cache/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/CacheEnd.vue") }]
|
children: [{ path: "", component: () => import("pages/CacheEnd.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/generator/:cache/",
|
||||||
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
|
children: [{ path: "", component: () => import("pages/qr-generator.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/profile/",
|
path: "/profile/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Profile.vue") }]
|
children: [{ path: "", component: () => import("pages/Profile.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/mycaches/",
|
path: "/mycaches/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/MyCaches.vue") }]
|
children: [{ path: "", component: () => import("pages/MyCaches.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: false, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: false,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/register/",
|
path: "/register/",
|
||||||
component: () => import("layouts/MyLayout.vue"),
|
component: () => import("layouts/MyLayout.vue"),
|
||||||
children: [{ path: "", component: () => import("pages/Register.vue") }]
|
children: [{ path: "", component: () => import("pages/Register.vue") }],
|
||||||
|
meta: {
|
||||||
|
public: true, // Allow access to even if not logged in
|
||||||
|
onlyWhenLoggedOut: true,
|
||||||
|
onlyAdmin: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -14,16 +14,19 @@ export function NEW_MESSAGE_DIALOG (state, messageObject) {
|
|||||||
let color = "red-9";
|
let color = "red-9";
|
||||||
state.dialog.colorBackground = "bg-"+color+" text-white";
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
||||||
state.dialog.colorButton = color;
|
state.dialog.colorButton = color;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "amber": {
|
case "amber": {
|
||||||
let color = "amber";
|
let color = "amber";
|
||||||
state.dialog.colorBackground = "bg-"+color+" text-white";
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
||||||
state.dialog.colorButton = color;
|
state.dialog.colorButton = color;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "blue": {
|
case "blue": {
|
||||||
let color = "primary";
|
let color = "primary";
|
||||||
state.dialog.colorBackground = "bg-"+color+" text-white";
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
||||||
state.dialog.colorButton = color;
|
state.dialog.colorButton = color;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -377,7 +378,7 @@ public class Controller {
|
|||||||
@ApiResponse(code = 404, message = "Database error")
|
@ApiResponse(code = 404, message = "Database error")
|
||||||
})
|
})
|
||||||
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
|
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
|
||||||
@RequestMapping(value = "/api/deleteCache", method = RequestMethod.DELETE, produces = "application/json")
|
@RequestMapping(value = "/api/deleteCache", method = {RequestMethod.DELETE, RequestMethod.GET}, produces = "application/json")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity deleteCache(@RequestParam String cacheID) {
|
public ResponseEntity deleteCache(@RequestParam String cacheID) {
|
||||||
return deleteCacheUtil(cacheID);
|
return deleteCacheUtil(cacheID);
|
||||||
@ -456,7 +457,8 @@ public class Controller {
|
|||||||
List<TeamRankingListHelper> sendBackTeams = new LinkedList<>();
|
List<TeamRankingListHelper> sendBackTeams = new LinkedList<>();
|
||||||
List<Object[]> rankingTeams = userRepository.getTeamRankingList();
|
List<Object[]> rankingTeams = userRepository.getTeamRankingList();
|
||||||
for (Object[] obj : rankingTeams) {
|
for (Object[] obj : rankingTeams) {
|
||||||
TeamRankingListHelper tmp = new TeamRankingListHelper((String) obj[0], (Integer) obj[1]);
|
BigDecimal i = (BigDecimal) obj[1];
|
||||||
|
TeamRankingListHelper tmp = new TeamRankingListHelper((String) obj[0], i.intValue());
|
||||||
System.out.println(tmp);
|
System.out.println(tmp);
|
||||||
sendBackTeams.add(tmp);
|
sendBackTeams.add(tmp);
|
||||||
}
|
}
|
||||||
@ -948,27 +950,8 @@ public class Controller {
|
|||||||
})
|
})
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
||||||
@RequestMapping(value = "/api/getRankingPlace", method = RequestMethod.GET, produces = "application/json")
|
@RequestMapping(value = "/api/getRankingPlace", method = RequestMethod.GET, produces = "application/json")
|
||||||
public ResponseEntity getRankingPlace(@RequestParam String token) {
|
public ResponseEntity getRankingPlace(@RequestParam String email) {
|
||||||
|
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(email));
|
||||||
// verify user
|
|
||||||
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
|
||||||
|
|
||||||
if (verifyToken.getStatusCodeValue() != 200) {
|
|
||||||
return verifyToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
//get User
|
|
||||||
Claims claims = (Claims) verifyToken.getBody();
|
|
||||||
|
|
||||||
ResponseEntity getUser = FinderUtil.findUserFromClaim(claims);
|
|
||||||
|
|
||||||
if (getUser.getStatusCodeValue() != 200) {
|
|
||||||
return getUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
User user = (User) getUser.getBody();
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(user.getUsername()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "Returns startstations and all other stations the user already visited as POIS")
|
@ApiOperation(value = "Returns startstations and all other stations the user already visited as POIS")
|
||||||
@ -1002,8 +985,7 @@ public class Controller {
|
|||||||
ArrayList<POI> poisList = new ArrayList<>();
|
ArrayList<POI> poisList = new ArrayList<>();
|
||||||
for (Cache cache : cacheRepository.findAll()) {
|
for (Cache cache : cacheRepository.findAll()) {
|
||||||
Station station = cache.getStationen().get(0);
|
Station station = cache.getStationen().get(0);
|
||||||
// ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst
|
POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 202);
|
||||||
POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 0);
|
|
||||||
poisList.add(poi);
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,12 +996,11 @@ public class Controller {
|
|||||||
int index = cache.getStationen().indexOf(aktuelleStation);
|
int index = cache.getStationen().indexOf(aktuelleStation);
|
||||||
for (int i = 1; i <= index; i++) {
|
for (int i = 1; i <= index; i++) {
|
||||||
Station station = cache.getStationen().get(i);
|
Station station = cache.getStationen().get(i);
|
||||||
// ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst
|
|
||||||
int categoryID;
|
int categoryID;
|
||||||
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
||||||
categoryID = 1;
|
categoryID = 201;
|
||||||
} else { // is endstation
|
} else { // is endstation
|
||||||
categoryID = 2;
|
categoryID = 203;
|
||||||
}
|
}
|
||||||
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
poisList.add(poi);
|
poisList.add(poi);
|
||||||
|
|||||||
@ -5,8 +5,7 @@ public class POI {
|
|||||||
private String Name;
|
private String Name;
|
||||||
private float Latitude;
|
private float Latitude;
|
||||||
private float Longitude;
|
private float Longitude;
|
||||||
// ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst
|
private int CategoryID; // 202 = grünes icon(startstation) // 201 = blaues icon(folgestationen) // 203 = rotes icon(endstation)
|
||||||
private int CategoryID; // 0 = grünes icon(startstation) // 1 = orangenes icon(folgestationen) // 2 = rotes icon(endstation)
|
|
||||||
|
|
||||||
public POI(String name, float latitude, float longitude, int categoryID) {
|
public POI(String name, float latitude, float longitude, int categoryID) {
|
||||||
Name = name;
|
Name = name;
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public interface UserRepository extends CrudRepository<User, Integer> {
|
|||||||
" AND t.id = ui.team_id\n" +
|
" AND t.id = ui.team_id\n" +
|
||||||
" AND ui.team_id IS NOT NULL\n" +
|
" AND ui.team_id IS NOT NULL\n" +
|
||||||
"GROUP BY teamname\n" +
|
"GROUP BY teamname\n" +
|
||||||
"ORDER by ranking_points_sum DESC" +
|
"ORDER by ranking_points_sum DESC\n" +
|
||||||
"LIMIT 10;", nativeQuery = true)
|
"LIMIT 10;", nativeQuery = true)
|
||||||
List<Object[]> getTeamRankingList();
|
List<Object[]> getTeamRankingList();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user