2026-04-17 15:45:54 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
2026-04-17 16:35:40 +08:00
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
2026-04-17 15:45:54 +08:00
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
|
|
import { useGroupStore } from '@/stores/group'
|
|
|
|
|
import { useTeamStore } from '@/stores/team'
|
2026-04-17 16:35:40 +08:00
|
|
|
import { useNotificationStore } from '@/stores/notification'
|
2026-04-17 15:45:54 +08:00
|
|
|
import StatusToggle from '@/components/team/StatusToggle.vue'
|
|
|
|
|
import WorkScheduleModal from '@/components/team/WorkScheduleModal.vue'
|
2026-04-17 16:35:40 +08:00
|
|
|
import NotificationPanel from '@/components/common/NotificationPanel.vue'
|
2026-04-17 17:53:58 +08:00
|
|
|
import CreateGroupDialog from '@/components/group/CreateGroupDialog.vue'
|
|
|
|
|
import JoinGroupDialog from '@/components/group/JoinGroupDialog.vue'
|
2026-04-17 15:45:54 +08:00
|
|
|
|
|
|
|
|
const router = useRouter()
|
2026-04-17 16:35:40 +08:00
|
|
|
const route = useRoute()
|
2026-04-17 15:45:54 +08:00
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const groupStore = useGroupStore()
|
|
|
|
|
const teamStore = useTeamStore()
|
2026-04-17 16:35:40 +08:00
|
|
|
const notificationStore = useNotificationStore()
|
2026-04-17 15:45:54 +08:00
|
|
|
|
|
|
|
|
const showScheduleModal = ref(false)
|
2026-04-17 17:53:58 +08:00
|
|
|
const showCreateGroup = ref(false)
|
|
|
|
|
const showJoinGroup = ref(false)
|
2026-04-17 15:45:54 +08:00
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await userStore.initUser()
|
|
|
|
|
await groupStore.loadGroups()
|
|
|
|
|
await teamStore.loadActiveSession()
|
2026-04-17 16:35:40 +08:00
|
|
|
await notificationStore.loadPendingInvitations()
|
2026-04-17 15:45:54 +08:00
|
|
|
})
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
function handleLogout() {
|
2026-04-17 15:45:54 +08:00
|
|
|
userStore.logout()
|
|
|
|
|
router.push({ name: 'Login' })
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
function selectGroup(groupId: string) {
|
|
|
|
|
groupStore.setCurrentGroup(groupId)
|
|
|
|
|
router.push({ name: 'GroupView', params: { id: groupId } })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function goHome() {
|
|
|
|
|
router.push({ name: 'Home' })
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-04-17 16:35:40 +08:00
|
|
|
<div class="app-layout">
|
|
|
|
|
<!-- 侧边栏 -->
|
|
|
|
|
<aside class="sidebar">
|
|
|
|
|
<div class="sidebar-top">
|
|
|
|
|
<div class="logo" @click="goHome">
|
|
|
|
|
<span class="logo-icon">🎮</span>
|
|
|
|
|
<span class="logo-text">Game Group</span>
|
|
|
|
|
</div>
|
2026-04-17 15:45:54 +08:00
|
|
|
</div>
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
<nav class="sidebar-nav">
|
|
|
|
|
<router-link to="/" class="nav-item" active-class="nav-item--active">
|
|
|
|
|
<span class="nav-icon">🏠</span>
|
|
|
|
|
<span>首页</span>
|
|
|
|
|
</router-link>
|
|
|
|
|
<router-link to="/games" class="nav-item" active-class="nav-item--active">
|
|
|
|
|
<span class="nav-icon">🎯</span>
|
|
|
|
|
<span>游戏库</span>
|
|
|
|
|
</router-link>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<div class="sidebar-divider" />
|
|
|
|
|
|
|
|
|
|
<div class="sidebar-groups">
|
|
|
|
|
<div class="section-header">
|
|
|
|
|
<span class="section-title">我的群组</span>
|
2026-04-17 17:53:58 +08:00
|
|
|
<div class="section-actions">
|
|
|
|
|
<button class="section-btn" @click="showCreateGroup = true" title="创建群组">+</button>
|
|
|
|
|
<button class="section-btn" @click="showJoinGroup = true" title="加入群组">🔗</button>
|
|
|
|
|
</div>
|
2026-04-17 16:35:40 +08:00
|
|
|
</div>
|
|
|
|
|
<div v-if="groupStore.groups.length === 0" class="empty-groups">
|
|
|
|
|
暂无群组
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="group in groupStore.groups"
|
|
|
|
|
:key="group.id"
|
|
|
|
|
class="group-item"
|
|
|
|
|
:class="{ 'group-item--active': route.params.id === group.id }"
|
|
|
|
|
@click="selectGroup(group.id)"
|
|
|
|
|
>
|
|
|
|
|
<span class="group-name">{{ group.name }}</span>
|
|
|
|
|
<span class="group-count">{{ group.members?.length || 0 }}</span>
|
|
|
|
|
</div>
|
2026-04-17 15:45:54 +08:00
|
|
|
</div>
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
<div class="sidebar-bottom">
|
|
|
|
|
<div class="sidebar-divider" />
|
|
|
|
|
<div class="user-section">
|
|
|
|
|
<StatusToggle />
|
|
|
|
|
<button class="schedule-btn" @click="showScheduleModal = true" title="设置工作时间">
|
|
|
|
|
⏰
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="user-info">
|
|
|
|
|
<img
|
|
|
|
|
:src="userStore.user?.avatar || '/default-avatar.png'"
|
|
|
|
|
class="user-avatar"
|
|
|
|
|
alt=""
|
|
|
|
|
/>
|
|
|
|
|
<span class="user-name">{{ userStore.user?.username }}</span>
|
|
|
|
|
<button class="logout-btn" @click="handleLogout" title="退出登录">
|
|
|
|
|
🚪
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-04-17 15:45:54 +08:00
|
|
|
</div>
|
2026-04-17 16:35:40 +08:00
|
|
|
</aside>
|
2026-04-17 15:45:54 +08:00
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
<!-- 右侧 -->
|
|
|
|
|
<div class="main-wrapper">
|
|
|
|
|
<header class="top-header">
|
|
|
|
|
<h2 class="page-title">
|
|
|
|
|
{{ $route.name === 'GroupView' ? groupStore.currentGroup?.name : $route.name === 'GamesLibrary' ? '游戏库' : $route.name === 'Profile' ? '个人中心' : $route.name === 'Settings' ? '设置' : '首页' }}
|
|
|
|
|
</h2>
|
|
|
|
|
<div class="header-actions">
|
|
|
|
|
<button class="icon-btn" @click="notificationStore.togglePanel()">
|
|
|
|
|
<span v-if="notificationStore.unreadCount > 0" class="badge">
|
|
|
|
|
{{ notificationStore.unreadCount }}
|
|
|
|
|
</span>
|
|
|
|
|
🔔
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
2026-04-17 15:45:54 +08:00
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
<main class="main-content">
|
|
|
|
|
<router-view />
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 弹窗 -->
|
|
|
|
|
<WorkScheduleModal v-model="showScheduleModal" />
|
|
|
|
|
<NotificationPanel />
|
2026-04-17 17:53:58 +08:00
|
|
|
<CreateGroupDialog v-model="showCreateGroup" />
|
|
|
|
|
<JoinGroupDialog v-model="showJoinGroup" />
|
2026-04-17 15:45:54 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-04-17 16:35:40 +08:00
|
|
|
.app-layout {
|
|
|
|
|
display: flex;
|
2026-04-17 15:45:54 +08:00
|
|
|
min-height: 100vh;
|
2026-04-17 16:35:40 +08:00
|
|
|
background: var(--gg-bg);
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
/* ── 侧边栏 ── */
|
|
|
|
|
.sidebar {
|
|
|
|
|
width: 240px;
|
|
|
|
|
background: var(--gg-bg-card);
|
|
|
|
|
border-right: 1px solid var(--gg-border);
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
2026-04-17 16:35:40 +08:00
|
|
|
flex-direction: column;
|
|
|
|
|
position: fixed;
|
2026-04-17 15:45:54 +08:00
|
|
|
top: 0;
|
2026-04-17 16:35:40 +08:00
|
|
|
left: 0;
|
|
|
|
|
bottom: 0;
|
2026-04-17 15:45:54 +08:00
|
|
|
z-index: 100;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.sidebar-top {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo {
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2026-04-17 16:35:40 +08:00
|
|
|
gap: 10px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
user-select: none;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.logo-icon {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo-text {
|
2026-04-17 15:45:54 +08:00
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 700;
|
2026-04-17 16:35:40 +08:00
|
|
|
background: var(--gg-gradient);
|
2026-04-17 15:45:54 +08:00
|
|
|
-webkit-background-clip: text;
|
|
|
|
|
-webkit-text-fill-color: transparent;
|
2026-04-17 16:35:40 +08:00
|
|
|
background-clip: text;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
/* ── 导航 ── */
|
|
|
|
|
.sidebar-nav {
|
|
|
|
|
padding: 0 12px;
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
2026-04-17 16:35:40 +08:00
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 4px;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.nav-item {
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
2026-04-17 16:35:40 +08:00
|
|
|
align-items: center;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
padding: 10px 14px;
|
|
|
|
|
border-radius: var(--gg-radius-sm);
|
|
|
|
|
color: var(--gg-text-secondary);
|
2026-04-17 15:45:54 +08:00
|
|
|
text-decoration: none;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.nav-item:hover {
|
|
|
|
|
background: var(--gg-bg-hover);
|
|
|
|
|
color: var(--gg-text);
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.nav-item--active {
|
2026-04-17 18:07:14 +08:00
|
|
|
background: rgba(5, 150, 105, 0.1);
|
|
|
|
|
color: var(--gg-primary);
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.nav-icon {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ── 分割线 ── */
|
|
|
|
|
.sidebar-divider {
|
|
|
|
|
height: 1px;
|
|
|
|
|
background: var(--gg-border);
|
|
|
|
|
margin: 12px 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ── 群组列表 ── */
|
|
|
|
|
.sidebar-groups {
|
|
|
|
|
flex: 1;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
padding: 0 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding: 4px 14px;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-title {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: var(--gg-text-muted);
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 17:53:58 +08:00
|
|
|
.section-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-btn {
|
|
|
|
|
background: none;
|
|
|
|
|
border: 1px solid var(--gg-border);
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
color: var(--gg-text-secondary);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 2px 8px;
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-btn:hover {
|
|
|
|
|
border-color: var(--gg-primary);
|
|
|
|
|
color: var(--gg-primary);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.empty-groups {
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: var(--gg-text-muted);
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.group-item {
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2026-04-17 16:35:40 +08:00
|
|
|
justify-content: space-between;
|
|
|
|
|
padding: 10px 14px;
|
|
|
|
|
border-radius: var(--gg-radius-sm);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.group-item:hover {
|
|
|
|
|
background: var(--gg-bg-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.group-item--active {
|
2026-04-17 18:07:14 +08:00
|
|
|
background: rgba(5, 150, 105, 0.1);
|
2026-04-17 16:35:40 +08:00
|
|
|
border-left: 3px solid var(--gg-primary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.group-name {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: var(--gg-text);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.group-count {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: var(--gg-text-muted);
|
|
|
|
|
background: var(--gg-bg-elevated);
|
|
|
|
|
padding: 2px 8px;
|
|
|
|
|
border-radius: 10px;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
/* ── 底部用户区 ── */
|
|
|
|
|
.sidebar-bottom {
|
|
|
|
|
padding: 0 12px 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-section {
|
2026-04-17 15:45:54 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
2026-04-17 16:35:40 +08:00
|
|
|
padding: 8px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.schedule-btn {
|
|
|
|
|
background: none;
|
|
|
|
|
border: none;
|
|
|
|
|
font-size: 16px;
|
2026-04-17 15:45:54 +08:00
|
|
|
cursor: pointer;
|
2026-04-17 16:35:40 +08:00
|
|
|
padding: 6px 10px;
|
|
|
|
|
border-radius: var(--gg-radius-sm);
|
2026-04-17 15:45:54 +08:00
|
|
|
transition: background-color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.schedule-btn:hover {
|
|
|
|
|
background: var(--gg-bg-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-info {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
padding: 10px 14px;
|
|
|
|
|
background: var(--gg-bg);
|
|
|
|
|
border-radius: var(--gg-radius-sm);
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-avatar {
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
border-radius: 50%;
|
2026-04-17 16:35:40 +08:00
|
|
|
object-fit: cover;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-name {
|
2026-04-17 16:35:40 +08:00
|
|
|
flex: 1;
|
2026-04-17 15:45:54 +08:00
|
|
|
font-size: 14px;
|
2026-04-17 16:35:40 +08:00
|
|
|
color: var(--gg-text);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:35:40 +08:00
|
|
|
.logout-btn {
|
|
|
|
|
background: none;
|
|
|
|
|
border: none;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 4px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
transition: opacity 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logout-btn:hover {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ── 右侧主区域 ── */
|
|
|
|
|
.main-wrapper {
|
|
|
|
|
flex: 1;
|
|
|
|
|
margin-left: 240px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.top-header {
|
|
|
|
|
height: 60px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding: 0 28px;
|
|
|
|
|
background: var(--gg-bg-card);
|
|
|
|
|
border-bottom: 1px solid var(--gg-border);
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
z-index: 50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.page-title {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: var(--gg-text);
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-btn {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: none;
|
|
|
|
|
border: none;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
border-radius: var(--gg-radius-sm);
|
|
|
|
|
transition: background-color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-btn:hover {
|
|
|
|
|
background: var(--gg-bg-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.badge {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 2px;
|
|
|
|
|
right: 2px;
|
|
|
|
|
background: var(--gg-danger);
|
|
|
|
|
color: white;
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
min-width: 16px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
line-height: 16px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 0 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.main-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 24px 28px;
|
2026-04-17 15:45:54 +08:00
|
|
|
}
|
|
|
|
|
</style>
|