From 3dac7ebb2c2fa14d8d8eebb75b627a50c5bcf31b Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sat, 1 Jun 2019 15:44:48 +0200 Subject: [PATCH 1/3] Station: choose coordinates on map --- .../frontend/package.json | 4 +- .../frontend/src/components/mapClickable.vue | 408 ++++++++++++++++++ .../frontend/src/pages/Cache.vue | 4 +- .../frontend/src/pages/StationEdit.vue | 44 +- .../frontend/src/statics/map-marker_blue.svg | 18 - .../frontend/src/statics/map-marker_green.svg | 18 - .../frontend/src/statics/map-marker_grey.svg | 19 - .../src/statics/map-marker_yellow.svg | 18 - 8 files changed, 441 insertions(+), 92 deletions(-) create mode 100644 labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue delete mode 100644 labswp_2019_sose_geocaching_frontend/frontend/src/statics/map-marker_blue.svg delete mode 100644 labswp_2019_sose_geocaching_frontend/frontend/src/statics/map-marker_green.svg delete mode 100644 labswp_2019_sose_geocaching_frontend/frontend/src/statics/map-marker_grey.svg delete mode 100644 labswp_2019_sose_geocaching_frontend/frontend/src/statics/map-marker_yellow.svg diff --git a/labswp_2019_sose_geocaching_frontend/frontend/package.json b/labswp_2019_sose_geocaching_frontend/frontend/package.json index 0657383..f262cce 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/package.json +++ b/labswp_2019_sose_geocaching_frontend/frontend/package.json @@ -19,7 +19,9 @@ "openlayers": "^4.6.5", "quasar": "^1.0.0-rc.2", "vue-qrcode-reader": "^1.4.2", - "vuelayers": "^0.11.4" + "vuelayers": "^0.11.4", + "lodash": "^4.17.11", + "ol": "^5.3.1" }, "devDependencies": { "@quasar/app": "^1.0.0-rc.4", diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue new file mode 100644 index 0000000..9687ea3 --- /dev/null +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue @@ -0,0 +1,408 @@ + + + + + diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue index e3784e1..edb0978 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue @@ -251,8 +251,8 @@ } }, validateRankingPoints: function () { - var re = new RegExp('^[0-9]+$'); - var rps = String.valueOf(this.computedCache.rankingPoints); + let re = new RegExp('^[0-9]+$'); + let rps = String(this.computedCache.rankingPoints); return re.test(rps); }, validateEverything(){ diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue index 1de5ced..d9a004d 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue @@ -15,25 +15,32 @@

Location

- - + - - - + + + + - - - - + + + + + + + + + + + +
+ +
@@ -51,10 +58,11 @@ diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue index edb0978..0242f20 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue @@ -60,9 +60,11 @@ -

Hinweis: Ein Cache muss mindestens aus zwei Stationen bestehen (inklusive der Endstation).

+

Hinweis: Ein Cache muss mindestens aus zwei Stationen bestehen (inklusive der Endstation). +

- +

Endstation

@@ -95,7 +97,7 @@
- +
@@ -123,7 +125,7 @@ }, created: function () { console.log("isNewCache: " + this.isNewCache); - console.log("Route Params: " + this.$route.params.id); + //console.log("Route Params: " + this.$route.params.id); if (!this.isNewCache && !this.$store.getters['cacheCollector/GET_LOCK']) { this.$axios.get('/api/allCaches') .then((response) => { @@ -163,6 +165,7 @@ const station = this.$store.getters['cacheCollector/GET_ENDSTATION']; console.log(station); this.$store.commit('cacheCollector/SET_TEMPSTATION', station); + this.$store.commit('cacheCollector/SET_LOCK', true); this.$router.push({path: `/tempendstation/`}); // add parameter }, @@ -187,67 +190,65 @@ let cache = JSON.parse(JSON.stringify(this.computedCache)); console.log(cache); cache.stationen.push(this.computedEndstation); - console.log("isnewcache "+this.isNewCache) + console.log("isnewcache " + this.isNewCache) //Error messages - if(!this.validateRankingPoints()){ + if (!this.validateRankingPoints()) { let title = "Falsche Formatierung"; let msg = "Die Ranglistenpunkte müssen eine ganze Zahl sein"; this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); } - if(this.validateEverything()) { - if (this.isNewCache) { - console.log("CREATECACHE") - this.$axios.post('/api/createCache', cache) - .then((response) => { - console.log("POST api/createCache: " + response.statusText); - this.$store.commit('cacheCollector/RESET_NEW_CACHE'); - this.$router.push({path: '/overview'}); - }).catch((error) => { - let msg; - let title; - if (error.response) { - title = "Bitte Eingaben überprüfen!"; - msg = error.response.data; - } else if (error.request) { - title = "Verbindungsfehler!"; - msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" - console.log(error.request); - } else { - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - } else { - console.log("EDITCACHE") - this.$axios.put('/api/editCache', cache) - .then((response) => { - console.log("POST api/editCache: " + response.statusText); - this.$store.commit('cacheCollector/RESET_NEW_CACHE'); - this.$router.push({path: '/overview'}); - }).catch((error) => { - let msg; - let title; - if (error.response) { - title = "Bitte Eingaben überprüfen!"; - msg = error.response.data; - } else if (error.request) { - title = "Verbindungsfehler!"; - msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" - console.log(error.request); - } else { - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - } + if (this.isNewCache) { + console.log("CREATECACHE") + this.$axios.post('/api/createCache', cache) + .then((response) => { + console.log("POST api/createCache: " + response.statusText); + this.$store.commit('cacheCollector/RESET_NEW_CACHE'); + this.$router.push({path: '/overview'}); + }).catch((error) => { + let msg; + let title; + if (error.response) { + title = "Bitte Eingaben überprüfen!"; + msg = error.response.data; + } else if (error.request) { + title = "Verbindungsfehler!"; + msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" + console.log(error.request); + } else { + title = "Error"; + msg = error.message; + console.log('Error', error.message); + } + console.log(error.config); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); + }) + } else { + console.log("EDITCACHE") + this.$axios.put('/api/editCache', cache) + .then((response) => { + console.log("POST api/editCache: " + response.statusText); + this.$store.commit('cacheCollector/RESET_NEW_CACHE'); + this.$router.push({path: '/overview'}); + }).catch((error) => { + let msg; + let title; + if (error.response) { + title = "Bitte Eingaben überprüfen!"; + msg = error.response.data; + } else if (error.request) { + title = "Verbindungsfehler!"; + msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" + console.log(error.request); + } else { + title = "Error"; + msg = error.message; + console.log('Error', error.message); + } + console.log(error.config); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); + }) } }, validateRankingPoints: function () { @@ -255,7 +256,7 @@ let rps = String(this.computedCache.rankingPoints); return re.test(rps); }, - validateEverything(){ + validateEverything() { return this.validateRankingPoints(); } }, diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue index d9a004d..51e0e0e 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue @@ -1,53 +1,25 @@