补充上传协议和实名认证

This commit is contained in:
Eamon
2026-09-11 17:06:29 +08:00
parent 8d8c9deba7
commit 8aaf43ed79
31 changed files with 301 additions and 108 deletions

View File

@@ -0,0 +1,31 @@
import { useEffect } from "react"
import { useNavigate } from "react-router-dom"
import { toast } from "sonner"
import { useDashboardStore } from "@/components/stores/dashboard"
import { useProfileStore } from "@/components/stores/profile"
// ==================== 前台购买/支付页面实名检查 ====================
// 已登录但未实名的用户访问购买/支付页面时:提示并跳转个人中心完成实名认证。
// 未登录用户不拦截(下单时走登录流程)。参考 juipnet 老项目做法。
export default function RealNameCheck() {
const navigate = useNavigate()
const token = useProfileStore(state => state.token)
const verified = useDashboardStore(state => state.verified)
const data = useDashboardStore(state => state.data)
const refresh = useDashboardStore(state => state.refresh)
// 无缓存时先拉取实名状态
useEffect(() => {
if (token && !data) refresh()
}, [token, data, refresh])
useEffect(() => {
if (!token || verified !== false) return
toast.error(
"接主管部门要求,会员需要实名认证方可使用该产品,请先前往个人中心完成实名认证",
)
navigate("/admin", { replace: true })
}, [token, verified, navigate])
return null
}