本地主机消除502

This commit is contained in:
2025-09-21 14:25:01 +08:00
parent b7d9f16198
commit e5eb8d6174
38 changed files with 56 additions and 73 deletions

View File

@@ -41,7 +41,7 @@ if (uni.restoreGlobal) {
var define_process_env_default = {};
const envBaseUrl = typeof process !== "undefined" && define_process_env_default && (define_process_env_default.VITE_APP_API_BASE_URL || define_process_env_default.API_BASE_URL) || "";
const storageBaseUrl = typeof uni !== "undefined" ? uni.getStorageSync("API_BASE_URL") || "" : "";
const fallbackBaseUrl = "http://192.168.31.193:8080";
const fallbackBaseUrl = "http://127.0.0.1:8080";
const API_BASE_URL = (envBaseUrl || storageBaseUrl || fallbackBaseUrl).replace(/\/$/, "");
const candidateBases = [envBaseUrl, storageBaseUrl, fallbackBaseUrl, "http://127.0.0.1:8080", "http://localhost:8080"];
const API_BASE_URL_CANDIDATES = Array.from(new Set(candidateBases.filter(Boolean))).map((u) => String(u).replace(/\/$/, ""));