2024-08-08 11:08:55 +08:00
|
|
|
import Vue from "vue";
|
|
|
|
import Vuex from "vuex";
|
|
|
|
import createPersistedState from "vuex-persistedstate";
|
2023-11-07 10:24:08 +08:00
|
|
|
|
2024-08-08 11:08:55 +08:00
|
|
|
Vue.use(Vuex);
|
2023-11-07 10:24:08 +08:00
|
|
|
const store = new Vuex.Store({
|
2024-08-08 11:08:55 +08:00
|
|
|
state: {
|
|
|
|
userInfo: {
|
|
|
|
CORPINFO_ID: "",
|
|
|
|
DEPARTMENT_ID: "",
|
|
|
|
NAME: "",
|
|
|
|
ROLEID: "",
|
|
|
|
ROLE_NAME: "",
|
|
|
|
USERBZ: "",
|
|
|
|
USERNAME: "",
|
|
|
|
USER_ID: "",
|
2023-11-07 10:24:08 +08:00
|
|
|
PHOTO: "",
|
2024-08-08 11:08:55 +08:00
|
|
|
},
|
|
|
|
filePath: "",
|
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
getUserInfo: (state) => state.userInfo,
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
setUserInfo(state, userInfo) {
|
|
|
|
state.userInfo = userInfo;
|
|
|
|
},
|
|
|
|
setFilePath(state, filePath) {
|
|
|
|
state.filePath = filePath;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
setUserInfo({ commit }, userInfo) {
|
|
|
|
commit("setUserInfo", userInfo);
|
|
|
|
},
|
|
|
|
setFilePath({ commit }, filePath) {
|
|
|
|
commit("setFilePath", filePath);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
createPersistedState({
|
|
|
|
storage: {
|
|
|
|
getItem: (key) => uni.getStorageSync(key), // 获取
|
|
|
|
setItem: (key, value) => uni.setStorageSync(key, value), // 存储
|
|
|
|
removeItem: (key) => uni.removeStorageSync(key), // 删除
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
});
|
|
|
|
export default store;
|