未验证 提交 cd30d254 编写于 作者: 花裤衩 提交者: GitHub

perf[Login]: support other query (#2013)

上级 d0fcbbaa
......@@ -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
}
......@@ -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(() => {
......@@ -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') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册