import api from '@/request/index'
|
|
import utils from '@/utils/utils.js'
|
|
|
|
import {
|
|
storageKeys,
|
|
storage
|
|
} from '@/utils/storage.js'
|
|
export default {
|
|
userInfo({ state, commit }) {
|
|
return new Promise((resolve, reject) => {
|
|
api('getUserInfo')
|
|
.then(res => {
|
|
let { code, message, result } = res
|
|
if (code === 200) {
|
|
let obj = { ...result.userInfo, ...result.account }
|
|
commit('set_userInfo', obj);
|
|
resolve(obj)
|
|
} else {
|
|
uni.showToast({
|
|
title: message,
|
|
icon: 'none',
|
|
duration: 2000,
|
|
})
|
|
}
|
|
})
|
|
.catch(() => {
|
|
uni.showToast({
|
|
title: '获取信息失败!',
|
|
icon: 'none',
|
|
duration: 2000,
|
|
})
|
|
})
|
|
})
|
|
},
|
|
}
|