修复无法获取user_info问题

This commit is contained in:
李志强 2026-01-26 15:07:24 +08:00
parent 9429a700d0
commit bec473e62a
5 changed files with 7 additions and 8 deletions

2
.env
View File

@ -1,2 +0,0 @@
# 环境配置
# VITE_API_BASE_URL=http://backapi.yunzer.cn

View File

@ -1,3 +1,3 @@
# 开发环境接口
# VITE_API_BASE_URL=http://localhost:8000
VITE_API_BASE_URL=http://backend.yunzer.cn
VITE_API_BASE_URL=https://backend.yunzer.cn

View File

@ -1,2 +1,2 @@
# 生产环境接口
VITE_API_BASE_URL=http://backend.yunzer.cn
VITE_API_BASE_URL=https://backend.yunzer.cn

View File

@ -36,10 +36,10 @@ export const useAuthStore = defineStore('auth', () => {
const userInfo = loginData.user || loginData
const normalizedUser = {
id: parseInt(userInfo.id || userInfo.id) || null,
account: userInfo.account || userInfo.account,
name: userInfo.name || userInfo.name,
group_id: userInfo.group_id || userInfo.group_id,
id: parseInt(userInfo.id) || null,
account: userInfo.account || '',
name: userInfo.name || '',
group_id: userInfo.group_id || '',
avatar: userInfo.avatar || ''
}

View File

@ -356,6 +356,7 @@ onMounted(async () => {
try {
// auth store
const id = authStore.user.id;
console.log('用户ID:', id);
if (!id) {
console.error('用户ID不存在');
return;