"use client"; import { useState } from "react"; import { Truck } from "@phosphor-icons/react"; import { InputField } from "@/components/ui/input-field"; import { PrimaryButton } from "@/components/ui/primary-button"; import { ErrorBanner } from "@/components/ui/error-banner"; import { Card } from "@/components/ui/card"; import { embedDemoLogin, type EmbedDemoSession } from "@/lib/frontend/api-client"; interface EmbedDemoLoginProps { onSuccess: (session: EmbedDemoSession) => void; } export function EmbedDemoLogin({ onSuccess }: EmbedDemoLoginProps) { const [customerId, setCustomerId] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (loading) return; setLoading(true); setError(null); const res = await embedDemoLogin("", customerId.trim(), password); setLoading(false); if (res.code !== 0) { setError(res.message || "客户编号或密码错误"); return; } onSuccess(res.data); }; return (
宿主嵌入演示

客户登录

使用客户编号与管理员分配的密码登录(每次进入须重新填写)

{error && (
{error}
)}
void handleSubmit(e)} className="space-y-4" autoComplete="off" > setCustomerId(e.target.value)} /> setPassword(e.target.value)} /> 进入演示
); }