2025-10-05 21:45:39 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="status-bar">
|
|
|
|
|
|
<div class="status-bar-content">
|
|
|
|
|
|
<!-- 左侧:系统信息 -->
|
|
|
|
|
|
<div class="status-left">
|
|
|
|
|
|
<div class="system-info">
|
|
|
|
|
|
<div class="system-details">
|
|
|
|
|
|
<div class="system-name">{{ branding.name }}</div>
|
|
|
|
|
|
<div class="system-subtitle">{{ branding.subtitle }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 右侧:时间和用户信息 -->
|
|
|
|
|
|
<div class="status-right">
|
|
|
|
|
|
<div class="time-info">
|
|
|
|
|
|
<Clock class="icon" />
|
|
|
|
|
|
<span class="current-time">{{ currentTime }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="user-info">
|
|
|
|
|
|
<User class="icon" />
|
2025-10-06 21:18:19 +08:00
|
|
|
|
<span class="user-greeting">{{ greeting }}</span>
|
2025-10-05 21:45:39 +08:00
|
|
|
|
</div>
|
2025-10-11 15:02:24 +08:00
|
|
|
|
<div class="task-center-entry" @click="openTaskCenter">
|
|
|
|
|
|
<a-badge
|
|
|
|
|
|
:count="activeTaskCount"
|
|
|
|
|
|
:overflow-count="99"
|
|
|
|
|
|
class="task-center-badge"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="task-center-button">
|
2025-11-10 13:10:53 +08:00
|
|
|
|
<ClipboardList class="icon" />
|
2025-10-11 15:02:24 +08:00
|
|
|
|
<span class="task-center-label">任务中心</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</a-badge>
|
|
|
|
|
|
</div>
|
2025-10-05 21:45:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
|
|
|
|
|
import { useInfoStore } from '@/stores/info'
|
2025-10-06 21:18:19 +08:00
|
|
|
|
import { useUserStore } from '@/stores/user'
|
2025-11-10 13:10:53 +08:00
|
|
|
|
import { Clock, User, ClipboardList } from 'lucide-vue-next'
|
2025-10-11 15:02:24 +08:00
|
|
|
|
import { useTaskerStore } from '@/stores/tasker'
|
|
|
|
|
|
import { storeToRefs } from 'pinia'
|
2025-10-13 15:08:54 +08:00
|
|
|
|
import dayjs from '@/utils/time'
|
2025-10-05 21:45:39 +08:00
|
|
|
|
|
2025-10-06 21:18:19 +08:00
|
|
|
|
// 使用 stores
|
2025-10-05 21:45:39 +08:00
|
|
|
|
const infoStore = useInfoStore()
|
2025-10-06 21:18:19 +08:00
|
|
|
|
const userStore = useUserStore()
|
2025-10-11 15:02:24 +08:00
|
|
|
|
const taskerStore = useTaskerStore()
|
|
|
|
|
|
const { activeCount: activeCountRef } = storeToRefs(taskerStore)
|
2025-10-05 21:45:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 响应式数据
|
|
|
|
|
|
const currentTime = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
// 计算属性
|
|
|
|
|
|
const organization = computed(() => infoStore.organization)
|
|
|
|
|
|
const branding = computed(() => infoStore.branding)
|
|
|
|
|
|
|
2025-10-06 21:18:19 +08:00
|
|
|
|
// 用户名计算属性
|
|
|
|
|
|
const currentUser = computed(() => {
|
|
|
|
|
|
return userStore.username || '游客'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 问候语计算属性
|
|
|
|
|
|
const greeting = computed(() => {
|
2025-10-13 15:08:54 +08:00
|
|
|
|
const hour = dayjs().tz('Asia/Shanghai').hour()
|
2025-10-06 21:18:19 +08:00
|
|
|
|
let greetingText = ''
|
|
|
|
|
|
|
|
|
|
|
|
if (hour >= 5 && hour < 12) {
|
|
|
|
|
|
greetingText = '早上好'
|
|
|
|
|
|
} else if (hour >= 12 && hour < 14) {
|
|
|
|
|
|
greetingText = '中午好'
|
|
|
|
|
|
} else if (hour >= 14 && hour < 18) {
|
|
|
|
|
|
greetingText = '下午好'
|
|
|
|
|
|
} else if (hour >= 18 && hour < 22) {
|
|
|
|
|
|
greetingText = '晚上好'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
greetingText = '夜深了'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return `${greetingText}!${currentUser.value}`
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-10-11 15:02:24 +08:00
|
|
|
|
const activeTaskCount = computed(() => activeCountRef.value || 0)
|
|
|
|
|
|
|
|
|
|
|
|
const openTaskCenter = () => {
|
|
|
|
|
|
taskerStore.openDrawer()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-05 21:45:39 +08:00
|
|
|
|
// 更新时间
|
|
|
|
|
|
const updateTime = () => {
|
2025-10-13 15:08:54 +08:00
|
|
|
|
const now = dayjs().tz('Asia/Shanghai')
|
|
|
|
|
|
currentTime.value = now.format('YYYY年MM月DD日 HH:mm:ss')
|
2025-10-05 21:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 定时器
|
|
|
|
|
|
let timeInterval = null
|
|
|
|
|
|
|
2025-10-06 21:18:19 +08:00
|
|
|
|
onMounted(async () => {
|
2025-10-05 21:45:39 +08:00
|
|
|
|
updateTime()
|
|
|
|
|
|
timeInterval = setInterval(updateTime, 1000)
|
2025-10-06 21:18:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取用户信息
|
|
|
|
|
|
try {
|
|
|
|
|
|
await userStore.getCurrentUser()
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取用户信息失败:', error)
|
|
|
|
|
|
}
|
2025-10-05 21:45:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
if (timeInterval) {
|
|
|
|
|
|
clearInterval(timeInterval)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
.status-bar {
|
2025-11-23 01:39:44 +08:00
|
|
|
|
// background: var(--gray-0);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
// backdrop-filter: blur(10px);
|
2025-10-07 00:15:14 +08:00
|
|
|
|
// height: 60px;
|
2025-10-05 21:45:39 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
// position: sticky;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
z-index: 100;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-bar-content {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2025-10-07 00:15:14 +08:00
|
|
|
|
padding: 16px;
|
|
|
|
|
|
// padding-bottom: 0;
|
2025-10-05 21:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-left {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.system-info {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.system-details {
|
|
|
|
|
|
.system-name {
|
2025-10-06 21:18:19 +08:00
|
|
|
|
font-size: 20px;
|
2025-10-05 21:45:39 +08:00
|
|
|
|
font-weight: 600;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-900, #111827);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.system-subtitle {
|
2025-10-06 21:18:19 +08:00
|
|
|
|
font-size: 13px;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-600, #6b7280);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
line-height: 1.2;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-right {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
gap: 18px;
|
|
|
|
|
|
font-size: 13px;
|
2025-10-05 21:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-11 15:02:24 +08:00
|
|
|
|
.task-center-entry {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-badge {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-button {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
gap: 8px;
|
|
|
|
|
|
padding: 6px 14px;
|
2025-10-11 15:02:24 +08:00
|
|
|
|
border-radius: 999px;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
color: var(--main-600, #2563eb);
|
2025-10-11 15:02:24 +08:00
|
|
|
|
font-size: 13px;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
border: 1px solid rgba(37, 99, 235, 0.3);
|
|
|
|
|
|
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
|
2025-10-11 15:02:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-button .icon {
|
2025-11-10 13:10:53 +08:00
|
|
|
|
width: 15px;
|
|
|
|
|
|
height: 15px;
|
|
|
|
|
|
color: inherit;
|
2025-10-11 15:02:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-label {
|
2025-11-10 13:10:53 +08:00
|
|
|
|
letter-spacing: 0.2px;
|
2025-10-11 15:02:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-entry:hover .task-center-button {
|
2025-11-10 13:10:53 +08:00
|
|
|
|
background-color: rgba(37, 99, 235, 0.08);
|
|
|
|
|
|
color: var(--main-700, #1d4ed8);
|
|
|
|
|
|
border-color: rgba(37, 99, 235, 0.5);
|
2025-10-11 15:02:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-center-badge :deep(.ant-badge-count) {
|
|
|
|
|
|
background-color: var(--main-color, #1d4ed8);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-05 21:45:39 +08:00
|
|
|
|
.time-info,
|
|
|
|
|
|
.user-info {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
font-size: 13px;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
line-height: 1.3;
|
|
|
|
|
|
color: var(--gray-600, #4b5563);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
|
|
|
|
|
|
.icon {
|
2025-11-10 13:10:53 +08:00
|
|
|
|
width: 15px;
|
|
|
|
|
|
height: 15px;
|
|
|
|
|
|
color: var(--gray-600, #6b7280);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.current-time,
|
2025-10-06 21:18:19 +08:00
|
|
|
|
.user-greeting {
|
2025-10-05 21:45:39 +08:00
|
|
|
|
font-weight: 500;
|
2025-11-10 13:10:53 +08:00
|
|
|
|
color: var(--gray-900, #111827);
|
2025-10-05 21:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 响应式设计
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.status-bar {
|
|
|
|
|
|
height: 44px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-bar-content {
|
|
|
|
|
|
padding: 0 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.system-details {
|
|
|
|
|
|
.system-name {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.system-subtitle {
|
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-right {
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time-info,
|
|
|
|
|
|
.user-info {
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
|
width: 12px;
|
|
|
|
|
|
height: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.current-time {
|
|
|
|
|
|
display: none; // 在小屏幕上隐藏时间
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|