feat: 系统配置返回服务版本适用版本适配

This commit is contained in:
TsMask
2025-03-19 18:00:35 +08:00
parent 0fd9ef7e48
commit c084203a03

View File

@@ -1,5 +1,8 @@
import { getSysConf } from '@/api'; import { getSysConf } from '@/api';
import { CACHE_LOCAL_I18N, CACHE_SESSION_CRYPTO_API } from '@/constants/cache-keys-constants'; import {
CACHE_LOCAL_I18N,
CACHE_SESSION_CRYPTO_API,
} from '@/constants/cache-keys-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { removeToken } from '@/plugins/auth-token'; import { removeToken } from '@/plugins/auth-token';
import { parseUrlPath } from '@/plugins/file-static-url'; import { parseUrlPath } from '@/plugins/file-static-url';
@@ -16,11 +19,12 @@ type AppStore = {
/**应用版本 */ /**应用版本 */
appVersion: string; appVersion: string;
/**服务版本 */ /**版本 */
version: string; version: string;
buildTime: string;
/**系统引导使用 */ /**系统引导使用 */
bootloader: boolean; bootloader: boolean;
/**服务版本 */
serverVersion: string;
// 用户登录认证 // 用户登录认证
loginAuth: boolean; loginAuth: boolean;
// 用户接口加密 // 用户接口加密
@@ -54,13 +58,13 @@ const useAppStore = defineStore('app', {
appCode: import.meta.env.VITE_APP_CODE, appCode: import.meta.env.VITE_APP_CODE,
appVersion: import.meta.env.VITE_APP_VERSION, appVersion: import.meta.env.VITE_APP_VERSION,
version: `-`, version: '-',
buildTime: `-`,
bootloader: false, bootloader: false,
serverVersion: '-',
loginAuth: true, loginAuth: true,
cryptoApi: true, cryptoApi: true,
serialNum: `-`, serialNum: '-',
copyright: `Copyright ©2023 For ${import.meta.env.VITE_APP_NAME}`, copyright: `Copyright ©2023-2025 For ${import.meta.env.VITE_APP_NAME}`,
logoType: 'icon', logoType: 'icon',
filePathIcon: '', filePathIcon: '',
filePathBrand: '', filePathBrand: '',
@@ -86,7 +90,7 @@ const useAppStore = defineStore('app', {
const res = await getSysConf(); const res = await getSysConf();
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
this.version = res.data.version; this.version = res.data.version;
this.buildTime = res.data.buildTime; this.serverVersion = res.data.serverVersion;
this.bootloader = res.data.bootloader === 'true'; this.bootloader = res.data.bootloader === 'true';
// 引导时 // 引导时
if (this.bootloader) { if (this.bootloader) {
@@ -94,7 +98,7 @@ const useAppStore = defineStore('app', {
} }
this.loginAuth = res.data.loginAuth !== 'false'; this.loginAuth = res.data.loginAuth !== 'false';
this.cryptoApi = res.data.cryptoApi !== 'false'; this.cryptoApi = res.data.cryptoApi !== 'false';
sessionSet(CACHE_SESSION_CRYPTO_API, res.data.cryptoApi); sessionSet(CACHE_SESSION_CRYPTO_API, res.data.cryptoApi);
this.serialNum = res.data.serialNum; this.serialNum = res.data.serialNum;
this.appName = res.data.title; this.appName = res.data.title;
this.copyright = res.data.copyright; this.copyright = res.data.copyright;