refs #48 Add escape button in login and authorize

This commit is contained in:
AkiraFukushima 2018-03-20 22:12:06 +09:00
parent 2b3d8c7c1d
commit bda4e80f2d
4 changed files with 45 additions and 1 deletions

View File

@ -1,5 +1,10 @@
<template>
<div id="authorize">
<div class="close">
<el-button type="text" @click="close">
<i class="el-icon-close"></i>
</el-button>
</div>
<el-form ref="form" :model="authorizeForm" label-width="120px" label-position="top" class="authorize-form" v-on:submit.prevent="authorizeSubmit">
<el-form-item label="Please paste authorization code from your browser:">
<el-input v-model="authorizeForm.code"></el-input>
@ -33,6 +38,9 @@ export default {
type: 'error'
})
})
},
close () {
return this.$router.push({ path: '/' })
}
}
}

View File

@ -1,5 +1,10 @@
<template>
<div id="login">
<div class="close">
<el-button type="text" @click="close">
<i class="el-icon-close"></i>
</el-button>
</div>
<instance-form v-if="page == 1"></instance-form>
<login-form v-if="page == 2"></login-form>
</div>
@ -12,12 +17,17 @@ import { mapState } from 'vuex'
export default {
name: 'login',
components: { InstanceForm, LoginForm },
computed: {
...mapState({
page: state => state.Login.page
})
},
components: { InstanceForm, LoginForm }
methods: {
close () {
return this.$router.push({ path: '/' })
}
}
}
</script>
@ -35,6 +45,10 @@ html, body, #app {
text-align: center;
min-height: 100%;
.close {
text-align: right;
}
.el-form-item__label {
color: #f0f3f9;
}

View File

@ -67,6 +67,10 @@ export default {
})
},
beforeDestroy () {
this.$store.dispatch('TimelineSpace/clearAccount')
this.$store.dispatch('TimelineSpace/clearUsername')
this.$store.commit('TimelineSpace/clearTimeline')
this.$store.commit('TimelineSpace/clearNotifications')
this.$store.dispatch('TimelineSpace/stopUserStreaming')
this.$store.dispatch('TimelineSpace/removeShortcutEvents')
}

View File

@ -75,6 +75,12 @@ const TimelineSpace = {
return notification
}
})
},
clearTimeline (state) {
state.timeline = []
},
clearNotifications (state) {
state.notifications = []
}
},
actions: {
@ -171,6 +177,18 @@ const TimelineSpace = {
resolve(res)
})
})
},
clearAccount ({ commit }) {
commit(
'updateAccount',
{
domain: '',
_id: ''
}
)
},
clearUsername ({ commit }) {
commit('updateUsername', '')
}
}
}