Prechádzať zdrojové kódy

个人用户获取账户余额

Xiao_123 9 mesiacov pred
rodič
commit
8b505f7d19
1 zmenil súbory, kde vykonal 6 pridanie a 7 odobranie
  1. 6 7
      src/store/user.js

+ 6 - 7
src/store/user.js

@@ -153,23 +153,22 @@ export const useUserStore = defineStore('user',
         const data = await getEnterpriseUserAccount()
         if (!data) return
         this.enterpriseUserAccount = data
-        this.getUserAccountBalance(false)
-        // localStorage.setItem('enterpriseUserAccount', JSON.stringify(data))
+        // this.getUserAccountBalance()
+        localStorage.setItem('enterpriseUserAccount', JSON.stringify(data))
       },
       // 获取用户账户信息
       async getUserAccountInfo () {
         const data = await getUserAccount()
         if (!data) return
         this.userAccount = data
-        this.getUserAccountBalance(true)
+        this.getUserAccountBalance()
         // localStorage.setItem('userAccount', JSON.stringify(data))
       },
       // 获取账户余额
-      async getUserAccountBalance (type) {
+      async getUserAccountBalance () {
         const data = await getAccountBalance()
-        const obj = !type ? Object.assign(this.enterpriseUserAccount, data) : Object.assign(this.userAccount, data)
-        const key = !type ? 'enterpriseUserAccount' : 'userAccount'
-        localStorage.setItem(key, JSON.stringify(obj))
+        const obj = Object.assign(this.userAccount, data)
+        localStorage.setItem('userAccount', JSON.stringify(obj))
       }
     }
   },