File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,8 @@ export default {
258
258
// 设置登录中
259
259
this .loading = true ;
260
260
// 计算 redirectUri
261
- const redirectUri = location .origin + ' /social-login?type=' + socialTypeEnum .type + ' &redirect=' + (this .redirect || " /" ); // 重定向不能丢
261
+ const redirectUri = location .origin + ' /social-login?'
262
+ + encodeURIComponent (' type=' + socialTypeEnum .type + ' &redirect=' + (this .redirect || " /" )); // 重定向不能丢
262
263
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
263
264
// const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
264
265
// 进行跳转
Original file line number Diff line number Diff line change @@ -104,24 +104,19 @@ export default {
104
104
state: undefined ,
105
105
};
106
106
},
107
- // watch: {
108
- // $route: {
109
- // handler: function(route) {
110
- // this.redirect = route.query && route.query.redirect;
111
- // },
112
- // immediate: true
113
- // }
114
- // },
115
107
created () {
116
108
this .getCookie ();
117
109
// 验证码开关
118
110
this .captchaEnable = getCaptchaEnable ();
119
111
// 重定向地址
120
- this .redirect = this .$route . query . redirect ? decodeURIComponent ( this . $route . query . redirect ) : undefined ;
112
+ this .redirect = this .getUrlValue ( ' redirect' ) ;
121
113
// 社交登录相关
122
- this .type = this .$route . query . type ;
114
+ this .type = this .getUrlValue ( ' type' ) ;
123
115
this .code = this .$route .query .code ;
124
116
this .state = this .$route .query .state ;
117
+
118
+ // 尝试登录一下
119
+ this .loading = true ;
125
120
this .$store .dispatch (" SocialLogin" , {
126
121
code: this .code ,
127
122
state: this .state ,
@@ -183,6 +178,10 @@ export default {
183
178
});
184
179
}
185
180
});
181
+ },
182
+ getUrlValue (key ) {
183
+ const url = new URL (decodeURIComponent (location .href ));
184
+ return url .searchParams .get (key);
186
185
}
187
186
}
188
187
};
You can’t perform that action at this time.
0 commit comments