feat(web): router with auth guard, AppShell, login + home views

This commit is contained in:
2026-04-29 10:02:45 +08:00
parent 3eb595cf5e
commit 9d93bcd24b
8 changed files with 181 additions and 4 deletions
+36
View File
@@ -0,0 +1,36 @@
<template>
<header class="border-b border-gray-200 dark:border-gray-700 px-4 py-2 flex items-center gap-4">
<h1 class="text-lg font-semibold flex-1">Agent Coding Workflow</h1>
<NotificationBell v-if="auth.isAuthenticated" />
<NDropdown v-if="auth.user" :options="menu" @select="onSelect">
<NButton text>{{ auth.user.display_name }}</NButton>
</NDropdown>
</header>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NDropdown } from 'naive-ui'
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { authApi } from '@/api/auth'
import NotificationBell from './NotificationBell.vue'
const auth = useAuthStore()
const router = useRouter()
const menu = computed(() => [
{ label: '退出登录', key: 'logout' },
])
async function onSelect(key: string) {
if (key === 'logout') {
try {
await authApi.logout()
} finally {
auth.clearSession()
router.replace({ name: 'login' })
}
}
}
</script>
@@ -0,0 +1,7 @@
<template>
<span class="text-sm text-gray-400">🔔</span>
</template>
<script setup lang="ts">
// I6 占位:真实未读轮询 + 弹层在 I6 实现。
</script>