44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
|
import Vue from 'vue'
|
||
|
import Vuex from 'vuex'
|
||
|
import createPersistedState from 'vuex-persistedstate'
|
||
|
|
||
|
Vue.use(Vuex)
|
||
|
const store = new Vuex.Store({
|
||
|
state: {
|
||
|
userInfo: {
|
||
|
CORPINFO_ID: '',
|
||
|
DEPARTMENT_ID: '',
|
||
|
NAME: "",
|
||
|
ROLEID: "",
|
||
|
ROLE_NAME: "",
|
||
|
USERBZ: "",
|
||
|
USERNAME: "",
|
||
|
USER_ID: "",
|
||
|
PHOTO: "",
|
||
|
},
|
||
|
},
|
||
|
getters: {
|
||
|
getUserInfo: state => state.userInfo,
|
||
|
},
|
||
|
mutations: {
|
||
|
setUserInfo(state, userInfo) {
|
||
|
state.userInfo = userInfo
|
||
|
}
|
||
|
},
|
||
|
actions: {
|
||
|
setUserInfo({commit}, userInfo) {
|
||
|
commit('setUserInfo', userInfo)
|
||
|
}
|
||
|
},
|
||
|
plugins: [
|
||
|
createPersistedState({
|
||
|
storage: {
|
||
|
getItem: (key) => uni.getStorageSync(key), // 获取
|
||
|
setItem: (key, value) => uni.setStorageSync(key, value), // 存储
|
||
|
removeItem: (key) => uni.removeStorageSync(key) // 删除
|
||
|
}
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
export default store
|