邃芒智像(Uniapp : WX、TT、H5)
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

58 lignes
1.5 KiB

  1. import { defineStore } from "pinia";
  2. import { ref, reactive } from "vue";
  3. // import { request } from "../../utils/request"
  4. /**
  5. * @description:用户信息持久化数据
  6. */
  7. export const userInfoModules = defineStore("userInfoStore", () => {
  8. // state
  9. const userInfo = ref(null)
  10. const openId = ref(null)
  11. const token = ref(null)
  12. const myAvatar = ref('')
  13. const myGlod = ref(0)
  14. /**
  15. * @description:依托平台:(web、mp-weixin、mp-toutiao)
  16. * @example 平台名:"web-H5",枚举值:1
  17. * @example 平台名:"mp-weixin",枚举值:2
  18. * @example 平台名:"mp-toutiao",枚举值:3
  19. */
  20. const platForm = ref(null)
  21. /**
  22. * @description:宿主系统:(windows、ios、android、mac、linux)
  23. * @example 系统名:windows,值:1
  24. * @example 系统名:ios,值:2
  25. * @example 系统名:android,值:3
  26. * @example 系统名:mac,值:4
  27. * @example 系统名:linux,值:5
  28. */
  29. const hostSystem = ref(null)
  30. // 登录获取用户信息
  31. // async function getMyAvatar() {
  32. // }
  33. // 退出清除用户信息
  34. // async function getMyGlod(params) {
  35. // }
  36. return { userInfo, openId, token, myAvatar, myGlod, platForm, hostSystem };
  37. },
  38. {
  39. // persist: true
  40. unistorage: true,
  41. }
  42. // persist: {
  43. // storage: {
  44. // // getItem: uni.getStorageSync,
  45. // token: uni.getStorageSync,
  46. // setItem: uni.setStorageSync
  47. // }
  48. // },
  49. );