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 }} +