From e18121ddfcf4384fa66a38fd7a935edfb3d3b856 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 2 Mar 2021 06:08:23 +0100 Subject: [PATCH 1/4] fix creation 1000 GDD for max musterman --- community_server | 2 +- frontend/src/store/store.js | 2 +- frontend/src/views/KontoOverview/GddStatus.vue | 6 +++++- login_server | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/community_server b/community_server index 7ec49de34..36ddbba58 160000 --- a/community_server +++ b/community_server @@ -1 +1 @@ -Subproject commit 7ec49de346b59ed73fa069b0cc4ee8ee927b77e6 +Subproject commit 36ddbba5815435575b2d3c1270d738ccabc9eb54 diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 1b8c18426..cb85c42c5 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -42,7 +42,7 @@ export const store = new Vuex.Store({ }, user_balance: (state,balance) => { console.log('mutation: user_balance') - state.user.balance = balance + state.user.balance = balance / 10000 }, transactions: (state,transactions) => { console.log('mutation: transactions') diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index 2b09755be..bffb6933a 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -6,7 +6,7 @@ type="gradient-red" sub-title="balance_gdd" class="mb-4"> - {{ balance_gdd }} GDD + {{ $store.state.user.balance.toFixed(4) }} GDD @@ -36,5 +36,9 @@ export default { balance_gdt: "0", } }, + mounted() { + + this.$store.dispatch('accountBalance') + }, }; \ No newline at end of file diff --git a/login_server b/login_server index 66dcb3a68..9b9115290 160000 --- a/login_server +++ b/login_server @@ -1 +1 @@ -Subproject commit 66dcb3a68397662c15729d559d64b4781a5e2f40 +Subproject commit 9b9115290c8d2ead756d64b70ae63a6571aa4693 From 345c0f09d9546a9be3f5090070c77122b9922806 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 2 Mar 2021 10:24:04 +0100 Subject: [PATCH 2/4] add transactionslist scelet --- frontend/src/App.vue | 2 +- frontend/src/routes/routes.js | 14 +- frontend/src/store/store.js | 40 +++- frontend/src/views/KontoOverview.vue | 100 +--------- frontend/src/views/KontoOverview/GddSent.vue | 174 ++++++++---------- .../src/views/KontoOverview/GddStatus.vue | 7 +- frontend/src/views/KontoOverview/GddTable.vue | 38 ++-- frontend/src/views/Pages/Login.vue | 1 + frontend/src/views/{ => Pages}/thx.vue | 0 9 files changed, 147 insertions(+), 229 deletions(-) rename frontend/src/views/{ => Pages}/thx.vue (100%) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index bb9330920..41b504ec1 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -17,7 +17,7 @@ export default { this.$store.state.email = this.$cookies.get('gdd_u') this.$router.push('/KontoOverview') }else { - this.$router.push("/Login") + this.$router.push("/Login") } } } diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 15de73163..844b323b6 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -8,23 +8,23 @@ import NotFound from '@/views/NotFoundPage.vue' const routes = [ { path: '/', - redirect: 'landing', + redirect: 'login', component: AuthLayoutGDD, children: [ { path: '/login', name: 'login', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Login.vue') + component: () => import('../views/Pages/Login.vue') }, { path: '/thx', name: 'Thanks', - component: () => import(/* webpackChunkName: "demo" */ '../views/thx.vue') + component: () => import('../views/Pages/thx.vue') }, { path: '/register', name: 'register', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Register.vue') + component: () => import('../views/Pages/Register.vue') }, ] }, @@ -36,7 +36,7 @@ const routes = [ { path: '/KontoOverview', name: 'Kontoübersicht', - component: () => import(/* webpackChunkName: "demo" */ '../views/KontoOverview.vue'), + component: () => import('../views/KontoOverview.vue'), meta: { requiresAuth: true } @@ -44,7 +44,7 @@ const routes = [ { path: '/profile', name: 'profile', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/UserProfile.vue') + component: () => import('../views/Pages/UserProfile.vue') } ] }, @@ -57,7 +57,7 @@ const routes = [ { path: '/AdminOverview', name: 'Adminübersicht', - component: () => import(/* webpackChunkName: "demo" */ '../views/AdminOverview.vue'), + component: () => import('../views/AdminOverview.vue'), meta: { requiresAuth: true } diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index cb85c42c5..848ce1e4b 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -4,6 +4,8 @@ Vue.use(Vuex) import router from '../routes/router.js' import loginAPI from '../apis/loginAPI' import communityAPI from '../apis/communityAPI' +import axios from 'axios' + export const store = new Vuex.Store({ state: { @@ -11,7 +13,8 @@ export const store = new Vuex.Store({ email: null, user : { name:"", - balance: 0 + balance: 0, + balance_gdt: 0 }, ajaxCreateData: { session_id : '', @@ -44,6 +47,10 @@ export const store = new Vuex.Store({ console.log('mutation: user_balance') state.user.balance = balance / 10000 }, + user_balance_gdt: (state,balance) => { + console.log('mutation: user_balance_gdt') + state.user.balance_gdt = balance / 10000 + }, transactions: (state,transactions) => { console.log('mutation: transactions') state.transactions = transactions @@ -110,14 +117,29 @@ export const store = new Vuex.Store({ } }, ajaxListTransactions: async ({commit, dispatch, state}) => { - console.log('action: ajaxListTransactions') - const result = await communityAPI.transactions(state.session_id) - console.log(result) - if(result.success) { - commit('transactions', result.result.data.transactions) - } else { - dispatch('logout') - } + console.log('action: ajaxListTransactions', state.session_id) + // const result = await communityAPI.transactions(state.session_id) + + axios.get("http://localhost/state-balances/ajaxListTransactions/"+ state.session_id).then((result) => { + console.log("result",result) + console.log("result.state",result.data.state) + + console.log("result.data.state == 'success'",result.data.state == "success") + if(result.data.state == "success") { + console.log("result.count",result.data.count) + console.log("result.gdtSum",result.data.gdtSum) + console.log("result.transactions",result.data.transactions) + commit('transactions', result.data.transactions) + commit('user_balance_gdt', result.data.gdtSum) + } else { + dispatch('logout') + } + + }, (error) => { + console.log(error); + }); + + }, accountBalance: async ({ commit, dispatch, state }) => { console.log('action: accountBalance') diff --git a/frontend/src/views/KontoOverview.vue b/frontend/src/views/KontoOverview.vue index 4cfcddfe7..130f7e6fa 100644 --- a/frontend/src/views/KontoOverview.vue +++ b/frontend/src/views/KontoOverview.vue @@ -8,21 +8,18 @@ -
-
+
-
-
+
-

@@ -34,35 +31,7 @@
this.$store.dispatch('ajaxListTransactions')
this.$store.dispatch('accountBalance')

-

User Balanace

- this.$store.state.user.balance -

- {{this.$store.state.user}} -

-
-

User Balanace

- this.$store.state.user.balance -

- {{this.$store.state.user.balance}} -

- -
-

User Transactions List

- this.$store.state.transactions -

- {{this.$store.state.transactions}} -

- - -
-

User Participation List

- /public/json-example/userparticipation.json -

- {{userparticipation}} -

- - -
+ diff --git a/frontend/src/views/KontoOverview/GddSent.vue b/frontend/src/views/KontoOverview/GddSent.vue index 79c4ad32d..0f6cbfec0 100644 --- a/frontend/src/views/KontoOverview/GddSent.vue +++ b/frontend/src/views/KontoOverview/GddSent.vue @@ -1,79 +1,68 @@ diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index bffb6933a..1803d1149 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -15,9 +15,9 @@ - {{ balance_gdt }} GDT + {{ $store.state.user.balance_gdt.toFixed(4) }} GDT @@ -33,11 +33,10 @@ export default { data(){ return { balance_gdd: this.$store.state.user.balance, - balance_gdt: "0", + balance_gdt: this.$store.state.user.balance_gdt, } }, mounted() { - this.$store.dispatch('accountBalance') }, }; diff --git a/frontend/src/views/KontoOverview/GddTable.vue b/frontend/src/views/KontoOverview/GddTable.vue index ccc29d67e..7d02dfc82 100644 --- a/frontend/src/views/KontoOverview/GddTable.vue +++ b/frontend/src/views/KontoOverview/GddTable.vue @@ -1,9 +1,9 @@ diff --git a/frontend/src/views/KontoOverview/GddSent.vue b/frontend/src/views/KontoOverview/GddSent.vue index 0f6cbfec0..a90ceb563 100644 --- a/frontend/src/views/KontoOverview/GddSent.vue +++ b/frontend/src/views/KontoOverview/GddSent.vue @@ -162,16 +162,17 @@ export default { async onSubmit() { //event.preventDefault() console.log("onSubmit", this.form) - console.log("this.form.img", this.form.img) - console.log("this.form.email", this.form.email) - console.log("this.form.amount", this.form.amount) - console.log("this.form.memo", this.form.memo) + //console.log("this.form.img", this.form.img) + //console.log("this.form.email", this.form.email) + //console.log("this.form.amount", this.form.amount) + //console.log("this.form.memo", this.form.memo) this.$store.state.ajaxCreateData.session_id = this.$cookies.get('gdd_session_id') - this.$store.state.ajaxCreateData.email = this.form.email, - this.$store.state.ajaxCreateData.amount = this.form.amount, - this.$store.state.ajaxCreateData.memo = this.form.memo, - + this.$store.state.ajaxCreateData.email = this.form.email + this.$store.state.ajaxCreateData.amount = this.form.amount + this.$store.state.ajaxCreateData.memo = this.form.memo + this.$store.state.ajaxCreateData.target_date = Date.now() + this.$store.dispatch('ajaxCreate') }, onReset(event) { diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index 1803d1149..02a17e894 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -6,7 +6,7 @@ type="gradient-red" sub-title="balance_gdd" class="mb-4"> - {{ $store.state.user.balance.toFixed(4) }} GDD + {{ setComma($store.state.user.balance) }} GDD @@ -17,7 +17,7 @@ type="gradient-orange" sub-title="balance_gdt" class="mb-4"> - {{ $store.state.user.balance_gdt.toFixed(4) }} GDT + {{ setComma($store.state.user.balance_gdt) }} GDT @@ -36,8 +36,11 @@ export default { balance_gdt: this.$store.state.user.balance_gdt, } }, - mounted() { - this.$store.dispatch('accountBalance') + methods: { + setComma(int){ + return int / 10000 + + } }, }; \ No newline at end of file diff --git a/frontend/src/views/KontoOverview/GddTable.vue b/frontend/src/views/KontoOverview/GddTable.vue index 7d02dfc82..55ebc71b0 100644 --- a/frontend/src/views/KontoOverview/GddTable.vue +++ b/frontend/src/views/KontoOverview/GddTable.vue @@ -3,7 +3,7 @@