From 76efc1d28c1662feb5b5702812a83637111869c6 Mon Sep 17 00:00:00 2001 From: valarchie <343928303@qq.com> Date: Fri, 23 Jun 2023 17:19:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=8E=B7=E5=8F=96=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index e15c8dd..a41df32 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -29,7 +29,10 @@ defineOptions({ name: "Login" }); +// TODO 当请求验证码过于频繁的话 服务器会报错 但是前端没有反应 这块需要处理一下, 通过axios处理一下 const captchaCodeBase64 = ref(""); +const isCaptchaOn = ref(false); + const router = useRouter(); const loading = ref(false); const checked = ref(false); @@ -80,23 +83,21 @@ function onkeypress({ code }: KeyboardEvent) { } } -function getCaptchaCode() { - CommonAPI.getCaptchaCode().then(res => { +async function getCaptchaCode() { + await CommonAPI.getCaptchaCode().then(res => { + isCaptchaOn.value = res.data.isCaptchaOn; captchaCodeBase64.value = `data:image/gif;base64,${res.data.img}`; }); } -onMounted(async () => { +onMounted(() => { window.document.addEventListener("keypress", onkeypress); + getCaptchaCode(); }); onBeforeUnmount(() => { window.document.removeEventListener("keypress", onkeypress); }); - -// watch(imgCode, value => { -// useUserStoreHook().SET_VERIFYCODE(value); -// });