"use client"; import { useEffect } from "react"; import styles from "../vip.module.css"; import { LoginForm } from "./LoginForm"; type LoginModalProps = { open: boolean; onClose: () => void; onVerify: (userId: string) => Promise; onVerifyByEmail?: (email: string, password: string) => Promise; onSuccess: () => void; }; export function LoginModal({ open, onClose, onVerify, onVerifyByEmail, onSuccess }: LoginModalProps) { useEffect(() => { if (open) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [open]); useEffect(() => { if (!open) return; const onKeyDown = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", onKeyDown); return () => window.removeEventListener("keydown", onKeyDown); }, [open, onClose]); const handleSuccess = () => { onClose(); onSuccess(); }; if (!open) return null; return (
e.stopPropagation()} >

登录

); }