wyling007 3 rokov pred
rodič
commit
2dd769fbbf
1 zmenil súbory, kde vykonal 21 pridanie a 19 odobranie
  1. 21 19
      src/route/guard.ts

+ 21 - 19
src/route/guard.ts

@@ -26,26 +26,28 @@ const guard = (router: Router) => {
 		} catch (error) {
 			//监听到登陆事件
 			if (to.query.state === "LOGIN") {
-				const toast = Toast.loading({
-					duration: 0, // 持续展示 toast
-					forbidClick: true,
-					message: "登陆中",
-				});
-				try {
-					await useLogin(to.query);
-					toast.message = `登陆成功`;
-					setTimeout(() => {
-						Toast.clear();
-					}, 500);
-				} catch (error) {
-					toast.message = `登陆失败`;
-					setTimeout(() => {
-						Toast.clear();
-						location.reload();
-					}, 1000);
-				}
+				setTimeout(async () => {
+					const toast = Toast.loading({
+						duration: 0, // 持续展示 toast
+						forbidClick: true,
+						message: "登陆中",
+					});
+					try {
+						await useLogin(to.query);
+						toast.message = `登陆成功`;
+						setTimeout(() => {
+							Toast.clear();
+						}, 500);
+					} catch (error) {
+						toast.message = `登陆失败`;
+						setTimeout(() => {
+							Toast.clear();
+							location.reload();
+						}, 1000);
+					}
+				}, 300);
 			} else {
-				location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx67ca1b8c9816ef28&redirect_uri=${location.origin + location.pathname}&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`);
+				location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx67ca1b8c9816ef28&redirect_uri=${location.href}&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`);
 			}
 		}