modal implementation #12

Merged
vincent merged 10 commits from dev into master 2019-05-11 14:21:09 +00:00
4 changed files with 23 additions and 16 deletions
Showing only changes of commit a0481fb8eb - Show all commits

View File

@ -73,8 +73,8 @@
</div> </div>
</div> </div>
</div> </div>
<modalLogin v-bind:show="showModalLogin" @close="showModalLogin = false" /> <modalLogin v-show="showModalLogin" @close="showModalLogin = false" />
<modal v-bind:show="showModal" @close="showModal = false">{{modalmessage}}</modal> <modal v-show="showModal" @close="showModal = false">{{modalmessage}}</modal>
</div> </div>
</template> </template>
@ -82,6 +82,7 @@
import { putparsechaine } from '../api'; import { putparsechaine } from '../api';
import modalLogin from './modalLogin' import modalLogin from './modalLogin'
import modal from './modal' import modal from './modal'
import { EventBus } from '../utils';
export default { export default {
name: 'chainetv', name: 'chainetv',
@ -145,6 +146,11 @@ export default {
return true; return true;
}, },
}, },
mounted() {
EventBus.$on('showmodallogin',()=>{
this.showModalLogin=true;
})
},
}; };
</script> </script>
<style > <style >

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div v-bind:class="{'is-active':show}" class="modal"> <div class="modal is-active">
<div class="modal-background"></div> <div class="modal-background"></div>
<button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button> <button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button>
<div class="modal-content box"> <div class="modal-content box">
@ -12,9 +12,7 @@
<script> <script>
export default { export default {
props:{
show:false,
},
}; };
</script> </script>

View File

@ -1,13 +1,13 @@
<!-- components/Login.vue --> <!-- components/Login.vue -->
<template> <template>
<modal v-bind:show="show" @close="$emit('close')"> <modal @close="$emit('close')">
<div class="hero is-success"> <div class="hero is-success">
<div class="hero-body has-text-centered"> <div class="hero-body has-text-centered">
<h2 class="title">Login</h2> <h2 class="title">Login</h2>
<p class="subtitle error-msg">{{ errorMsg }}</p> <p class="subtitle error-msg">{{ errorMsg }}</p>
</div> </div>
</div> </div>
<section class="section"> <section v-on:keyup.enter="authenticate" class="section">
<div class="field"> <div class="field">
<label class="label" for="name">Name:</label> <label class="label" for="name">Name:</label>
<div class="control"> <div class="control">
@ -32,9 +32,6 @@
import { EventBus } from '../utils'; import { EventBus } from '../utils';
import modal from './modal' import modal from './modal'
export default { export default {
props:{
show:false,
},
data() { data() {
return { return {
name: "", name: "",

View File

@ -3,6 +3,7 @@ import Router from 'vue-router';
import ping from '@/components/ping'; import ping from '@/components/ping';
import chainetv from '@/components/chainetv'; import chainetv from '@/components/chainetv';
import store from '@/store'; import store from '@/store';
import { EventBus } from '../utils';
Vue.use(Router); Vue.use(Router);
export default new Router({ export default new Router({
@ -17,12 +18,17 @@ export default new Router({
name: 'ping', name: 'ping',
component: ping, component: ping,
beforeEnter(to, from, next) { beforeEnter(to, from, next) {
if (!store.getters.isAuthenticated) { autent(to,from,next)
next('/')
} else {
next();
}
}, },
}, },
], ],
}); });
function autent(to,from,next) {
if (!store.getters.isAuthenticated) {
next('/')
EventBus.$emit("showmodallogin")
} else {
next();
}
}