Browse Source

fix: bug修复阶段v2.8

chenpeng 1 week ago
parent
commit
68039a61f4
2 changed files with 5 additions and 3 deletions
  1. 4 2
      stores/modules/common.ts
  2. 1 1
      stores/modules/user.ts

+ 4 - 2
stores/modules/common.ts

@@ -43,14 +43,16 @@ export const useCommonStore = defineStore(
     const pushAccount = (user: any) => {
       if (!user.id)
         return
+
       // 查找相同的id,并更新email和name信息
       const existingAccount = accountList.value.find((item: any) => item.id === user.id)
       if (existingAccount) {
         existingAccount.email = user.email
         existingAccount.name = `${user.firstName} ${user.lastName}`
-        return
       }
-      accountList.value.push(user)
+      else {
+        accountList.value.push(user)
+      }
     }
     /**
      *  type 登录方式

+ 1 - 1
stores/modules/user.ts

@@ -25,7 +25,7 @@ export const useUserStore = defineStore(
     })
     const updateAccount = (data: any) => {
       const commonStore = useCommonStore()
-      commonStore.pushAccount({ email: data.email, id: data.id, name: `${data.firstName} ${data.lastName}`, type: data.type })
+      commonStore.pushAccount({ email: data.email, id: data.id, name: data.firstName ? `${data.firstName} ${data.lastName}` : '', type: data.type })
     }
 
     /** 登录操作 */