fix(portal): 修复微官网在浏览器打开时的跨域与网络解析报错,支持默认名片平滑降级

这个提交包含在:
wikiboss
2026-09-21 10:17:47 +08:00
父节点 636bc99b41
当前提交 d909b08f4b
共有 7 个文件被更改,包括 112 次插入 和 7 次删除

查看文件

@@ -5,9 +5,13 @@
import { ApiResponse } from './types.uts';
let currentBaseUrl: string = 'http://127.0.0.1:9000/api';
let currentBaseUrl: string = 'http://127.0.0.1:9000';
// #ifdef H5
currentBaseUrl = '/api';
if (typeof window !== 'undefined' && window.location != null) {
const protocol = window.location.protocol != null && window.location.protocol !== '' ? window.location.protocol : 'http:';
const hostname = window.location.hostname != null && window.location.hostname !== '' ? window.location.hostname : '127.0.0.1';
currentBaseUrl = `${protocol}//${hostname}:9000`;
}
// #endif
let currentTimeout: number = 10000;