fix: 兼容旧前端可改配置文件

This commit is contained in:
TsMask
2023-11-06 10:46:08 +08:00
parent 0b58c00566
commit de16c3d1f5
4 changed files with 42 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ import defaultLOGOBrand from '@/assets/logo_brand.png';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { validHttp } from '@/utils/regular-utils';
import { defineStore } from 'pinia';
import { sessionGet } from '@/utils/cache-session-utils';
/**应用参数类型 */
type AppStore = {
@@ -52,8 +53,11 @@ const useAppStore = defineStore('app', {
if (validHttp(path)) {
return path;
}
const baseApi = import.meta.env.VITE_API_BASE_URL;
return `${baseApi}${path}`;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
return `${baseUrl}${path}`;
},
/**
* 获取正确LOGO地址-brand
@@ -68,8 +72,11 @@ const useAppStore = defineStore('app', {
if (validHttp(path)) {
return path;
}
const baseApi = import.meta.env.VITE_API_BASE_URL;
return `${baseApi}${path}`;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
return `${baseUrl}${path}`;
},
/**
* 获取正确登录背景地址
@@ -84,8 +91,11 @@ const useAppStore = defineStore('app', {
if (validHttp(path)) {
return path;
}
const baseApi = import.meta.env.VITE_API_BASE_URL;
return `${baseApi}${path}`;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
return `${baseUrl}${path}`;
},
},
actions: {