Skip to content

Commit 8397393

Browse files
PanJiaChenmarxangels
authored andcommitted
perf[Login]: support other query (PanJiaChen#2013)
1 parent 559ac4e commit 8397393

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/views/login/index.vue

+16-3
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,18 @@ export default {
108108
capsTooltip: false,
109109
loading: false,
110110
showDialog: false,
111-
redirect: undefined
111+
redirect: undefined,
112+
otherQuery: {}
112113
}
113114
},
114115
watch: {
115116
$route: {
116117
handler: function(route) {
117-
this.redirect = route.query && route.query.redirect
118+
const query = route.query
119+
if (query) {
120+
this.redirect = query.redirect
121+
this.otherQuery = this.getOtherQuery(query)
122+
}
118123
},
119124
immediate: true
120125
}
@@ -161,7 +166,7 @@ export default {
161166
this.loading = true
162167
this.$store.dispatch('user/login', this.loginForm)
163168
.then(() => {
164-
this.$router.push({ path: this.redirect || '/' })
169+
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
165170
this.loading = false
166171
})
167172
.catch(() => {
@@ -172,6 +177,14 @@ export default {
172177
return false
173178
}
174179
})
180+
},
181+
getOtherQuery(query) {
182+
return Object.keys(query).reduce((acc, cur) => {
183+
if (cur !== 'redirect') {
184+
acc[cur] = query[cur]
185+
}
186+
return acc
187+
}, {})
175188
}
176189
// afterQRScan() {
177190
// if (e.key === 'x-admin-oauth-code') {

0 commit comments

Comments
 (0)