perf[Login]: support other query (#2013)
This commit is contained in:
parent
c85ce21951
commit
a582eec089
|
@ -116,13 +116,18 @@ export default {
|
||||||
capsTooltip: false,
|
capsTooltip: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
redirect: undefined
|
redirect: undefined,
|
||||||
|
otherQuery: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route: {
|
$route: {
|
||||||
handler: function(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
|
immediate: true
|
||||||
}
|
}
|
||||||
|
@ -169,7 +174,7 @@ export default {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.$store.dispatch('user/login', this.loginForm)
|
this.$store.dispatch('user/login', this.loginForm)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -180,6 +185,14 @@ export default {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
getOtherQuery(query) {
|
||||||
|
return Object.keys(query).reduce((acc, cur) => {
|
||||||
|
if (cur !== 'redirect') {
|
||||||
|
acc[cur] = query[cur]
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
}
|
}
|
||||||
// afterQRScan() {
|
// afterQRScan() {
|
||||||
// if (e.key === 'x-admin-oauth-code') {
|
// if (e.key === 'x-admin-oauth-code') {
|
||||||
|
|
Loading…
Reference in New Issue