更新:登录功能

This commit is contained in:
2025-11-04 12:37:04 +08:00
commit a21fb92916
897 changed files with 51500 additions and 0 deletions

19
utils/auth.ts Normal file
View File

@@ -0,0 +1,19 @@
// utils/auth.ts
import { useUserStore } from '@/stores/user'
export function getAuthToken(): string {
try {
const store = useUserStore()
return store?.token || uni.getStorageSync('token') || ''
} catch {
return uni.getStorageSync('token') || ''
}
}
export function setAuthToken(token: string) {
uni.setStorageSync('token', token)
}
export function clearAuthToken() {
uni.removeStorageSync('token')
}