From e58e6e2a3e153a2a9847ca2fae737f3018e14e52 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 29 Mar 2024 10:59:26 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AOTP=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login.vue | 48 +++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/pages/login.vue b/src/pages/login.vue index 503ba5d8..696466a2 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -31,6 +31,12 @@ const backgroundImageUrl = ref('') // 背景图片加载状态 const isImageLoaded = ref(false) +// 是否开启二次验证 +const isOTP = ref(false) + +// 用户名称输入框 +const usernameInput = ref() + // 获取背景图片 async function fetchBackgroundImage() { api @@ -43,6 +49,23 @@ async function fetchBackgroundImage() { }) } +// 查询是否开启二次验证 +async function fetchOTP() { + const userid = usernameInput.value?.value + if (!userid) { + isOTP.value = false + return + } + api + .get(`/user/otp/${userid}`) + .then((response: any) => { + isOTP.value = response.success + }) + .catch((error: any) => { + console.log(error) + }) +} + // 登录获取token事件 function login() { errorMessage.value = '' @@ -150,13 +173,14 @@ onMounted(() => { - { :rules="[requiredValidator]" @click:append-inner="isPasswordVisible = !isPasswordVisible" /> - -
- {{ errorMessage }} -
-
+
- + + { > 登录 +
+ {{ errorMessage }} +