feat(tenant): enhance tenant information update with description field and add global invitation bell component

Updated the tenant information API to allow editing of both name and description fields, improving user experience in managing tenant details. Introduced a new GlobalInvitationBell component to display pending invitations in the UI, ensuring users can easily access their invitations without navigating away from their current context. Additionally, updated internationalization files to support new description-related messages.

Refs: #1303
This commit is contained in:
wizardchen
2026-05-18 10:59:12 +08:00
committed by lyingbug
parent ce67ba0310
commit b0b05b49c5
11 changed files with 291 additions and 142 deletions
@@ -0,0 +1,72 @@
<template>
<!-- 全局右上角"待处理邀请"铃铛。
- 与原先 UserMenu 中铃铛的逻辑一致:只在 pendingInvitationCount > 0 时渲染,
空收件箱场景不占用角落像素。
- 固定定位、z-index 远低于 t-drawer 默认 2500,业务页面右侧抽屉(FAQ、KB 调试、
Tenant 审计、SettingDrawer 等)弹出时会自然覆盖铃铛,不需要特意联动隐藏。
- 点击铃铛复用同一份 MyInvitationsDialog,行为与之前一致。 -->
<template v-if="pendingInvitationCount > 0">
<t-badge :count="pendingInvitationCount" :max-count="99" :offset="[6, 4]"
class="global-invitation-bell">
<button type="button" class="global-invitation-bell__btn"
:title="$t('tenantInvitation.inboxTooltip')" @click="openDialog">
<t-icon name="notification" size="18px" />
</button>
</t-badge>
</template>
<MyInvitationsDialog v-model:visible="dialogVisible" />
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useAuthStore } from '@/stores/auth'
import MyInvitationsDialog from '@/components/MyInvitationsDialog.vue'
const authStore = useAuthStore()
const pendingInvitationCount = computed(() => authStore.pendingInvitationCount)
const dialogVisible = ref(false)
const openDialog = () => {
dialogVisible.value = true
}
</script>
<style lang="less" scoped>
.global-invitation-bell {
position: fixed;
top: 12px;
right: 16px;
/* 远低于 TDesign 抽屉的默认 z-index (2500),确保业务页右侧抽屉弹出时能正常盖住铃铛。
高于普通页面内容(一般 0~10),避免被列表卡片覆盖。 */
z-index: 100;
}
.global-invitation-bell__btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
padding: 0;
border: 1px solid var(--td-component-stroke);
border-radius: 10px;
/* 用 container 背景而非透明,铃铛悬在内容区上方时和不同颜色的页面背景都能看清。 */
background: var(--td-bg-color-container);
color: var(--td-text-color-secondary);
cursor: pointer;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
&:hover {
background-color: var(--td-bg-color-secondarycontainer);
color: var(--td-brand-color);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color-focus);
outline-offset: 1px;
}
}
</style>
-71
View File
@@ -24,19 +24,6 @@
<div class="user-email">{{ userEmail }}</div>
</template>
</div>
<!-- Pending-invitations bell. Sits in the trailing-icon slot
of the avatar row (visually similar to a "升级/store" CTA
icon in other products). Only renders when there is at
least one pending invitation so the row stays minimal in
the common empty-inbox case. Click-stop so the dropdown
doesn't open along with the navigation. -->
<t-badge v-if="pendingInvitationCount > 0" :count="pendingInvitationCount" :max-count="99" :offset="[6, 4]"
class="user-inbox-badge-wrap">
<button type="button" class="user-inbox-btn" :title="$t('tenantInvitation.inboxTooltip')"
@click.stop="goToInvitations">
<t-icon name="notification" size="18px" />
</button>
</t-badge>
<t-icon :name="menuVisible ? 'chevron-up' : 'chevron-down'" class="dropdown-icon" />
</template>
</div>
@@ -231,7 +218,6 @@
<!-- 创建工作区弹窗 -->
<CreateTenantDialog v-model:visible="createTenantDialogVisible" @created="onTenantCreated" />
<MyInvitationsDialog v-model:visible="invitationsDialogVisible" />
</div>
</template>
@@ -245,7 +231,6 @@ import { getCurrentUser, logout as logoutApi } from '@/api/auth'
import { useI18n } from 'vue-i18n'
import IMChannelsOverviewPanel from '@/components/IMChannelsOverviewPanel.vue'
import CreateTenantDialog from '@/components/CreateTenantDialog.vue'
import MyInvitationsDialog from '@/components/MyInvitationsDialog.vue'
import { listAllIMChannels, type IMChannelOverview } from '@/api/agent'
import { navigateAfterTenantSwitch } from '@/utils/tenantSwitch'
import type { TenantInfo } from '@/api/tenant'
@@ -327,25 +312,6 @@ const toggleMenu = () => {
menuVisible.value = !menuVisible.value
}
// Pending invitation count surfaced as the trailing bell on the
// avatar row. Reads directly from the auth store so the App.vue
// poller and any local accept/decline updates flow through here
// without a separate fetch. The visual badge cap (99+) is handled
// by t-badge's max-count, so we just expose the raw count.
const pendingInvitationCount = computed(() => authStore.pendingInvitationCount)
// Clicking the bell opens the invitations dialog inline. Previously
// this navigated to /platform/invitations, but the inbox is short-
// lived ("see what's pending, accept or decline, dismiss") and a
// dialog keeps the user in whatever context they came from. We
// also close the avatar dropdown if it's open so the modal doesn't
// fight with a stale hover panel.
const invitationsDialogVisible = ref(false)
const goToInvitations = () => {
menuVisible.value = false
invitationsDialogVisible.value = true
}
// 快捷导航到设置的特定部分
const handleQuickNav = (section: string) => {
menuVisible.value = false
@@ -853,43 +819,6 @@ onUnmounted(() => {
transition: transform 0.2s;
}
/* Pending-invitations bell, sits between user-info and the chevron.
The button itself is a transparent 28x28 click target sized to
match the avatar row's other trailing affordances; t-badge wraps
it and positions its own counter pill in the top-right via the
:offset prop, so we don't try to recreate badge positioning here. */
.user-inbox-badge-wrap {
display: inline-flex;
align-items: center;
margin: 0 2px;
flex-shrink: 0;
}
.user-inbox-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: none;
border-radius: 8px;
background: transparent;
color: var(--td-text-color-secondary);
cursor: pointer;
transition: background-color 0.18s ease, color 0.18s ease;
&:hover {
background-color: var(--td-bg-color-secondarycontainer);
color: var(--td-brand-color);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color-focus);
outline-offset: 1px;
}
}
.user-dropdown {
position: absolute;
bottom: 100%;