feat:重复绑定根据状态码关闭窗口
This commit is contained in:
@@ -31,12 +31,20 @@ watch(
|
|||||||
scheme.value = "QQ";
|
scheme.value = "QQ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (type.value === "0") {
|
try {
|
||||||
const { data } = await authOtherLogin({ code: val }, scheme.value);
|
if (type.value === "0") {
|
||||||
authData.value = data;
|
const { data } = await authOtherLogin({ code: val }, scheme.value);
|
||||||
} else if (type.value === "1") {
|
authData.value = data;
|
||||||
const { data } = await authOtherBind({ code: val }, scheme.value);
|
} else if (type.value === "1") {
|
||||||
authData.value = data;
|
const { data } = await authOtherBind({ code: val }, scheme.value);
|
||||||
|
authData.value = data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.status === 403) {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.close();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
authData: JSON.stringify(authData.value),
|
authData: JSON.stringify(authData.value),
|
||||||
|
|||||||
@@ -318,6 +318,16 @@ const handleGiteeLogin = () => {
|
|||||||
"width=500,height=500,left=50,top=50"
|
"width=500,height=500,left=50,top=50"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.addEventListener("message", async (e) => {
|
||||||
|
const { authData, type } = e.data;
|
||||||
|
console.log("我是登录页", authData);
|
||||||
|
console.log("我是登录页", type);
|
||||||
|
if (e.data) {
|
||||||
|
await checkList();
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.login {
|
.login {
|
||||||
|
|||||||
@@ -131,10 +131,7 @@ const handleGiteeLogin = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("message", async (e) => {
|
window.addEventListener("message", async (e) => {
|
||||||
console.log(e, "我是账号设置页");
|
|
||||||
const { authData, type } = e.data;
|
|
||||||
if (e.data) {
|
if (e.data) {
|
||||||
console.log(authData, type, "2333");
|
|
||||||
await checkList();
|
await checkList();
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user