feat: 系统设置国际化切换
This commit is contained in:
@@ -2,7 +2,7 @@ import { getSysConf } from '@/api';
|
||||
import { CACHE_LOCAL_I18N } from '@/constants/cache-keys-constants';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { parseUrlPath } from '@/plugins/file-static-url';
|
||||
import { localGet } from '@/utils/cache-local-utils';
|
||||
import { localGet, localSet } from '@/utils/cache-local-utils';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
/**应用参数类型 */
|
||||
@@ -95,6 +95,11 @@ const useAppStore = defineStore('app', {
|
||||
this.officialUrl = res.data.officialUrl;
|
||||
this.i18nOpen = res.data.i18nOpen === 'true';
|
||||
this.i18nDefault = res.data.i18nDefault;
|
||||
// 切换禁用时,设置默认语言
|
||||
const localI18n = localGet(CACHE_LOCAL_I18N);
|
||||
if (localI18n == null || (!this.i18nOpen && this.i18nDefault)) {
|
||||
localSet(CACHE_LOCAL_I18N, this.i18nDefault);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user