修改UI问题初

This commit is contained in:
2026-08-31 17:37:32 +08:00
parent 585b30a615
commit 18ee29e422
16 changed files with 386 additions and 1070 deletions
+11 -21
View File
@@ -11,37 +11,27 @@
*/
// 基础路径:修改此处即可切换后端地址
// #ifdef H5
// H5 端走 devServer 代理(manifest.json h5.devServer.proxy),规避浏览器 CORS 限制
const BASE_URL = '/';
// #endif
// #ifndef H5
// 小程序端直连后端 v2 环境
const BASE_URL = 'https://official.inkreach.cc/v2-api/';
// #endif
export { BASE_URL };
// 所有端统一直连后端
const DOMAIN = 'https://official.inkreach.cc';
// 接口走 v2 环境
const BASE_URL = DOMAIN + '/v2-api/';
// 静态资源直挂域名根目录(如 /assets/miniprogram/...),不拼接 v2-api
const ASSET_BASE = DOMAIN + '/';
export { BASE_URL, ASSET_BASE };
// 默认配置
const TIMEOUT = 30000;
const DEFAULT_HEADER = { 'Content-Type': 'application/json' };
// 统一拼装 URL:完整地址直接返回,否则 BASE_URL + path
// 图片/静态资源路径也可直接调用,得到完整可访问地址
// /assets/ 开头的静态资源路径用域名根目录拼接(不拼 v2-api)
export function buildUrl(url) {
if (!url) return '';
if (/^https?:\/\//i.test(url)) return url;
const base = BASE_URL.replace(/\/+$/, '');
const path = url.replace(/^\/+/, '');
let full = path ? `${base}/${path}` : base;
// #ifdef H5
// uni-app H5 的 image 组件会将以 / 开头的路径重写为 routerBase + path
// (如 /assets/x.png → /h5/assets/x.png),导致 devServer 代理匹配不到而 404。
// 这里拼成完整绝对地址(https://host/assets/x.png),image 组件对 http(s):// 开头的路径原样放行
if (typeof window !== 'undefined' && full.charAt(0) === '/') {
full = window.location.origin + full;
}
// #endif
return full;
if (path.startsWith('assets/')) return ASSET_BASE + path;
const base = BASE_URL.replace(/\/+$/, '');
return path ? `${base}/${path}` : base;
}
// 统一取 header(注入 token