准备重构nginx的配置,先回退api-config配置,添加PM2的多端口服务的启动脚步

This commit is contained in:
2025-07-25 15:06:47 +08:00
parent ccd5cdf71e
commit d465260daf
11 changed files with 238 additions and 309 deletions
+5 -5
View File
@@ -21,7 +21,7 @@ export type QueryParams = Record<string, string | number | boolean | undefined>;
// const API_BASE_URL = 'http://172.16.0.119:9000/admin';
// 调试:打印当前API_BASE_URL的值
console.log('🔍 axios-client.ts - API_BASE_URL.value:', API_BASE_URL.value);
console.log('🔍 axios-client.ts - API_BASE_URL:', API_BASE_URL);
// 文档URL前缀 (从配置文件导入)
// export const DOCUMENT_URL = 'http://nas.7bm.co:9000/docauditai/';
@@ -35,7 +35,7 @@ const DEFAULT_TIMEOUT = 30000; // 增加到30秒
// 创建 axios 实例
const axiosInstance = axios.create({
baseURL: API_BASE_URL.value === '/api' ? '' : API_BASE_URL.value, // 如果是相对路径,则不设置baseURL
baseURL: API_BASE_URL,
timeout: DEFAULT_TIMEOUT, // 增加超时时间
headers: {
'Content-Type': 'application/json',
@@ -101,13 +101,13 @@ function buildUrl(endpoint: string, params?: QueryParams): string {
fullUrl = endpoint;
} else {
// 处理相对路径的情况
if (API_BASE_URL.value === '/api') {
if (API_BASE_URL === '/api') {
// 如果是相对路径,直接使用endpoint
const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
fullUrl = path;
} else {
// 确保API_BASE_URL格式正确
const baseUrl = API_BASE_URL.value.endsWith('/') ? API_BASE_URL.value.slice(0, -1) : API_BASE_URL.value;
const baseUrl = API_BASE_URL.endsWith('/') ? API_BASE_URL.slice(0, -1) : API_BASE_URL;
const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
fullUrl = `${baseUrl}${path}`;
}
@@ -200,7 +200,7 @@ export async function apiRequest<T>(
return getMockResponse<T>(endpoint);
}
console.log('api-base-url-----------',API_BASE_URL.value)
console.log('api-base-url-----------',API_BASE_URL)
try {
// 构建 URL