2021-05-13 11:03:32 +08:00
|
|
|
import Vue from "vue";
|
|
|
|
import Vuex from "vuex";
|
|
|
|
import storage from "@/utils/storage";
|
|
|
|
|
|
|
|
Vue.use(Vuex);
|
2021-05-17 18:19:26 +08:00
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
const store = new Vuex.Store({
|
|
|
|
state: {
|
2023-04-11 18:41:34 +08:00
|
|
|
isShowToast:false, // 是否在展示Toast中
|
2022-07-14 14:20:15 +08:00
|
|
|
shareLink:"", //分享链接
|
2021-05-13 11:03:32 +08:00
|
|
|
verificationKey: "", //获取key表示验证通过
|
2021-05-21 16:47:26 +08:00
|
|
|
distributionId:"", //分销员Id 如果当前账户从未登录过时记录
|
2021-05-13 11:03:32 +08:00
|
|
|
hasLogin: storage.getHasLogin(),
|
|
|
|
userInfo: storage.getUserInfo(),
|
|
|
|
uuid: storage.getUuid(),
|
|
|
|
token: "",
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
login(state, userInfo) {
|
|
|
|
state.userInfo = userInfo || {};
|
|
|
|
state.userName =
|
|
|
|
userInfo.Name || userInfo.Nickname || userInfo.Username || "匿名用户";
|
|
|
|
state.hasLogin = true;
|
|
|
|
},
|
|
|
|
logout(state) {
|
|
|
|
state.userName = "";
|
|
|
|
state.hasLogin = false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions: {},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default store;
|