diff --git a/build.gradle b/build.gradle index 90a4591..841dd55 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ dependencies { compile 'org.springframework.boot:spring-boot-starter-tomcat' //compile 'org.springframework.boot:spring-boot-starter-security' - //compile 'org.springframework.boot:spring-boot-starter-actuator' + compile 'org.springframework.boot:spring-boot-starter-actuator' //compile 'org.springframework.boot:spring-boot-starter-aop' //ompile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '1.2.0.RELEASE' @@ -54,6 +54,10 @@ dependencies { runtime 'io.jsonwebtoken:jjwt-impl:0.10.5', 'io.jsonwebtoken:jjwt-jackson:0.10.5' + compile "io.springfox:springfox-swagger2:2.9.2" + + compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.0.2' + } node { diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 9ee4e06..28e7ec3 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -68,6 +68,10 @@ module.exports = function (ctx) { 'QEditor', 'QSelect', 'QField', + 'QBtnDropdown', + 'QPopupEdit', + 'QSlideTransition', + 'QToggle', ], directives: [ @@ -105,11 +109,14 @@ module.exports = function (ctx) { }, env: ctx.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'), + USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement') } : { // Base URL for API-Calls: PRODUCTION (build) - //API: JSON.stringify('http://seserver.se.hs-heilbronn.de:8090/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') + //API: JSON.stringify('http://localhost:8080') } }, diff --git a/frontend/src/boot/axios.js b/frontend/src/boot/axios.js index ea842da..88a12cd 100644 --- a/frontend/src/boot/axios.js +++ b/frontend/src/boot/axios.js @@ -2,7 +2,7 @@ import axios from "axios"; const axiosInstance = axios.create({ baseURL: process.env.API, - timeout: 3000 + timeout: 6000 }); console.log("process.env.DEV: "+process.env.DEV); console.log("process.env.API: "+process.env.API); diff --git a/frontend/src/layouts/MyLayout.vue b/frontend/src/layouts/MyLayout.vue index 002fb32..943c3f7 100644 --- a/frontend/src/layouts/MyLayout.vue +++ b/frontend/src/layouts/MyLayout.vue @@ -44,6 +44,7 @@ - Caches + Alle Caches + + + + + + + + Meine Caches Profil + + + + + + Registrieren + + - Login + {{ loginText }} @@ -158,37 +189,41 @@ }; }, computed: { + loginText() { + let text = this.$store.state.auth.isAuthenticated ? "Logout" : "Login"; + return text; + }, dialogShow: { get() { - console.log("get dialogShow: "+this.$store.state.dialog.dialog.show) + // console.log("get dialogShow: "+this.$store.state.dialog.dialog.show) return this.$store.state.dialog.dialog.show; }, set(val) { - console.log("set dialogShow: "+val) + // console.log("set dialogShow: "+val) this.$store.state.dialog.dialog.show = val; } }, dialogMessage: { get() { - console.log("get dialogMessage: "+this.$store.state.dialog.dialog.message) + // console.log("get dialogMessage: "+this.$store.state.dialog.dialog.message) return this.$store.state.dialog.dialog.message; }, }, dialogTitle: { get() { - console.log("get dialogTitle: "+this.$store.state.dialog.dialog.title) + // console.log("get dialogTitle: "+this.$store.state.dialog.dialog.title) return this.$store.state.dialog.dialog.title; }, }, dialogColorBg: { get() { - console.log("get dialogColorBg: " + this.$store.state.dialog.dialog.colorBackground) + // console.log("get dialogColorBg: " + this.$store.state.dialog.dialog.colorBackground) return this.$store.state.dialog.dialog.colorBackground; }, }, dialogColorBtn: { get() { - console.log("get dialogColorBtn: "+this.$store.state.dialog.dialog.colorButton) + // console.log("get dialogColorBtn: "+this.$store.state.dialog.dialog.colorButton) return this.$store.state.dialog.dialog.colorButton; }, } diff --git a/frontend/src/pages/Cache.vue b/frontend/src/pages/Cache.vue index db80dbb..183e401 100644 --- a/frontend/src/pages/Cache.vue +++ b/frontend/src/pages/Cache.vue @@ -5,9 +5,8 @@

{{ isNewCache ? "Neuen Cache erstellen" : "Cache bearbeiten"}}

- - + +

Beschreibung

Belohnung

Stationen

- + {{ index + 1 }} @@ -73,19 +70,19 @@ - {{ tempCache.stationen.length + 1 }} + {{ computedCache.stationen.length + 1 }} - ID: {{ endStation.id ? endStation.id : "keine" }} + ID: {{ computedEndstation.id ? computedEndstation.id : "keine" }} Endstation - Koordinaten: {{ endStation.lattitude }}, {{ endStation.longitude }} + Koordinaten: {{ computedEndstation.lattitude }}, {{ computedEndstation.longitude }} @@ -114,6 +111,8 @@ name: "Cache", data() { return { + // stations: [], + // endStation: {}, //endStation: {}, scrolldown: false, isNewCache: this.$route.params.id === undefined, @@ -128,7 +127,7 @@ created: function () { console.log("isNewCache: " + this.isNewCache); console.log("fetch Caches from Store"); - this.tempCache = JSON.parse(JSON.stringify(this.cache)); + //this.tempCache = JSON.parse(JSON.stringify(this.cache)); }, beforeMount: function () { }, @@ -159,20 +158,32 @@ } }, - cacheToStore() { - // push tempCache to Store - console.log("set Cache"); - this.$store.commit('cacheCollector/SET_CACHE', JSON.parse(JSON.stringify(this.tempCache))); - // this.SET_CACHE(JSON.parse(JSON.stringify(this.tempCache))); - }, + // getStations() { + // console.log("get Stations"); + // let stations = this.computedStations.get(); + // this.stations = stations.filter(station => station.description !== "Endstation"); + // console.log(this.stations); + // this.endStation = stations.filter(station => station.description === "Endstation"); + // console.log(this.endStation); + // }, + // setStations() { + // let stations = this.stations; + // stations.push(this.endStation); + // this.computedStations.set(stations); + // }, + // cacheToStore() { + // // push tempCache to Store + // console.log("set Cache"); + // this.$store.commit('cacheCollector/SET_CACHE', JSON.parse(JSON.stringify(this.tempCache))); + // // this.SET_CACHE(JSON.parse(JSON.stringify(this.tempCache))); + // }, addStation() { this.$router.push({path: '/station'}); - //this.swapComponent(station); - // create Station and add it to array tempCache.stationen }, editStation(index) { console.log("editStation(" + index + ")"); - const station = this.cache.stationen[index]; + console.log(this.$store.getters['cacheCollector/GET_STATIONS']); + const station = this.$store.getters['cacheCollector/GET_STATIONS'][index]; console.log(station); if (station.hasOwnProperty('id')) { //this.$router.push({ path: '/station/'+station.id}); @@ -189,9 +200,9 @@ saveCache() { // commit to store, send to api, if success -> reset store if (this.isNewCache) { - console.log(this.cache); - let cache = this.cache; - cache.stationen.push(this.endStation); + let cache = JSON.parse(JSON.stringify(this.computedCache)); + console.log(cache); + cache.stationen.push(this.computedEndstation); this.$axios.post('/api/createCache', cache) .then((response) => { @@ -227,18 +238,46 @@ }, computed: { ...mapGetters({ - cache: 'cacheCollector/GET_CACHE', - endStation: 'cacheCollector/GET_ENDSTATION' + //cache: 'cacheCollector/GET_CACHE', + //endStation: 'cacheCollector/GET_ENDSTATION' }), - // computedCache: { + // computedStations: { // set(value) { - // console.log("set cache") + // console.log("set stations"); + // this.computedCache.set(value); // }, // get() { - // console.log("get cache"); - // return this.$store.getters.cacheCollector.GET_CACHE + // console.log("get stations"); + // let stations = this.computedCache.stationen; + // return stations.filter(station => station.description !== "Endstation"); // } - // } + // }, + computedCache: { + set(value) { + console.log("set cache"); + this.$store.commit('cacheCollector/SET_CACHE', value); + }, + get() { + console.log("get cache"); + return this.$store.getters['cacheCollector/GET_CACHE']; + } + }, + computedStations: { + set(value) { + this.$store.commit('cacheCollector/SET_STATIONS', value); + }, + get() { + return this.$store.getters['cacheCollector/GET_STATIONS']; + } + }, + computedEndstation: { + set(value) { + this.$store.commit('cacheCollector/SET_ENDSTATION', value); + }, + get() { + return this.$store.getters['cacheCollector/GET_ENDSTATION']; + } + }, } } diff --git a/frontend/src/pages/CacheEnd.vue b/frontend/src/pages/CacheEnd.vue index 8ccc20b..7ba09e1 100644 --- a/frontend/src/pages/CacheEnd.vue +++ b/frontend/src/pages/CacheEnd.vue @@ -5,12 +5,16 @@

{{ end1 + rankingPoints + end2 }}

- + -
Jetzt ist eine gute Zeit, etwas Neues zu beginnen.
+
Deine Belohnung:
+
+ + +
{{ cache.reward.rewardDescription }}
@@ -27,6 +31,9 @@ reward: false, cacheID: "", cacheName: "", + cache: { + reward: "", + }, 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 @@ -45,10 +52,10 @@ this.$axios.get('/api/allCaches') .then((response) => { console.log("/api/allCaches"); - console.log(JSON.stringify(this.data)); - console.log(this.data); + console.log(JSON.stringify(response.data)); console.log(response.data); const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); + this.cache = cache; this.cacheName = cache.name; this.rankingPoints = cache.rankingPoints; this.cacheID = this.$route.params.cache; diff --git a/frontend/src/pages/CacheStart.vue b/frontend/src/pages/CacheStart.vue index 2cc51de..9c525c3 100644 --- a/frontend/src/pages/CacheStart.vue +++ b/frontend/src/pages/CacheStart.vue @@ -67,8 +67,6 @@ this.$axios.get('/api/allCaches') .then((response) => { console.log("/api/allCaches"); - console.log(JSON.stringify(this.data)); - console.log(this.data); console.log(response.data); const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); this.cacheName = cache.name; @@ -97,7 +95,8 @@ params.cacheID = this.result.split('/')[0]; params.stationID = this.result.split('/')[1]; params.durchgefuehrterCacheID = this.cacheID; - console.log(params.cacheID + " und " + params.stationID); + 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; } @@ -126,8 +125,14 @@ this.$axios.get('/api/checkStation', {params}) .then((response) => { console.log("resolve(true)"); + console.log("cache access definition"); + console.log(response.data.cacheAccesDefinition); resolve(true); - this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`}); + 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 diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 881b3d7..56efa31 100644 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -1,12 +1,12 @@