import { useEffect, useState } from 'react'; import type { PlatformTheme } from '../../../packages/shared/src/contracts/runtime'; import type { AuthCaptchaChallenge, AuthUser } from '../../services/authService'; import { CaptchaChallengeField } from './CaptchaChallengeField'; type BindPhoneScreenProps = { user: AuthUser; platformTheme: PlatformTheme; sendingCode: boolean; binding: boolean; error: string; captchaChallenge: AuthCaptchaChallenge | null; onSendCode: ( phone: string, captcha?: { challengeId?: string; answer?: string; }, ) => Promise<{ cooldownSeconds: number; expiresInSeconds: number; }>; onSubmit: (phone: string, code: string) => Promise; onLogout: () => Promise; }; export function BindPhoneScreen({ user, platformTheme, sendingCode, binding, error, captchaChallenge, onSendCode, onSubmit, onLogout, }: BindPhoneScreenProps) { const [phone, setPhone] = useState(''); const [code, setCode] = useState(''); const [captchaAnswer, setCaptchaAnswer] = useState(''); const [cooldownSeconds, setCooldownSeconds] = useState(0); const [hint, setHint] = useState(''); useEffect(() => { if (cooldownSeconds <= 0) { return; } const timeoutId = window.setTimeout(() => { setCooldownSeconds((current) => Math.max(0, current - 1)); }, 1000); return () => { window.clearTimeout(timeoutId); }; }, [cooldownSeconds]); return (
百梦
视觉叙事 RPG

账号激活

绑定手机号

微信身份已建立,还差最后一步。绑定手机号后,你的账号才会正式激活,并同步到后端存档体系。

当前登录身份:{user.displayName}
{ event.preventDefault(); void onSubmit(phone, code); }} > {hint ? (
{hint}
) : null} {error ? (
{error}
) : null}
); }