前端重构 Vite

This commit is contained in:
2026-05-29 17:30:26 +08:00
parent cbd5d98993
commit 5bb9bc84ea
44 changed files with 7289 additions and 8769 deletions
+40
View File
@@ -0,0 +1,40 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
export interface Notification {
id: number
message: string
type: 'info' | 'success' | 'error' | 'warning'
timestamp: Date
visible: boolean
}
export interface AppUser {
id: number
username: string
full_name: string | null
is_superuser: boolean
[key: string]: any
}
export const useAppStore = defineStore('app', () => {
const user = ref<AppUser | null>(null)
const token = ref<string | null>(null)
const loading = ref(false)
const notifications = ref<Notification[]>([])
const initialized = ref(false)
function dismissNotification(id: number) {
const index = notifications.value.findIndex(n => n.id === id)
if (index > -1) notifications.value.splice(index, 1)
}
return {
user,
token,
loading,
notifications,
initialized,
dismissNotification,
}
})