feat: 添加mock数据,给导航添加选中标识

This commit is contained in:
zdl
2025-10-17 15:01:35 +08:00
parent bc407d2a35
commit 2d9d047a9f
16 changed files with 2120 additions and 25 deletions

View File

@@ -446,10 +446,10 @@ export default function AuthFormContent() {
<AlertDialogOverlay>
<AlertDialogContent>
<AlertDialogHeader fontSize="lg" fontWeight="bold">完善个人信息</AlertDialogHeader>
<AlertDialogBody>您已成功注册是否前往个人中心设置昵称和其他信息</AlertDialogBody>
<AlertDialogBody>您已成功注册是否前往个人资料设置昵称和其他信息</AlertDialogBody>
<AlertDialogFooter>
<Button ref={cancelRef} onClick={() => { setShowNicknamePrompt(false); handleLoginSuccess({ phone: currentPhone }); }}>稍后再说</Button>
<Button colorScheme="green" onClick={() => { setShowNicknamePrompt(false); handleLoginSuccess({ phone: currentPhone }); setTimeout(() => { navigate('/admin/profile'); }, 300); }} ml={3}>去设置</Button>
<Button colorScheme="green" onClick={() => { setShowNicknamePrompt(false); handleLoginSuccess({ phone: currentPhone }); setTimeout(() => { navigate('/home/profile'); }, 300); }} ml={3}>去设置</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialogOverlay>

View File

@@ -1,5 +1,5 @@
import React from "react";
import { FormControl, FormErrorMessage, HStack, Input, Button } from "@chakra-ui/react";
import { FormControl, FormErrorMessage, HStack, Input, Button, Spinner } from "@chakra-ui/react";
/**
* 通用验证码输入组件
@@ -30,6 +30,17 @@ export default function VerificationCodeInput({
}
};
// 计算按钮显示的文本(避免在 JSX 中使用条件渲染)
const getButtonText = () => {
if (isSending) {
return "发送中";
}
if (countdown > 0) {
return countdownText(countdown);
}
return buttonText;
};
return (
<FormControl isRequired={isRequired} isInvalid={!!error}>
<HStack>
@@ -41,13 +52,14 @@ export default function VerificationCodeInput({
maxLength={6}
/>
<Button
type="button"
colorScheme={colorScheme}
onClick={handleSendCode}
isDisabled={countdown > 0 || isLoading}
isLoading={isSending}
isDisabled={countdown > 0 || isLoading || isSending}
minW="120px"
leftIcon={isSending ? <Spinner size="sm" /> : undefined}
>
{countdown > 0 ? countdownText(countdown) : buttonText}
{getButtonText()}
</Button>
</HStack>
<FormErrorMessage>{error}</FormErrorMessage>