From a582eec089c00e966741cc49590f81c1cd727fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 20 May 2019 11:21:07 +0800 Subject: [PATCH] perf[Login]: support other query (#2013) --- src/views/login/index.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 27f11ef5..7c16db67 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -116,13 +116,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 } @@ -169,7 +174,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(() => { @@ -180,6 +185,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') {