// 资产 import { Api_getAccountInfo } from "@/api/index.js" const state = { contractAccount:{}, bibiAccount:{}, legalAccount:{}, GiftMoneyAccount:{} } const mutations = { SET_CONTRACT: (state, contract) => { // 合约账户 state.contractAccount = contract; }, SET_BIBI: (state, bibi) => { // 币币账户 state.bibiAccount = bibi; }, SET_LEGAL: (state, legal) => { // 法币账户 state.legalAccount = legal; }, SET_GIFTMONEY: (state, GiftMoney) => { // 赠金账户 state.GiftMoneyAccount = GiftMoney; }, // SET_STOCKS_COLOR: (state, code) => { // state.stocksColor = code // }, // SET_TOKEN: (state, token) => { // setToken(token) // state.token = token // } } const actions = { // setToken = (token) => { // console.log('token = ' , token) // } // 获取资产 getPossession({ commit }, data) { // commit('SET_TOKEN', token) return new Promise((resolve, reject) => { Api_getAccountInfo().then(res => { commit('SET_CONTRACT' , res.lever_wallet); commit('SET_BIBI' , res.change_wallet); commit('SET_LEGAL' , res.legal_wallet); commit('SET_GIFTMONEY' , res.micro_wallet); resolve() }).catch(err => { reject() }).finally(() => { }) }) }, } export default { namespaced: true, state, mutations, actions }