design baruser
This commit is contained in:
parent
d53f17ef3b
commit
e59429ddd6
|
@ -1,55 +1,90 @@
|
||||||
<template>
|
<template>
|
||||||
<v-content>
|
<v-content>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-card raised shaped>
|
<v-card v-for="user in users" :key="user.id" raised shaped>
|
||||||
<v-container>
|
|
||||||
<v-row>
|
<v-list-item three-line>
|
||||||
<v-col align-self="center">
|
<v-list-item-content>
|
||||||
<v-container>
|
<v-list-item-title class="title">{{user.firstname}} {{user.lastname}}</v-list-item-title>
|
||||||
<v-btn>Col 1</v-btn>
|
<v-row>
|
||||||
</v-container>
|
<v-spacer/>
|
||||||
</v-col>
|
<v-row>
|
||||||
<v-row>
|
<v-col>
|
||||||
<v-col>
|
<v-container>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-btn>Col 2.1.1</v-btn>
|
<v-btn @click="addAmount(user.username, 200)" :color="color">2 €</v-btn>
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-btn>Col 2.1.2</v-btn>
|
<v-btn @click="addAmount(user.username, 100)" :color="color">1 €</v-btn>
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-container>
|
||||||
<v-col>
|
</v-col>
|
||||||
<v-row>
|
<v-col>
|
||||||
<v-btn>Col 2.2.1</v-btn>
|
<v-container>
|
||||||
</v-row>
|
<v-row>
|
||||||
<v-row>
|
<v-container>
|
||||||
<v-btn>Col 2.2.2</v-btn>
|
<v-btn @click="addAmount(user.username, 50)" :color="color">0,50 €</v-btn>
|
||||||
</v-row>
|
</v-container>
|
||||||
</v-col>
|
</v-row>
|
||||||
<v-col>
|
<v-row>
|
||||||
<v-row>
|
<v-container>
|
||||||
<v-btn>Col 2.3.1</v-btn>
|
<v-btn @click="addAmount(user.username, 40)" :color="color">0,40 €</v-btn>
|
||||||
</v-row>
|
</v-container>
|
||||||
<v-row>
|
</v-row>
|
||||||
<v-btn>Col 2.3.2</v-btn>
|
</v-container>
|
||||||
</v-row>
|
</v-col>
|
||||||
</v-col>
|
<v-col>
|
||||||
</v-row>
|
<v-container>
|
||||||
<v-col><v-btn>Col 3</v-btn></v-col>
|
<v-row>
|
||||||
</v-row>
|
<v-container>
|
||||||
</v-container>
|
<v-btn @click="addAmount(user.username, 20)" :color="color">0,20 €</v-btn>
|
||||||
</v-card>
|
</v-container>
|
||||||
|
</v-row>
|
||||||
|
<v-row>
|
||||||
|
<v-container>
|
||||||
|
<v-btn @click="addAmount(user.username, 10)" :color="color">0,10 €</v-btn>
|
||||||
|
</v-container>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-col align-self="center">
|
||||||
|
<v-container>
|
||||||
|
<v-row>
|
||||||
|
<v-container>
|
||||||
|
<v-list-item-action-text class="title">{{(user.amount/100).toFixed(2)}} €</v-list-item-action-text>
|
||||||
|
</v-container>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-list-item-content>
|
||||||
|
</v-list-item>
|
||||||
|
</v-card>
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-content>
|
</v-content>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "CreditLists"
|
name: "CreditLists",
|
||||||
|
props: {
|
||||||
|
users: Array
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
color: 'green accent-4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addAmount(username, amount) {
|
||||||
|
this.$emit("add:amount", username, amount)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,12 @@ class Service {
|
||||||
login(loginData) {
|
login(loginData) {
|
||||||
return axios.post(this.url+'login', {...loginData})
|
return axios.post(this.url+'login', {...loginData})
|
||||||
}
|
}
|
||||||
|
getUserBar(token) {
|
||||||
|
return axios.get(this.url+'bar', {headers: {Token: token}})
|
||||||
|
}
|
||||||
|
addAmountBar(token, data) {
|
||||||
|
return axios.post(this.url+'baradd', ...data, {headers: {Token: token}})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpClient = new Service("http://192.168.5.118:5000/")
|
const httpClient = new Service("http://192.168.5.118:5000/")
|
||||||
|
|
|
@ -1,33 +1,61 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<TitleBar/>
|
<TitleBar/>
|
||||||
<CreditLists></CreditLists>
|
<CreditLists v-bind:users="users" @add:amount="addAmount"></CreditLists>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TitleBar from "@/components/TitleBar";
|
import TitleBar from "@/components/TitleBar";
|
||||||
import axios from 'axios'
|
|
||||||
import CreditLists from "@/components/baruser/CreditLists";
|
import CreditLists from "@/components/baruser/CreditLists";
|
||||||
|
import httpClient from "../plugins/restService";
|
||||||
|
import axios from "axios";
|
||||||
export default {
|
export default {
|
||||||
name: "BarView",
|
name: "BarView",
|
||||||
components: {CreditLists, TitleBar},
|
components: {CreditLists, TitleBar},
|
||||||
created() {
|
created() {
|
||||||
this.getUser()
|
this.getUser()
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
users: []
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getUser() {
|
getUser() {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(this.$store.getters.getToken)
|
httpClient.getUserBar(this.$store.getters.getToken)
|
||||||
axios.get("http://localhost:5000/bar", {headers: {Token: this.$store.getters.getToken}})
|
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
|
for (let user in response.data) {
|
||||||
|
const lastId = this.users.length > 0 ? this.users[this.users.length - 1].id : 0
|
||||||
|
this.users.push({
|
||||||
|
id: lastId + 1,
|
||||||
|
username: response.data[user].username,
|
||||||
|
firstname: response.data[user].firstname,
|
||||||
|
lastname: response.data[user].lastname,
|
||||||
|
amount: response.data[user].amount
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
this.users = []
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
addAmount(username, amount) {
|
||||||
|
axios.post('http://192.168.5.118:5000/baradd', {userId: username, amount: amount}, {headers: {Token: this.$store.getters.getToken}})
|
||||||
|
//httpClient.addAmountBar(this.$store.getters.getToken, {username: username, amount: amount})
|
||||||
|
/*.then(response => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log("responsedata: ", response.data)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log("error: ", error.response.data.error)
|
||||||
|
})*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue