Forráskód Böngészése

docs: 更改路径为正式环境v1.4

chenpeng 1 hete
szülő
commit
dfc71f3fdf
2 módosított fájl, 8 hozzáadás és 5 törlés
  1. 7 4
      stores/modules/common.ts
  2. 1 1
      stores/modules/user.ts

+ 7 - 4
stores/modules/common.ts

@@ -41,12 +41,15 @@ export const useCommonStore = defineStore(
      * 设置已经登陆的账号列表 (在登陆成功后调用)
      */
     const pushAccount = (user: any) => {
-      if (!user || !user.email)
+      if (!user.id)
         return
-      // 检查是否已经存在相同的账号
-      const existingAccount = accountList.value.find((item: any) => item.email === user.email && item.type === user.type)
-      if (existingAccount)
+      // 查找相同的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)
     }
     /**

+ 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, name: `${data.firstName} ${data.lastName}`, type: data.type })
+      commonStore.pushAccount({ email: data.email, id: data.id, name: `${data.firstName} ${data.lastName}`, type: data.type })
     }
 
     /** 登录操作 */