Skip to content

Commit 56896a9

Browse files
Bugfix captcha dialog
1 parent a859a61 commit 56896a9

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

admin/src/router/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const REDIRECT_ROUTE_NAME = 'Redirect';
22

3-
export const DEFAULT_ROUTE_NAME = 'dashboard';
3+
export const DEFAULT_ROUTE_NAME = 'Dashboard';
44

55
export const NOT_FOUND_ROUTE_NAME = 'notFound';
66

site/src/components/CaptchaDialog.vue

+16-21
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,19 @@ const props = defineProps({
4747
4848
const visible = ref(false);
4949
const captcha = ref(null);
50+
let resolveCallback = null;
5051
5152
const show = async () => {
52-
try {
53-
captcha.value = await useHttpGet("/api/captcha/request_angle");
54-
visible.value = true;
55-
} catch (error) {
56-
console.error(error);
57-
}
53+
return new Promise(async (resolve) => {
54+
try {
55+
captcha.value = await useHttpGet("/api/captcha/request_angle");
56+
visible.value = true;
57+
resolveCallback = resolve;
58+
} catch (e) {
59+
console.error(e);
60+
useCatchError(e);
61+
}
62+
});
5863
};
5964
6065
const captchaRefresh = async () => {
@@ -70,23 +75,13 @@ const captchaClose = () => {
7075
};
7176
7277
const captchaConfirm = (angle, reset) => {
73-
emits(
74-
"confirm",
75-
// 参数1:验证码信息
76-
{
78+
if (resolveCallback) {
79+
resolveCallback({
7780
captchaId: captcha.value.id,
7881
captchaCode: angle,
79-
},
80-
// 参数2:回调
81-
(success) => {
82-
captchaClose();
83-
// if (success) {
84-
// captchaClose();
85-
// } else {
86-
// captchaRefresh();
87-
// }
88-
}
89-
);
82+
});
83+
}
84+
captchaClose();
9085
};
9186
9287
defineExpose({

0 commit comments

Comments
 (0)