Skip to content

Commit a582eec

Browse files
committed
perf[Login]: support other query (#2013)
1 parent c85ce21 commit a582eec

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/views/login/index.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,18 @@ export default {
116116
capsTooltip: false,
117117
loading: false,
118118
showDialog: false,
119-
redirect: undefined
119+
redirect: undefined,
120+
otherQuery: {}
120121
}
121122
},
122123
watch: {
123124
$route: {
124125
handler: function(route) {
125-
this.redirect = route.query && route.query.redirect
126+
const query = route.query
127+
if (query) {
128+
this.redirect = query.redirect
129+
this.otherQuery = this.getOtherQuery(query)
130+
}
126131
},
127132
immediate: true
128133
}
@@ -169,7 +174,7 @@ export default {
169174
this.loading = true
170175
this.$store.dispatch('user/login', this.loginForm)
171176
.then(() => {
172-
this.$router.push({ path: this.redirect || '/' })
177+
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
173178
this.loading = false
174179
})
175180
.catch(() => {
@@ -180,6 +185,14 @@ export default {
180185
return false
181186
}
182187
})
188+
},
189+
getOtherQuery(query) {
190+
return Object.keys(query).reduce((acc, cur) => {
191+
if (cur !== 'redirect') {
192+
acc[cur] = query[cur]
193+
}
194+
return acc
195+
}, {})
183196
}
184197
// afterQRScan() {
185198
// if (e.key === 'x-admin-oauth-code') {

0 commit comments

Comments
 (0)