修复无法获取user_info问题
This commit is contained in:
parent
9429a700d0
commit
bec473e62a
@ -1,3 +1,3 @@
|
|||||||
# 开发环境接口
|
# 开发环境接口
|
||||||
# VITE_API_BASE_URL=http://localhost:8000
|
# VITE_API_BASE_URL=http://localhost:8000
|
||||||
VITE_API_BASE_URL=http://backend.yunzer.cn
|
VITE_API_BASE_URL=https://backend.yunzer.cn
|
||||||
@ -1,2 +1,2 @@
|
|||||||
# 生产环境接口
|
# 生产环境接口
|
||||||
VITE_API_BASE_URL=http://backend.yunzer.cn
|
VITE_API_BASE_URL=https://backend.yunzer.cn
|
||||||
|
|||||||
@ -36,10 +36,10 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
const userInfo = loginData.user || loginData
|
const userInfo = loginData.user || loginData
|
||||||
|
|
||||||
const normalizedUser = {
|
const normalizedUser = {
|
||||||
id: parseInt(userInfo.id || userInfo.id) || null,
|
id: parseInt(userInfo.id) || null,
|
||||||
account: userInfo.account || userInfo.account,
|
account: userInfo.account || '',
|
||||||
name: userInfo.name || userInfo.name,
|
name: userInfo.name || '',
|
||||||
group_id: userInfo.group_id || userInfo.group_id,
|
group_id: userInfo.group_id || '',
|
||||||
avatar: userInfo.avatar || ''
|
avatar: userInfo.avatar || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -356,6 +356,7 @@ onMounted(async () => {
|
|||||||
try {
|
try {
|
||||||
// 从auth store获取用户信息
|
// 从auth store获取用户信息
|
||||||
const id = authStore.user.id;
|
const id = authStore.user.id;
|
||||||
|
console.log('用户ID:', id);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
console.error('用户ID不存在');
|
console.error('用户ID不存在');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user