耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
692 B

  1. import api from '@/request/index'
  2. import utils from '@/utils/utils.js'
  3. import {
  4. storageKeys,
  5. storage
  6. } from '@/utils/storage.js'
  7. export default {
  8. userInfo({ state, commit }) {
  9. return new Promise((resolve, reject) => {
  10. api('getUserInfo')
  11. .then(res => {
  12. let { code, message, result } = res
  13. if (code === 200) {
  14. let obj = { ...result.userInfo, ...result.account }
  15. commit('set_userInfo', obj);
  16. resolve(obj)
  17. } else {
  18. uni.showToast({
  19. title: message,
  20. icon: 'none',
  21. duration: 2000,
  22. })
  23. }
  24. })
  25. .catch(() => {
  26. uni.showToast({
  27. title: '获取信息失败!',
  28. icon: 'none',
  29. duration: 2000,
  30. })
  31. })
  32. })
  33. },
  34. }