user.js 716 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * 用户状态管理
  3. */
  4. import {
  5. defineStore
  6. } from 'pinia'
  7. import {
  8. getCardInfo,
  9. getCardQrcode,
  10. getCompanyInfo
  11. } from '@/api/card.js'
  12. export const useUserStore = defineStore('user', {
  13. state: () => ({
  14. userLoc: null
  15. }),
  16. actions: {
  17. // 获取用户卡片信息
  18. queryCardInfo(userId = null) {
  19. return new Promise(async(resolve, reject) => {
  20. let res = await getCardInfo({
  21. userId
  22. })
  23. console.log(res, "aaaaaaaaaaaaaaaaa");
  24. resolve(res.data)
  25. })
  26. },
  27. queryCompanyInfo(userId = null) {
  28. return new Promise(async(resolve, reject) => {
  29. let res = await getCompanyInfo({
  30. userId
  31. })
  32. console.log(res, "bbbbbbbbbbbbbbbbbb");
  33. resolve(res.data)
  34. })
  35. },
  36. }
  37. })