1
李凌
2025-10-09 c17311ba1351cd5e64654c3fc7b2fe765b1e7382
src/store/modules/user.js
@@ -2,6 +2,7 @@
import { _register, _userInfo } from '@/service/user.api'
import { SET_USERINFO, GET_USERINFO, SET_OUT, CONNECT_WALLET, SET_STATUS } from "@/store/const.store";
import { _getBalance } from '@/service/user.api.js'
import { _customer } from "@/service/user.api.js";
export default {
  namespaced: true,
  state: {
@@ -11,7 +12,8 @@
      usercode: '', // 
      token: '', // 登录token
      username: ''
    }
    },
    customer_service_url: null, // 客服地址
  },
  getters: {
    mingStatus: state => state.status,
@@ -31,6 +33,10 @@
    },
    [SET_OUT](state) { // 退出
      state.userInfo = {}
    },
    // 设置客服链接
    'SET_CUSTOMER_SERVICE_URL'(state, url) {
      state.customer_service_url = url || null
    }
  },
  actions: {
@@ -47,5 +53,9 @@
      data = await _getBalance()
      commit(SET_USERINFO, { balance: data.money }) // 余额
    },
    async 'GET_CUSTOMER_SERVICE_URL'({ commit }) { // 获取客服地址
      let data = await _customer()
      commit('SET_CUSTOMER_SERVICE_URL', data.url) // 客服地址
    }
  },
};