feat: add JWT authentication and AGENTS.md
This commit is contained in:
@@ -6,6 +6,7 @@ import { useCategoryStore } from '@/stores/useCategoryStore'
|
||||
import { useTagStore } from '@/stores/useTagStore'
|
||||
import { useUIStore } from '@/stores/useUIStore'
|
||||
import { useUserSettingsStore } from '@/stores/useUserSettingsStore'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import AppHeader from '@/components/AppHeader.vue'
|
||||
import TaskDialog from '@/components/TaskDialog.vue'
|
||||
@@ -18,6 +19,7 @@ const categoryStore = useCategoryStore()
|
||||
const tagStore = useTagStore()
|
||||
const uiStore = useUIStore()
|
||||
const userSettingsStore = useUserSettingsStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
// 路由变化时同步 currentView
|
||||
watch(() => route.meta.view, (view) => {
|
||||
@@ -33,6 +35,8 @@ watch(() => userSettingsStore.siteName, (name) => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
if (!authStore.isLoggedIn) return
|
||||
|
||||
await userSettingsStore.fetchAndSync()
|
||||
|
||||
// 根据用户设置初始化默认排序
|
||||
@@ -63,41 +67,46 @@ onMounted(async () => {
|
||||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<div class="app-container">
|
||||
<div class="decoration-star" style="top: 20%; right: 8%; animation-delay: 0.5s;"></div>
|
||||
<div class="decoration-star" style="top: 60%; left: 3%; animation-delay: 1s;"></div>
|
||||
<div class="decoration-star" style="top: 80%; right: 5%; animation-delay: 1.5s;"></div>
|
||||
<template v-if="route.name !== 'login'">
|
||||
<div class="decoration-star" style="top: 20%; right: 8%; animation-delay: 0.5s;"></div>
|
||||
<div class="decoration-star" style="top: 60%; left: 3%; animation-delay: 1s;"></div>
|
||||
<div class="decoration-star" style="top: 80%; right: 5%; animation-delay: 1.5s;"></div>
|
||||
|
||||
<AppHeader />
|
||||
<AppHeader />
|
||||
|
||||
<div class="app-main">
|
||||
<main
|
||||
class="main-content"
|
||||
:class="{
|
||||
'full-width': uiStore.currentView !== 'list'
|
||||
}"
|
||||
>
|
||||
<router-view v-slot="{ Component }">
|
||||
<Transition name="view-fade" mode="out-in">
|
||||
<component :is="Component" />
|
||||
</Transition>
|
||||
</router-view>
|
||||
</main>
|
||||
</div>
|
||||
<div class="app-main">
|
||||
<main
|
||||
class="main-content"
|
||||
:class="{
|
||||
'full-width': uiStore.currentView !== 'list'
|
||||
}"
|
||||
>
|
||||
<router-view v-slot="{ Component }">
|
||||
<Transition name="view-fade" mode="out-in">
|
||||
<component :is="Component" />
|
||||
</Transition>
|
||||
</router-view>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div v-if="uiStore.currentView !== 'settings' && uiStore.currentView !== 'profile' && uiStore.currentView !== 'habits' && uiStore.currentView !== 'anniversaries' && uiStore.currentView !== 'assets'" class="fab-container">
|
||||
<el-button
|
||||
type="primary"
|
||||
circle
|
||||
size="large"
|
||||
class="add-btn btn-glow"
|
||||
@click="uiStore.openTaskDialog()"
|
||||
>
|
||||
<el-icon :size="24"><Plus /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="uiStore.currentView !== 'settings' && uiStore.currentView !== 'profile' && uiStore.currentView !== 'habits' && uiStore.currentView !== 'anniversaries' && uiStore.currentView !== 'assets'" class="fab-container">
|
||||
<el-button
|
||||
type="primary"
|
||||
circle
|
||||
size="large"
|
||||
class="add-btn btn-glow"
|
||||
@click="uiStore.openTaskDialog()"
|
||||
>
|
||||
<el-icon :size="24"><Plus /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<TaskDialog />
|
||||
<CategoryDialog />
|
||||
<TaskDialog />
|
||||
<CategoryDialog />
|
||||
</template>
|
||||
<router-view v-else v-slot="{ Component }">
|
||||
<component :is="Component" />
|
||||
</router-view>
|
||||
</div>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user