更新新用户登录后台修改密码和实名认证提示框和修改控制台展示和取消控制台中的个人中心跳转

This commit is contained in:
Eamon-meng
2025-07-08 13:52:13 +08:00
parent 5cff89b60c
commit b261f1e9aa
7 changed files with 390 additions and 213 deletions

View File

@@ -4,6 +4,7 @@ import Navbar from './_client/navbar'
import Layout from './_client/layout'
import {getProfile} from '@/actions/auth'
import {redirect} from 'next/navigation'
import {PasswordSetupWrapper} from './_client/passwordSetupWrapper'
export type AdminLayoutProps = {
children: ReactNode
@@ -12,6 +13,7 @@ export type AdminLayoutProps = {
export default async function AdminLayout(props: AdminLayoutProps) {
const resp = await getProfile()
const profile = resp.success ? resp.data : null
if (!profile) {
redirect('/login')
}
@@ -20,7 +22,15 @@ export default async function AdminLayout(props: AdminLayoutProps) {
<Layout
navbar={<Navbar/>}
header={<Header profile={profile}/>}
content={props.children}
content={(
<>
{props.children}
{/* 需要时显示密码设置和实名认证 */}
{(!profile?.has_password && !profile?.id_token) && (
<PasswordSetupWrapper profile={profile}/>
)}
</>
)}
/>
)
}