From 6bf51a5315bf33a5a7997bdef987559bd2998a40 Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Tue, 06 Jan 2026 10:47:15 +0800
Subject: [PATCH] 10.10
---
src/store/modules/user.js | 48 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9f64d1a..6ee53b0 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,18 +1,50 @@
+// import { getStorage, setStorage, getBrowserLang } from "@/utils/utis";
+import { _userInfo } from '@/service/user.api'
+import { SET_USERINFO, GET_USERINFO, SET_OUT, SET_STATUS } from "@/store/const.store";
+import { _getBalance } from '@/service/user.api.js'
export default {
namespaced: true,
state: {
- id: 0,
- name: "",
+ status: 0, // 状态
+ gasObj: {}, //
+ userInfo: {
+ usercode: '', //
+ token: '', // 登录token
+ username: ''
+ }
+ },
+ getters: {
+ mingStatus: state => state.status,
+ isToken: state => state.token,
+ userInfo: state => state.userInfo
},
mutations: {
- updateId(state, id) {
- state.id = id;
+ // SET_GAS_OBJ(state,gasObj){
+ // state.gasObj=gasObj
+ // },
+ [SET_STATUS](state, status) { // 质押状态
+ state.status = status;
},
- updateName(state, name) {
- state.name = name;
+ [SET_USERINFO](state, info) {
+ state.userInfo = { ...state.userInfo, ...info }
},
- googleAuthBind(state, googleAuthBind) {
- state.googleAuthBind = googleAuthBind;
+ [SET_OUT](state) { // 退出
+ state.userInfo = {}
+ }
+ },
+ actions: {
+ // actionsGasObj({commit},data){
+ // commit("SET_GAS_OBJ", data);
+ // },
+ // actionsLogin({ commit }, data) {
+ // commit("SET_UESR_OBJ", data);
+ // },
+ async [GET_USERINFO]({ commit }, accounts) { // 发送请求获取信息
+ commit(SET_USERINFO, accounts) // 登陆
+ let data = await _userInfo()
+ commit(SET_USERINFO, data) // 用户信息
+ data = await _getBalance()
+ commit(SET_USERINFO, { balance: data.money }) // 余额
},
},
};
--
Gitblit v1.9.3