Files
role-user/src/app/(app)/me/page.tsx
T
2026-06-02 14:46:39 +08:00

53 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { KeyRound, ShieldCheck, UserRound } from "lucide-react";
import { LogoutButton } from "@/components/logout-button";
import { PageHeader } from "@/components/page-header";
import { PasswordChangeForm } from "@/components/password-change-form";
import { StatusPill } from "@/components/status-pill";
import { roleNames } from "@/lib/format";
import { getCurrentUser } from "@/lib/mobile-data";
export default async function MePage() {
const user = await getCurrentUser();
return (
<div className="page-stack">
<PageHeader title="我的" description="个人资料、账号安全和退出登录。" />
<section className="profile-card">
<span className="avatar large">{user.displayName.slice(0, 1)}</span>
<h2>{user.displayName}</h2>
<p>{user.username}</p>
<div className="pill-row">
<StatusPill tone="success">员工账号</StatusPill>
<StatusPill>{roleNames(user.roles)}</StatusPill>
</div>
</section>
<section className="info-list">
<div>
<UserRound aria-hidden size={18} />
<span>所属门店</span>
<strong>{user.storeName || "未绑定门店"}</strong>
</div>
<div>
<ShieldCheck aria-hidden size={18} />
<span>权限数量</span>
<strong>{user.permissions.includes("*") ? "全部权限" : `${user.permissions.length} 项`}</strong>
</div>
<div>
<KeyRound aria-hidden size={18} />
<span>修改密码</span>
<strong>旧密码 + 新密码</strong>
</div>
</section>
<section className="section-block">
<div className="section-title">
<h2>账号安全</h2>
</div>
<p className="muted-copy">本应用不展示明文密码,也不会在前端持久化 token 或密码。</p>
<PasswordChangeForm />
</section>
<LogoutButton />
</div>
);
}