refactor(auth): align auth UI and mock auth API

This commit is contained in:
zetaloop
2026-02-28 07:26:05 +08:00
parent bce99c4c54
commit f5df00df4e
11 changed files with 337 additions and 56 deletions
+35 -4
View File
@@ -21,6 +21,9 @@ import { useEffect, useRef, useState } from "react"
export default function VerifyPage() {
const [verifyRole, setVerifyRole] = useState<UserRole | "">("")
const [realName, setRealName] = useState("")
const [idNumber, setIdNumber] = useState("")
const [gameProfile, setGameProfile] = useState("")
const verificationStatus = useAuthStore((state) => state.verificationStatus)
const verificationReasons = useAuthStore((state) => state.verificationReasons)
const verifiedRoles = useAuthStore((state) => state.verifiedRoles)
@@ -38,8 +41,21 @@ export default function VerifyPage() {
[],
)
const buildMaterials = () => {
const materials: Record<string, string> = {
realName,
idNumber,
gameProfile,
idCardFront: "mock://idCardFront",
idCardBack: "mock://idCardBack",
gameScreenshot: "mock://gameScreenshot",
}
return materials
}
const submitWithMockApproval = (role: UserRole) => {
submitVerification(role)
submitVerification(role, buildMaterials())
const oldTimer = timersRef.current.get(role)
if (oldTimer) {
clearTimeout(oldTimer)
@@ -149,19 +165,34 @@ export default function VerifyPage() {
<div className="space-y-2">
<Label htmlFor="real-name"></Label>
<Input id="real-name" placeholder="请输入真实姓名" />
<Input
id="real-name"
placeholder="请输入真实姓名"
value={realName}
onChange={(event) => setRealName(event.target.value)}
/>
</div>
<div className="space-y-2">
<Label htmlFor="id-number"></Label>
<Input id="id-number" placeholder="请输入身份证号" />
<Input
id="id-number"
placeholder="请输入身份证号"
value={idNumber}
onChange={(event) => setIdNumber(event.target.value)}
/>
</div>
<Separator />
<div className="space-y-2">
<Label></Label>
<Textarea placeholder="请描述你的游戏经历、段位、擅长游戏等" rows={3} />
<Textarea
placeholder="请描述你的游戏经历、段位、擅长游戏等"
rows={3}
value={gameProfile}
onChange={(event) => setGameProfile(event.target.value)}
/>
</div>
<div className="space-y-2">