From b470f116088523eae4d70e6cb21ee0d6e01dc756 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 22 Apr 2025 11:24:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=E7=99=BB=E5=BD=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Login/index.vue | 106 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 26 deletions(-) diff --git a/src/pages/Login/index.vue b/src/pages/Login/index.vue index afa27ba..c439743 100644 --- a/src/pages/Login/index.vue +++ b/src/pages/Login/index.vue @@ -7,6 +7,7 @@ import { getServerInfo } from '@/utils/getServerInfo.ts' import router from '@/router/router.ts' import { isBoardParamInited, login } from '@/services' import circleUrl from '@/assets/avatar.png' +import { eMessage } from '@/pages/Index/utils' const stateUrl = getServerInfo('/api/v1/app/ws/state') const wsState = createWebSocket(stateUrl.wsUrl) @@ -59,21 +60,14 @@ const inputPin = (pin: string) => { } } -const errorMsg = ref('') + +const passwordError = ref(false) const submitPin = async () => { - if (!activeUser.value?.id) { - errorMsg.value = '请选择用户' - return - } - if (password.value.length !== 4) { - errorMsg.value = '请输入密码' - return - } let resData = await isBoardParamInited() if (!resData.data) { //设备正在初始化 - errorMsg.value = '设备正在初始化,请稍候重试' + eMessage.error('设备正在初始化,请稍候重试') return } const params = { @@ -85,15 +79,27 @@ const submitPin = async () => { sessionStorage.setItem('token', JSON.stringify(res.data)) await router.push('/index') } else { - errorMsg.value = res.info - // password.value = '' + passwordError.value = true // 触发抖动动画 + // 动画结束后重置状态(2次抖动共0.6秒) + setTimeout(() => { + passwordError.value = false + }, 600) + password.value = '' } } + +const showPassword = ref(false) +const next = () => { + showPassword.value = true +} +const back = () => { + showPassword.value = false +}