显示当前登录账号和权限
This commit is contained in:
1 parent
53047e9066
commit
46f684ac38
3 files changed
+39
No files matched your search
@@ -461,6 +461,7 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
|||||||
<DashboardNavigation
|
<DashboardNavigation
|
||||||
:active-section="activeSection"
|
:active-section="activeSection"
|
||||||
:sections="sections"
|
:sections="sections"
|
||||||
|
:current-user="currentUser"
|
||||||
@select="selectSection"
|
@select="selectSection"
|
||||||
@settings="openSettings"
|
@settings="openSettings"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -110,6 +110,30 @@
|
|||||||
padding-top: 22px;
|
padding-top: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navigation-account {
|
||||||
|
display: grid;
|
||||||
|
gap: 5px;
|
||||||
|
margin: 0 8px 10px;
|
||||||
|
padding: 11px 12px;
|
||||||
|
border: 1px solid #e2e8f2;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #f8faff;
|
||||||
|
color: #263752;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation-account-label,
|
||||||
|
.navigation-account-role {
|
||||||
|
color: #7a879d;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation-account strong {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
.navigation-error {
|
.navigation-error {
|
||||||
margin: 0 8px 8px;
|
margin: 0 8px 8px;
|
||||||
color: #b42318;
|
color: #b42318;
|
||||||
|
|||||||
@@ -3,9 +3,16 @@ import { useAccessDenied } from "../AccessDenied/AccessDenied.js";
|
|||||||
|
|
||||||
const { loggingOut, error, logout } = useAccessDenied();
|
const { loggingOut, error, logout } = useAccessDenied();
|
||||||
|
|
||||||
|
const roleLabels = {
|
||||||
|
super_admin: "超级管理员",
|
||||||
|
admin: "管理员",
|
||||||
|
user: "普通用户",
|
||||||
|
};
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
activeSection: { type: String, required: true },
|
activeSection: { type: String, required: true },
|
||||||
sections: { type: Array, required: true },
|
sections: { type: Array, required: true },
|
||||||
|
currentUser: { type: Object, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
defineEmits(["select", "settings"]);
|
defineEmits(["select", "settings"]);
|
||||||
@@ -73,6 +80,13 @@ defineEmits(["select", "settings"]);
|
|||||||
<span>系统设置</span>
|
<span>系统设置</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="navigation-session">
|
<div class="navigation-session">
|
||||||
|
<div v-if="currentUser" class="navigation-account" aria-label="当前登录账号">
|
||||||
|
<span class="navigation-account-label">当前登录账号</span>
|
||||||
|
<strong>{{ currentUser.account || "未命名账号" }}</strong>
|
||||||
|
<span class="navigation-account-role">
|
||||||
|
权限:{{ roleLabels[currentUser.role] || "未知权限" }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<p v-if="error" class="navigation-error" role="alert">{{ error }}</p>
|
<p v-if="error" class="navigation-error" role="alert">{{ error }}</p>
|
||||||
<button
|
<button
|
||||||
class="navigation-item navigation-logout"
|
class="navigation-item navigation-logout"
|
||||||
|
|||||||
Reference in new issue
Block a user