index.js
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
const Store = new Vuex.Store({
state: {
/**
* 是否需要强制登录
*/
// forcedLogin: false,
userInfo: {}, //用户信息
loginStatus: 0, //登录状态,
loginInfo:{},//登录信息,工号 密码
menuButtonInfo:0,//顶部状态栏高度
},
getters: {
login_Status(state) {
return state.loginStatus
},
user_Info(state) {
return state.userInfo;
},
login_Info(state) {
return state.loginInfo;
},
},
mutations: {
setMenuButtonInfo(state, options){
state.menuButtonInfo = options
},
setLoginStatus(state, options) {
state.loginStatus = options
},
setUserInfo(state, options) {
state.userInfo = options
},
setLoginInfo(state, options) {
state.loginInfo = options
},
clearUserInfo(state, payload) {
state.userInfo = {}
state.loginInfo = {}
state.loginStatus = 0
}
},
actions: {
setUserInfo(context, options) {
context.commit('setUserInfo')
}
},
plugins: [
createPersistedState({
storage: {
getItem: key => wx.getStorageSync(key),
setItem: (key, value) => wx.setStorageSync(key, value),
removeItem: key => {}
}
})
]
})
/*
let _store = new Vuex.Store(Store)
export default _store*/
export default Store