diff --git a/aaa.html b/aaa.html new file mode 100644 index 0000000..aa143ea --- /dev/null +++ b/aaa.html @@ -0,0 +1,20 @@ + +
+ +{{ cacheName }}
{{ instruction }}
@@ -21,13 +21,27 @@ name: "CacheStart", components: {qrscanner}, data() { - return { //TODO Lageplan einbinden + return { result: null, cameraActive: false, cacheID: "", cacheName: "", //code: "8/7", instruction: "Bitte begib Dich zu der auf der Karte angezeigten Position. An dieser Position wirst Du einen QR-Code finden. Wenn du ihn gefunden hast, drücke den Knopf zum Starten des QR-Scanners und gib uns die Berechtigung, Deine Kamera zu öffnen. Nachdem Du den QR-Code gescannt hast, erhältst du ein Rätsel zur Position der nächsten Station. Die Lösung zu dem Rätsel ist also das Versteck des nächsten QR-Codes.", + // Following Params belong to QR-Code Scanner + askForPermission: true, + activateCamera: false, + isValid: false, + validating: false, + loading: false, + paused: false, + params: null, + noStreamApiSupport: false, + lon: "", + lat: "", + stationID: [], + iFrameURL: "" + } }, created() { @@ -42,8 +56,40 @@ const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); this.cacheName = cache.name; this.cacheID = this.$route.params.cache; + this.stationID = cache.stationen[0]; + this.lon = this.stationID.longitude; + this.lat = this.stationID.lattitude; + this.iFrameURL = `http://www.se.hs-heilbronn.de:3000/api/map/lon=${this.lon}&lat=${this.lat}` }) }, + checkStation() { + let params = this.setParams(); + console.log(params); + this.$axios.get('/api/checkStation', {params}) + .then((response) => { + console.log(response); + console.log("Anfrage erfolgreich"); + + }).catch((error) => { + console.log(error); + console.log("Anfrage fehlgeschlagen"); + }) + this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`}) + }, + + setParams() { + console.log("setParams: "); + let params = {}; + params.cacheID = this.result.split('/')[0]; + params.stationID = this.result.split('/')[1]; + params.durchgefuehrterCacheID = this.cacheID; + console.log("CacheID: " + params.cacheID + " und StationID: " + params.stationID); + console.log(params.durchgefuehrterCacheID); + if (localStorage.getItem('userToken')) { + params.token = JSON.parse(localStorage.getItem('userToken')).token; + } + return params; + }, updateResult(event) { console.log("updateResult()"); diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue index 3d127fd..d55cae8 100644 --- a/frontend/src/pages/Overview.vue +++ b/frontend/src/pages/Overview.vue @@ -93,6 +93,8 @@ return { tab: 'list', caches: [], + stations: [], + pois: [] } }, mounted: function () { @@ -116,8 +118,19 @@ fetchAllCaches() { this.$axios.get('/api/allCaches') .then((response) => { - console.log("Caches: " + this.caches); this.caches = response.data; + for(let cache in this.caches) { + + this.stations[cache]=(this.caches[cache].stationen[0]); + const poiItem = { + Name: this.caches[cache].name, + CategoryID: 3, + Latitude: this.stations[cache].lattitude, + Longitude: this.stations[cache].longitude + }; + this.pois.push(poiItem); + } + this.initMap(); }).catch((error) => { let message; let header = "Fehler: "; @@ -146,9 +159,23 @@ }, editCache() { }, + initMap(){ + console.log("Signalwort: " + this.pois); + // this.$axios.post('http://seserver.se.hs-heilbronn.de:3000/api/map', { + // body: this.pois + // }).then((response)=>{ + // console.log(response) + // }) + // }, + this.$axios.get('http://www.se.hs-heilbronn.de:3000/api/map/lon=9&lat=49', { + body: this.pois + }).then((response)=>{ + console.log(response) + }) + }, deleteCache(id) { console.log('delete cache: ' + id); - this.$axios.get('/api/deleteCache', {params: {cacheID: id}}) + axios.get('/api/deleteCache', {params: {cacheID: id}}) .then((response) => { this.fetchAllCaches() }).catch((error) => { diff --git a/frontend/src/pages/ranking.vue b/frontend/src/pages/ranking.vue index 04b5acb..aac2964 100644 --- a/frontend/src/pages/ranking.vue +++ b/frontend/src/pages/ranking.vue @@ -36,13 +36,13 @@