This commit is contained in:
chashaobao
2025-12-17 00:10:53 +08:00
parent e5facdff6a
commit c696e93bc5
3 changed files with 26 additions and 5 deletions

View File

@ -19,13 +19,14 @@ export enum BindPhoneStatus {
export interface ILoginButtonProps extends ButtonProps {
needPhone?: boolean;
needRefresh?: boolean;
onRefresh?: (() => void) | (() => Promise<void>);
needAssignment?: boolean;
}
const PREFIX = 'login-button';
function LoginButton(props: ILoginButtonProps) {
const { className, children, needPhone, onClick, needRefresh, ...otherProps } = props;
const { className, children, needPhone, onRefresh, onClick, needRefresh, ...otherProps } = props;
const userInfo = useUserInfo();
const [loginVisible, setLoginVisible] = useState(false);
const [assignVisible, setAssignVisible] = useState(false);
@ -69,10 +70,11 @@ function LoginButton(props: ILoginButtonProps) {
}, []);
const handleLoginSuccess = useCallback(
e => {
async e => {
setLoginVisible(false);
if (needRefresh) {
requestUserInfo();
onRefresh && (await onRefresh());
}
onClick?.(e);
},