feat(用户端顶栏): 右上角去掉所属公司名显示

按需求摘掉 AmazonTopBar 的公司名胶囊,连带清掉随之死掉的
readCompanyIdentity import / companyName ref / onMounted 赋值与 .company-name
样式(留着会被 tests/dead-code-cleanup.test.ts 的 vue-tsc --noEmit 判红)。
公司身份机制与 companyName 载荷一律不动——那仍是登录/多租户判断的输入,
只是不再在顶栏显示。

补 tests/mount/amazon-topbar-no-company.mount.test.ts 三条真挂载用例:
公司名不进 DOM、同框用户名照旧出现(防"挂载失败"冒充"已摘掉")、
readCompanyIdentity 仍读得到。已做反向证伪:把胶囊塞回去第一条即红。

用户端实测:npm test 862 例 0 红;npx vitest run 19 例 0 红;vue-tsc --noEmit rc=0。
This commit is contained in:
2026-10-17 10:35:26 +08:00
parent 40f280d261
commit e139978f04
2 changed files with 74 additions and 17 deletions
@@ -31,7 +31,6 @@
<div class="top-right">
<NotificationBell />
<BrandApiSecretSettingsButton variant="topbar" />
<span v-if="companyName" class="company-name" :title="`所属公司:${companyName}`">{{ companyName }}</span>
<span class="admin-name">{{ username }}</span>
</div>
</header>
@@ -46,7 +45,6 @@ import { filterGroupsByPermission, TOOL_GROUPS } from '@/pages/amazon/tool-catal
import type { VisibleGroup } from '@/pages/amazon/tool-catalog'
import { resolvePageHref } from '@/shared/page-prefix'
import { getCurrentUserAppColumnKeys } from '@/shared/api/permission'
import { readCompanyIdentity } from '@/shared/auth/company-identity'
const props = withDefaults(
defineProps<{
@@ -63,8 +61,6 @@ const emit = defineEmits<{ change: [key: 'front' | 'ops' | 'logi'] }>()
const activeCat = computed(() => props.activeCat)
const visibleCats = ref<VisibleGroup[]>(TOOL_GROUPS.map((group) => ({ ...group, tools: [...group.tools] })))
const username = ref('admin')
/** 所属公司名:后端未返回时为空串,该段整体不渲染(不能显示 undefined)。 */
const companyName = ref('')
/** 分类 tab 点击回到工具台对应分组 */
const toolbarHref = resolvePageHref('/new_web_source/amazon-console.html')
@@ -88,7 +84,6 @@ function underlineStyle(cat: VisibleGroup) {
onMounted(async () => {
const localName = typeof window === 'undefined' ? '' : (window.localStorage.getItem('username') || '').trim()
if (localName) username.value = localName
companyName.value = readCompanyIdentity()
try {
const keys = await getCurrentUserAppColumnKeys()
visibleCats.value = filterGroupsByPermission(TOOL_GROUPS, keys)
@@ -258,18 +253,6 @@ onMounted(async () => {
flex-shrink: 0;
}
.company-name {
max-width: 180px;
padding: 3px 10px;
border: 1px solid #3e4a62;
border-radius: 999px;
color: #9fb0c9;
font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.admin-name {
color: #c8d2e2;
font-size: 13px;