This commit is contained in:
张成
2025-12-22 16:26:59 +08:00
parent aa2d03ee30
commit e17d5610f5
54 changed files with 11735 additions and 3 deletions

View File

@@ -0,0 +1,72 @@
/**
* 应用配置状态管理
* 统一管理所有配置,不再使用 localStorage
*/
export default {
namespaced: true,
state: {
// 用户相关配置
email: '',
userLoggedOut: false,
rememberMe: false,
// 应用设置
appSettings: {
autoStart: false,
startOnBoot: false,
enableNotifications: true,
soundAlert: true
},
// 设备ID客户端生成需要持久化
deviceId: null
},
mutations: {
SET_EMAIL(state, email) {
state.email = email;
},
SET_USER_LOGGED_OUT(state, value) {
state.userLoggedOut = value;
},
SET_REMEMBER_ME(state, value) {
state.rememberMe = value;
},
SET_APP_SETTINGS(state, settings) {
state.appSettings = { ...state.appSettings, ...settings };
},
UPDATE_APP_SETTING(state, { key, value }) {
state.appSettings[key] = value;
},
SET_DEVICE_ID(state, deviceId) {
state.deviceId = deviceId;
}
},
actions: {
setEmail({ commit }, email) {
commit('SET_EMAIL', email);
},
setUserLoggedOut({ commit }, value) {
commit('SET_USER_LOGGED_OUT', value);
},
setRememberMe({ commit }, value) {
commit('SET_REMEMBER_ME', value);
},
updateAppSettings({ commit }, settings) {
commit('SET_APP_SETTINGS', settings);
},
updateAppSetting({ commit }, { key, value }) {
commit('UPDATE_APP_SETTING', { key, value });
},
setDeviceId({ commit }, deviceId) {
commit('SET_DEVICE_ID', deviceId);
}
},
getters: {
email: state => state.email,
userLoggedOut: state => state.userLoggedOut,
rememberMe: state => state.rememberMe,
appSettings: state => state.appSettings,
deviceId: state => state.deviceId
}
};