mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
perf: 避免连点enter登录导致异常登录日志触发
This commit is contained in:
parent
1b563e0957
commit
e914f1db33
@ -9,7 +9,7 @@
|
|||||||
<template v-if="mode === 'account'">
|
<template v-if="mode === 'account'">
|
||||||
<n-form-item path="username">
|
<n-form-item path="username">
|
||||||
<n-input
|
<n-input
|
||||||
@keyup.enter="handleSubmit"
|
@keyup.enter="debounceHandleSubmit"
|
||||||
v-model:value="formInline.username"
|
v-model:value="formInline.username"
|
||||||
placeholder="请输入用户名"
|
placeholder="请输入用户名"
|
||||||
>
|
>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item path="pass">
|
<n-form-item path="pass">
|
||||||
<n-input
|
<n-input
|
||||||
@keyup.enter="handleSubmit"
|
@keyup.enter="debounceHandleSubmit"
|
||||||
v-model:value="formInline.pass"
|
v-model:value="formInline.pass"
|
||||||
type="password"
|
type="password"
|
||||||
show-password-on="click"
|
show-password-on="click"
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<n-input
|
<n-input
|
||||||
:style="{ width: '100%' }"
|
:style="{ width: '100%' }"
|
||||||
placeholder="验证码"
|
placeholder="验证码"
|
||||||
@keyup.enter="handleSubmit"
|
@keyup.enter="debounceHandleSubmit"
|
||||||
v-model:value="formInline.code"
|
v-model:value="formInline.code"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
@ -137,6 +137,7 @@
|
|||||||
import { useSendCode } from '@/hooks/common';
|
import { useSendCode } from '@/hooks/common';
|
||||||
import { SendSms } from '@/api/system/user';
|
import { SendSms } from '@/api/system/user';
|
||||||
import { validate } from '@/utils/validateUtil';
|
import { validate } from '@/utils/validateUtil';
|
||||||
|
import { useDebounceFn } from '@vueuse/core';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mode: string;
|
mode: string;
|
||||||
@ -172,7 +173,9 @@
|
|||||||
const { sendLabel, isCounting, loading: sendLoading, activateSend } = useSendCode();
|
const { sendLabel, isCounting, loading: sendLoading, activateSend } = useSendCode();
|
||||||
const emit = defineEmits(['updateActiveModule']);
|
const emit = defineEmits(['updateActiveModule']);
|
||||||
const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME;
|
const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME;
|
||||||
|
const debounceHandleSubmit = useDebounceFn((e) => {
|
||||||
|
handleSubmit(e);
|
||||||
|
}, 500);
|
||||||
const formInline = ref<FormState>({
|
const formInline = ref<FormState>({
|
||||||
username: '',
|
username: '',
|
||||||
pass: '',
|
pass: '',
|
||||||
@ -274,7 +277,7 @@
|
|||||||
|
|
||||||
function handleLogin(e) {
|
function handleLogin(e) {
|
||||||
if (props.mode === 'account') {
|
if (props.mode === 'account') {
|
||||||
handleSubmit(e);
|
debounceHandleSubmit(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user