feat(admin): 增加站点后台标识与本站统计口径

This commit is contained in:
yml
2026-11-15 19:33:50 +08:00
parent 219ff13c11
commit 609264919d
5 changed files with 235 additions and 17 deletions
+100 -3
View File
@@ -33,6 +33,7 @@
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
text-decoration: none;
color: #fff;
overflow: hidden;
@@ -51,10 +52,29 @@
flex-shrink: 0;
}
.brand-text {
font-size: 16px;
font-weight: 600;
.brand-copy {
display: grid;
min-width: 0;
gap: 1px;
}
.brand-copy strong,
.brand-copy small {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.brand-copy strong {
color: #fff;
font-size: 14px;
font-weight: 700;
}
.brand-copy small {
color: #93a4bd;
font-size: 10px;
font-weight: 600;
}
.collapse-btn {
@@ -339,6 +359,70 @@
overflow: hidden;
}
.admin-context-bar {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 48px;
padding: 8px 24px;
border-bottom: 1px solid #e2e8f0;
background: rgba(255, 255, 255, 0.94);
backdrop-filter: blur(10px);
}
.admin-context-site {
display: flex;
align-items: center;
gap: 9px;
min-width: 0;
}
.context-label {
flex: none;
color: #94a3b8;
font-size: 11px;
font-weight: 700;
}
.admin-context-site strong {
min-width: 0;
overflow: hidden;
color: #0f172a;
font-size: 14px;
font-weight: 800;
text-overflow: ellipsis;
white-space: nowrap;
}
.context-scope {
flex: none;
padding: 2px 7px;
border: 1px solid #bfdbfe;
border-radius: 999px;
background: #eff6ff;
color: #2563eb;
font-size: 10px;
font-weight: 700;
}
.context-hint {
min-width: 0;
overflow: hidden;
color: #64748b;
font-size: 11px;
text-overflow: ellipsis;
white-space: nowrap;
}
.admin-scope-note {
flex: none;
color: #475569;
font-size: 11px;
font-weight: 600;
}
.status-dot {
width: 8px;
height: 8px;
@@ -363,6 +447,19 @@
overflow-y: auto;
}
@media (max-width: 980px) {
.admin-context-bar {
align-items: flex-start;
flex-direction: column;
gap: 4px;
padding: 8px 16px;
}
.context-hint {
display: none;
}
}
:global(.force-password-dialog) {
max-width: calc(100vw - 32px);
}
+30 -2
View File
@@ -42,12 +42,14 @@ import { changeAdminPassword, logoutAdmin, updateSupportStatus } from '@/feature
import { useAdminNotificationUnreadCount } from '@/features/admin/composables/useAdminNotificationUnreadCount'
import { usePendingRefundCount } from '@/features/admin/composables/usePendingRefundCount'
import { useAdminSessionStore } from '@/stores/adminSession'
import { useDistributionSiteStore } from '@/stores/distributionSite'
import { adminPath, ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH } from '@/shared/utils/adminPath'
import { readError } from '@/shared/utils/error'
const router = useRouter()
const route = useRoute()
const adminSession = useAdminSessionStore()
const siteStore = useDistributionSiteStore()
const isCollapsed = ref(false)
const updatingStatus = ref(false)
const passwordSubmitting = ref(false)
@@ -364,6 +366,20 @@ const defaultOpeneds = computed(() => {
})
const adminName = computed(() => adminSession.nickname || adminSession.username || '管理员')
const currentSiteName = computed(() => siteStore.siteName || '大锤商行')
const currentSiteScope = computed(() => {
if (siteStore.isTenant) return '经营站点'
if (siteStore.isDistribution) return '分销站点'
return '主站'
})
const currentSiteHint = computed(() =>
siteStore.isTenant ? '用户、商品、订单与财务均按本站口径统计' : '历史分销站点管理视图'
)
const adminScopeNote = computed(() =>
adminSession.isSuperAdmin
? '平台超级管理员 · 当前仅查看本站数据'
: '站点管理员 · 数据仅限当前站点'
)
const adminRoleText = computed(() => {
if (adminSession.isSuperAdmin) return '超级管理员'
const names = adminSession.roles.map(role => role.name).filter(Boolean)
@@ -455,8 +471,11 @@ async function handleForcedPasswordChange() {
<aside class="admin-sidebar">
<div class="admin-sidebar-header">
<RouterLink class="admin-brand" :to="ADMIN_DASHBOARD_PATH">
<span class="brand-mark">H</span>
<span class="brand-text" v-show="!isCollapsed">哈夫币后台</span>
<span class="brand-mark">{{ siteStore.brandMark }}</span>
<span v-show="!isCollapsed" class="brand-copy">
<strong>{{ currentSiteName }}</strong>
<small>{{ currentSiteScope }}后台</small>
</span>
</RouterLink>
<el-icon class="collapse-btn" @click="isCollapsed = !isCollapsed">
<Fold v-if="!isCollapsed" />
@@ -562,6 +581,15 @@ async function handleForcedPasswordChange() {
</aside>
<section class="admin-workspace">
<header class="admin-context-bar">
<div class="admin-context-site">
<span class="context-label">当前后台</span>
<strong>{{ currentSiteName }}</strong>
<span class="context-scope">{{ currentSiteScope }}</span>
<span class="context-hint">{{ currentSiteHint }}</span>
</div>
<span class="admin-scope-note">{{ adminScopeNote }}</span>
</header>
<main class="admin-main">
<slot />
</main>