Commit a45d9333 by 伍闲犬 Committed by GitHub

fix: fix the login container; fix the incorrect input of captcha enter trigger (#5327)

parent 6ed9198c
...@@ -32,6 +32,20 @@ const SendCodeAuthModal = ({ ...@@ -32,6 +32,20 @@ const SendCodeAuthModal = ({
runAsync: getCaptcha runAsync: getCaptcha
} = useRequest2(() => getCaptchaPic(username), { manual: false }); } = useRequest2(() => getCaptchaPic(username), { manual: false });
const onSubmit = async ({ code }: { code: string }) => {
await onSendCode({ username, captcha: code });
onClose();
};
const onError = (err: any) => {
console.log(err);
};
const handleEnterKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key.toLowerCase() !== 'enter') return;
handleSubmit(onSubmit, onError)();
};
return ( return (
<MyModal isOpen={true}> <MyModal isOpen={true}>
<ModalBody pt={8}> <ModalBody pt={8}>
...@@ -55,25 +69,17 @@ const SendCodeAuthModal = ({ ...@@ -55,25 +69,17 @@ const SendCodeAuthModal = ({
/> />
</Skeleton> </Skeleton>
<Input placeholder={t('common:support.user.captcha_placeholder')} {...register('code')} /> <Input
placeholder={t('common:support.user.captcha_placeholder')}
{...register('code')}
onKeyDown={handleEnterKeyDown}
/>
</ModalBody> </ModalBody>
<ModalFooter gap={2}> <ModalFooter gap={2}>
<Button isLoading={onSending} variant={'whiteBase'} onClick={onClose}> <Button isLoading={onSending} variant={'whiteBase'} onClick={onClose}>
{t('common:Cancel')} {t('common:Cancel')}
</Button> </Button>
<Button <Button isLoading={onSending} onClick={handleSubmit(onSubmit, onError)}>
isLoading={onSending}
onClick={handleSubmit(
({ code }) => {
return onSendCode({ username, captcha: code }).then(() => {
onClose();
});
},
(err) => {
console.log(err);
}
)}
>
{t('common:Confirm')} {t('common:Confirm')}
</Button> </Button>
</ModalFooter> </ModalFooter>
......
...@@ -23,7 +23,7 @@ const LoginModal = ({ onSuccess }: LoginModalProps) => { ...@@ -23,7 +23,7 @@ const LoginModal = ({ onSuccess }: LoginModalProps) => {
maxW="556px" maxW="556px"
maxH={['100vh', '90vh']} maxH={['100vh', '90vh']}
borderRadius={[0, '16px']} borderRadius={[0, '16px']}
overflow="auto" overflow="hidden"
> >
<Box <Box
px={['5vw', '88px']} px={['5vw', '88px']}
......
...@@ -242,9 +242,9 @@ export const LoginContainer = ({ ...@@ -242,9 +242,9 @@ export const LoginContainer = ({
/> />
)} )}
<Box position="relative" w="full" h="full"> <Box position="relative" w="full" flex={'1 0 0'}>
{/* main content area */} {/* main content area */}
<Box w={['100%', '380px']} minH={['100vh', '600px']} flex={'1 0 0'}> <Box w={['100%', '380px']} flex={'1 0 0'}>
{pageType && DynamicComponent ? DynamicComponent : <Loading fixed={false} />} {pageType && DynamicComponent ? DynamicComponent : <Loading fixed={false} />}
</Box> </Box>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment