feat:授权成功后也关闭弹窗
This commit is contained in:
@@ -15,6 +15,11 @@ const type = ref(route.query.state);
|
|||||||
const message = ref("");
|
const message = ref("");
|
||||||
const scheme = ref("");
|
const scheme = ref("");
|
||||||
const authData = ref("");
|
const authData = ref("");
|
||||||
|
const closeWindow = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.close();
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
watch(
|
watch(
|
||||||
() => code.value,
|
() => code.value,
|
||||||
async (val) => {
|
async (val) => {
|
||||||
@@ -41,17 +46,15 @@ watch(
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.status === 403) {
|
if (error.status === 403) {
|
||||||
setTimeout(() => {
|
closeWindow();
|
||||||
window.close();
|
|
||||||
}, 3000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
authData: JSON.stringify(authData.value),
|
authData: JSON.stringify(authData.value),
|
||||||
type: scheme.value,
|
type: scheme.value,
|
||||||
});
|
});
|
||||||
console.log(authData.value, "我是打开的窗口页");
|
|
||||||
message.value = "授权成功";
|
message.value = "授权成功";
|
||||||
|
closeWindow();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user