增加站内信未读提醒和后台通知中心+txt 校验
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
Fold,
|
||||
House,
|
||||
Lock,
|
||||
Message,
|
||||
Money,
|
||||
Operation,
|
||||
Picture,
|
||||
@@ -32,6 +33,7 @@ import { computed, reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { changeAdminPassword, logoutAdmin, updateSupportStatus } from '@/features/admin'
|
||||
import { useAdminNotificationUnreadCount } from '@/features/admin/composables/useAdminNotificationUnreadCount'
|
||||
import { useAdminSessionStore } from '@/stores/adminSession'
|
||||
import { adminPath, ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH } from '@/shared/utils/adminPath'
|
||||
import { readError } from '@/shared/utils/error'
|
||||
@@ -155,6 +157,12 @@ const allNavGroups: NavGroup[] = [
|
||||
icon: Bell,
|
||||
permission: 'announcement:view',
|
||||
},
|
||||
{
|
||||
label: '通知中心',
|
||||
to: adminPath('notifications'),
|
||||
icon: Message,
|
||||
permission: 'notification:view',
|
||||
},
|
||||
{
|
||||
label: '系统配置',
|
||||
to: adminPath('system-configs'),
|
||||
@@ -228,6 +236,13 @@ const adminRoleText = computed(() => {
|
||||
})
|
||||
const supportStatus = computed(() => adminSession.supportStatus || 'offline')
|
||||
const hasChatPermission = computed(() => adminSession.hasPermission('chat:view'))
|
||||
const hasNotificationPermission = computed(
|
||||
() => adminSession.isSuperAdmin || adminSession.hasPermission('notification:view')
|
||||
)
|
||||
const {
|
||||
unreadCount: adminNotificationUnreadCount,
|
||||
unreadLabel: adminNotificationUnreadLabel,
|
||||
} = useAdminNotificationUnreadCount(route)
|
||||
|
||||
const statusLabels: Record<string, string> = {
|
||||
online: '在线',
|
||||
@@ -341,6 +356,19 @@ async function handleForcedPasswordChange() {
|
||||
</el-menu>
|
||||
|
||||
<div class="admin-sidebar-footer">
|
||||
<RouterLink
|
||||
v-if="hasNotificationPermission"
|
||||
class="sidebar-notification"
|
||||
:to="adminPath('notifications')"
|
||||
>
|
||||
<span class="sidebar-notification-icon">
|
||||
<el-icon><Message /></el-icon>
|
||||
<em v-if="adminNotificationUnreadCount > 0" class="sidebar-badge">
|
||||
{{ adminNotificationUnreadLabel }}
|
||||
</em>
|
||||
</span>
|
||||
<span v-show="!isCollapsed" class="sidebar-notification-text">通知中心</span>
|
||||
</RouterLink>
|
||||
<el-dropdown
|
||||
v-if="hasChatPermission"
|
||||
trigger="click"
|
||||
@@ -541,6 +569,66 @@ async function handleForcedPasswordChange() {
|
||||
padding: 10px 8px;
|
||||
}
|
||||
|
||||
.sidebar-notification {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid rgba(64, 158, 255, 0.35);
|
||||
border-radius: 8px;
|
||||
color: #d7dfec;
|
||||
text-decoration: none;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
border-color 0.2s;
|
||||
}
|
||||
|
||||
.sidebar-notification:hover,
|
||||
.sidebar-notification.router-link-active {
|
||||
background-color: rgba(64, 158, 255, 0.14);
|
||||
border-color: rgba(64, 158, 255, 0.8);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.admin-shell--collapsed .sidebar-notification {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sidebar-notification-icon {
|
||||
position: relative;
|
||||
display: grid;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.sidebar-notification-text {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sidebar-badge {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -13px;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 4px;
|
||||
border: 2px solid #304156;
|
||||
border-radius: 999px;
|
||||
background: #ef4444;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
line-height: 12px;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sidebar-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user