Initial commit: 网络验证平台

This commit is contained in:
Admin
2026-04-27 17:22:56 +08:00
commit afe67d704e
780 changed files with 88960 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
import { defineStore } from 'pinia'
export const useAuthStore = defineStore('user', () => {
const isLogin = ref(false)
const user = ref<any>(null)
function checkAuth() {
const token = localStorage.getItem('token')
const userStr = localStorage.getItem('user')
if (token && userStr) {
try {
user.value = JSON.parse(userStr)
isLogin.value = true
}
catch {
isLogin.value = false
user.value = null
}
}
else {
isLogin.value = false
user.value = null
}
return isLogin.value
}
function logout() {
localStorage.removeItem('token')
localStorage.removeItem('user')
isLogin.value = false
user.value = null
}
return {
isLogin,
user,
checkAuth,
logout,
}
})
+31
View File
@@ -0,0 +1,31 @@
import { defineStore } from 'pinia'
import type { ContentLayout, Radius, Theme } from '@/constants/themes'
export const useThemeStore = defineStore('system-config', () => {
const radius = ref(0.5)
function setRadius(newRadius: Radius) {
radius.value = newRadius
}
const theme = ref<Theme>('zinc')
function setTheme(newTheme: Theme) {
theme.value = newTheme
}
const contentLayout = ref<ContentLayout>('centered')
function setContentLayout(newContentLayout: ContentLayout) {
contentLayout.value = newContentLayout
}
return {
radius,
setRadius,
theme,
setTheme,
contentLayout,
setContentLayout,
}
}, {
persist: true,
})