增加store存储account等数据
This commit is contained in:
parent
39dc6bf266
commit
0e1ed8d5b4
@ -1 +1 @@
|
||||
VUE_APP_API_HOST='https://game2006api-test.kingsome.cn'
|
||||
VUE_APP_API_HOST='http://192.168.100.83:3000'
|
7
src/api/webapi.js
Normal file
7
src/api/webapi.js
Normal file
@ -0,0 +1,7 @@
|
||||
import axios from "axios";
|
||||
|
||||
export function checkStatus(account) {
|
||||
return axios.post(process.env.VUE_APP_API_HOST + "/aa1/user_status", {
|
||||
account,
|
||||
});
|
||||
}
|
@ -1,17 +1,28 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
|
||||
Vue.use(Vuex)
|
||||
Vue.use(Vuex);
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
},
|
||||
getters: {
|
||||
state() {
|
||||
return {
|
||||
account: "",
|
||||
token: "",
|
||||
status: 0,
|
||||
};
|
||||
},
|
||||
getters: {},
|
||||
mutations: {
|
||||
updataAccount(state, _account) {
|
||||
state.account = _account;
|
||||
},
|
||||
updataToken(state, _token) {
|
||||
state.token = _token;
|
||||
},
|
||||
updateStatus(state, _state) {
|
||||
state.status = _state;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
modules: {
|
||||
}
|
||||
})
|
||||
actions: {},
|
||||
modules: {},
|
||||
});
|
||||
|
@ -62,6 +62,8 @@ export default {
|
||||
logined: this.chain.logined,
|
||||
token: this.chain.token,
|
||||
};
|
||||
this.$store.commit('updataAccount', this.chain.account);
|
||||
this.$store.commit('updataToken', this.chain.token);
|
||||
window.localStorage.setItem("userinfo", JSON.stringify(userInfo));
|
||||
let userinfo = window.localStorage.getItem("userinfo");
|
||||
console.log(JSON.parse(userinfo) , "2022");
|
||||
|
Loading…
x
Reference in New Issue
Block a user