Merge branch 'master' of ubkavh-192.ubka.uni-karlsruhe.de:kbtoku/lrc-frontend

This commit is contained in:
Tobias Kurze
2019-10-28 08:21:07 +01:00
7 changed files with 89 additions and 28 deletions

View File

@@ -1,7 +1,19 @@
<!-- components/Profile.vue -->
<!-- components/Test.vue -->
<template>
<div>
<h1>Toller Test</h1>
<b-alert
:show="dismissCountDown"
dismissible
variant="warning"
@dismissed="dismissCountDown=0"
@dismiss-count-down="countDownChanged"
>
This alert will dismiss after {{ dismissCountDown }} seconds...
</b-alert>
<b-button @click="showAlert" variant="info" class="m-1">
Show alert with count-down timer
</b-button>
<h1>Toller Test</h1>
<span>{{ $socket.connected ? 'Connected' : 'Disconnected' }}</span>
<button v-if="$socket.connected" @click="disconnectWebsocket">Disconnect</button>
<button v-else="$socket.connected" @click="connectWebsocket">Connect</button>
@@ -9,16 +21,20 @@
<button v-if="$socket.connected" @click="sendWsMessage('Tolle Test Nachricht')">Send Message</button>
</p>
</div>
</template>
<script>
import {EventBus} from '@/utils';
export default {
data() {
return {
email: '',
dismissSecs: 5,
dismissCountDown: 0,
};
},
@@ -27,18 +43,24 @@
this.$i18n.locale = locale;
// Vue.$moment.locale(locale);
},
sendWsMessage(msg){
console.log("sending msg: "+ msg);
sendWsMessage(msg) {
console.log("sending msg: " + msg);
this.$socket.client.emit('my_event', msg, (resp) => {
console.log(resp);
});
},
connectWebsocket(){
connectWebsocket() {
this.$socket.client.connect();
},
disconnectWebsocket(){
disconnectWebsocket() {
this.$socket.client.disconnect();
}
},
countDownChanged(dismissCountDown) {
this.dismissCountDown = dismissCountDown;
},
showAlert() {
this.dismissCountDown = this.dismissSecs;
},
},
mounted() {
this.$socket.client.on('my_event', (msg) => {
@@ -71,6 +93,7 @@
color: red;
font-weight: bold;
}
.lang-btn {
padding: 15px;
border: 2px solid green;