|
@@ -1,37 +1,43 @@
|
|
|
+import request from '@/api/request'
|
|
|
+
|
|
|
const state = {
|
|
|
- phone: '', // 登录手机号
|
|
|
- token: '', // APP登录
|
|
|
- BarList: [], // 所有酒吧列表
|
|
|
- objCurrentBarInfo: {} // 当前所在酒吧
|
|
|
+ userinfo: {
|
|
|
+ user_head_img_url: '', // 用户头像
|
|
|
+ user_nickname: '', // 用户昵称
|
|
|
+ user_sex: '', // 用户性别
|
|
|
+ user_balance: '', // 用户可提现余额(单位为分)
|
|
|
+ user_unreceive_balance: '', // 用户未结算金额(单位为分
|
|
|
+ created_at: '' // 注册时间
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const getters = {
|
|
|
- phone (state) {
|
|
|
- return state.phone
|
|
|
- },
|
|
|
- token (state) {
|
|
|
- return state.token
|
|
|
- },
|
|
|
- BarList (state) {
|
|
|
- return state.BarList
|
|
|
- },
|
|
|
- objCurrentBarInfo (state) {
|
|
|
- return state.objCurrentBarInfo
|
|
|
+ userinfo (state) {
|
|
|
+ return state.userinfo
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const actions = {
|
|
|
+ async getUserInfo ({ commit }) {
|
|
|
+ try {
|
|
|
+ const { status, data } = await request({
|
|
|
+ method: 'GET',
|
|
|
+ url: '/api/user/info'
|
|
|
+ })
|
|
|
+ if (status) {
|
|
|
+ commit('UPDATE_USERINFO', data)
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
|
- UPDATE_PHONE (state, value) {
|
|
|
- state.phone = value
|
|
|
- },
|
|
|
- UPDATE_TOKEN (state, value) {
|
|
|
- state.token = value
|
|
|
- },
|
|
|
- UPDATE_BARLIST (state, value) {
|
|
|
- state.BarList = value
|
|
|
- },
|
|
|
- UPDATE_OBJCURRENTBARINFO (state, value) {
|
|
|
- state.objCurrentBarInfo = value
|
|
|
+ UPDATE_USERINFO (state, value) {
|
|
|
+ state.userinfo = {
|
|
|
+ ...value
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -39,5 +45,6 @@ export default {
|
|
|
namespaced: true,
|
|
|
state,
|
|
|
getters,
|
|
|
+ actions,
|
|
|
mutations
|
|
|
}
|