import { useMemo, useState } from "react"; import { useNavigate, Link } from "react-router"; import { Hexagon, ArrowLeft, ArrowRight, UploadCloud, CheckCircle2, Loader2, XCircle, Building2, UserRound, ShieldCheck, X, Eye, EyeOff, Info, } from "lucide-react"; import { toast } from "sonner"; import { Button } from "../components/ui/button"; import { cn } from "../components/ui/utils"; type Registrant = "supplier" | "expert"; type AuditState = "idle" | "auditing" | "success" | "rejected"; const SUPPLIER_STEPS = ["企业信息", "联系人", "提交 / 自动审核"]; const EXPERT_STEPS = ["基本信息", "专业资质 / 收款", "提交审核"]; interface PwdRule { label: string; test: (v: string) => boolean; } const PWD_RULES: PwdRule[] = [ { label: "长度 8~20 位", test: (v) => v.length >= 8 && v.length <= 20 }, { label: "包含大写字母(A-Z)与小写字母(a-z)", test: (v) => /[A-Z]/.test(v) && /[a-z]/.test(v) }, { label: "包含数字(0-9)与特殊字符(!@#$%^&*)", test: (v) => /\d/.test(v) && /[!@#$%^&*()_+\-=]/.test(v) }, { label: "禁止连续/重复字符(如 12345678、aaaa)", test: (v) => !/(.)\1{3,}/.test(v) && !/0123|1234|2345|3456|4567|5678|6789/.test(v) }, { label: "非常见弱口令(password、admin123 等)", test: (v) => !["password", "admin123", "12345678", "qwerty"].includes(v.toLowerCase()) }, ]; function Field({ label, placeholder, required, hint, className, type = "text", readOnly, }: { label: string; placeholder?: string; required?: boolean; hint?: string; className?: string; type?: string; readOnly?: boolean; }) { return (
{hint &&

{hint}

}
); } function StepBar({ steps, current }: { steps: string[]; current: number }) { return (
{steps.map((s, i) => (
{i < current ? : i + 1}
{s}
{i < steps.length - 1 && (
)}
))}
); } function Notice({ items }: { items: string[] }) { return (
注册须知
    {items.map((t, i) => (
  1. {i + 1}. {t}
  2. ))}
); } export function RegisterPage() { const navigate = useNavigate(); const [registrant, setRegistrant] = useState("supplier"); const [step, setStep] = useState(0); const [ocr, setOcr] = useState<"none" | "scanning" | "done">("none"); const [audit, setAudit] = useState("idle"); const [products, setProducts] = useState(["工业阀门", "管道配件"]); const [productInput, setProductInput] = useState(""); const [pwd, setPwd] = useState(""); const [confirmPwd, setConfirmPwd] = useState(""); const [showPwd, setShowPwd] = useState(false); const [smsCountdown, setSmsCountdown] = useState(0); const steps = registrant === "supplier" ? SUPPLIER_STEPS : EXPERT_STEPS; const passedRules = useMemo(() => PWD_RULES.map((r) => r.test(pwd)), [pwd]); const passedCount = passedRules.filter(Boolean).length; const strength: 0 | 1 | 2 = passedCount >= 5 && pwd.length >= 12 ? 2 : passedCount >= 4 ? 1 : 0; function switchRegistrant(r: Registrant) { setRegistrant(r); setStep(0); setAudit("idle"); setOcr("none"); } function triggerOcr() { setOcr("scanning"); setTimeout(() => { setOcr("done"); toast.success("营业执照识别完成,已自动回填企业信息"); }, 1500); } function addProduct() { const v = productInput.trim(); if (v && products.length < 20 && !products.includes(v)) { setProducts((p) => [...p, v]); } setProductInput(""); } function sendSms() { toast.success("验证码已发送"); setSmsCountdown(60); const t = setInterval(() => { setSmsCountdown((c) => { if (c <= 1) { clearInterval(t); return 0; } return c - 1; }); }, 1000); } function submitAudit() { setStep(steps.length - 1); setAudit("auditing"); setTimeout(() => { setAudit("success"); }, 3800); } const isLastFormStep = step === steps.length - 2; return (
滨化集团智慧招标平台 · 新用户注册
返回登录
{/* 注册对象选择 */}
{( [ { id: "supplier" as Registrant, label: "供应商注册", icon: Building2 }, { id: "expert" as Registrant, label: "外部专家注册", icon: UserRound }, ] ).map((r) => { const Icon = r.icon; return ( ); })}
AI 即时审核 · 秒级通过
{/* ============ 供应商注册 ============ */} {registrant === "supplier" && ( <> {step === 0 && (

供应商注册

请填写企业真实信息,上传营业执照,系统将自动识别并回填

{/* 营业执照上传 */}
上传营业执照(JPG/PNG/PDF,≤10MB)
支持拖拽或点击上传,AI 将自动识别企业信息并填充表单
{ocr === "scanning" && (
正在识别营业执照...
)} {ocr === "done" && (
已识别:营业执照信息提取成功(统一信用代码:91370100XXXXXXXXXX)
)}