fix: 全端隐藏用户角色标签(SUPER_ADMIN/操作员等)
This commit is contained in:
@ -113,11 +113,6 @@ export default function AdminLayout() {
|
|||||||
<span className="font-medium text-gray-700">
|
<span className="font-medium text-gray-700">
|
||||||
{user?.display_name ?? user?.username ?? "—"}
|
{user?.display_name ?? user?.username ?? "—"}
|
||||||
</span>
|
</span>
|
||||||
{user?.role && (
|
|
||||||
<span className="rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-500">
|
|
||||||
{user.role}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={handleLogout}
|
onClick={handleLogout}
|
||||||
|
|||||||
@ -14,10 +14,6 @@ export default function ProfilePage() {
|
|||||||
// ---- 从 AuthContext 派生真实数据 ----
|
// ---- 从 AuthContext 派生真实数据 ----
|
||||||
const displayName = user?.display_name || user?.username || "未知用户";
|
const displayName = user?.display_name || user?.username || "未知用户";
|
||||||
const avatarChar = displayName.charAt(0);
|
const avatarChar = displayName.charAt(0);
|
||||||
const roleLabel =
|
|
||||||
user?.role === "SUPER_ADMIN"
|
|
||||||
? "超级管理员"
|
|
||||||
: user?.role || "操作员";
|
|
||||||
|
|
||||||
function handleLogout() {
|
function handleLogout() {
|
||||||
logout();
|
logout();
|
||||||
@ -47,7 +43,6 @@ export default function ProfilePage() {
|
|||||||
<span className="block text-base font-bold text-gray-800">
|
<span className="block text-base font-bold text-gray-800">
|
||||||
{displayName}
|
{displayName}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-gray-400">{roleLabel}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xl text-gray-300">›</span>
|
<span className="text-xl text-gray-300">›</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
<view class="avatar">{{ initial }}</view>
|
<view class="avatar">{{ initial }}</view>
|
||||||
<view class="user-info">
|
<view class="user-info">
|
||||||
<text class="user-name">{{ user?.display_name || '未登录' }}</text>
|
<text class="user-name">{{ user?.display_name || '未登录' }}</text>
|
||||||
<text class="user-role">{{ user?.role === 'admin' ? '管理员' : '操作员' }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user