feat(utils): 优化请求函数URL拼接逻辑

- 在request函数中将请求拦截改为先拼接完整URL
- 支持相对路径自动补全baseUrl
- 删除原有请求拦截中url未处理的问题
This commit is contained in:
2026-07-01 12:53:38 +08:00
parent 38c8026d4f
commit ac18c33c36

View File

@@ -108,10 +108,15 @@ export interface InviteRecordParam {
/** /**
* 生成小程序码 * 生成小程序码
*
* 注意envVersion 参数会作为查询参数传给后端,
* 后端调用 wxacode.getUnlimited 时需使用该值。
*/ */
export async function generateMiniProgramCode(data: MiniProgramCodeParam) { export async function generateMiniProgramCode(data: MiniProgramCodeParam) {
try { try {
const url = '/wx-login/getOrderQRCodeUnlimited/' + data.scene; // 默认使用体验版(开发/测试阶段),提审上线前改为 'release'
const envVersion = data.envVersion || 'trial'
const url = `/wx-login/getOrderQRCodeUnlimited/${data.scene}?envVersion=${envVersion}`;
// 由于接口直接返回图片buffer我们直接构建完整的URL // 由于接口直接返回图片buffer我们直接构建完整的URL
return `${BaseUrl}${url}`; return `${BaseUrl}${url}`;
} catch (error: any) { } catch (error: any) {