Skip to content

Commit

Permalink
perf[Login]: support other query (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen authored May 20, 2019
1 parent d0fcbba commit cd30d25
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ export default {
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined
redirect: undefined,
otherQuery: {}
}
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect
const query = route.query
if (query) {
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
}
},
immediate: true
}
Expand Down Expand Up @@ -161,7 +166,7 @@ export default {
this.loading = true
this.$store.dispatch('user/login', this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || '/' })
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
this.loading = false
})
.catch(() => {
Expand All @@ -172,6 +177,14 @@ export default {
return false
}
})
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== 'redirect') {
acc[cur] = query[cur]
}
return acc
}, {})
}
// afterQRScan() {
// if (e.key === 'x-admin-oauth-code') {
Expand Down

0 comments on commit cd30d25

Please sign in to comment.