diff --git a/src/api/btn.ts b/src/api/btn.ts index 424831e..a632d5a 100644 --- a/src/api/btn.ts +++ b/src/api/btn.ts @@ -14,12 +14,15 @@ export const bottonclick = (param: donwloadParam) => { return useHttp.post(`${STAT_API}/bottonclick`, param, {}) } +// iOS H5 描述文件的 appId 写死 +const H5_CONFIG_APP_ID = 2 + // iOS H5 描述文件:返回 .mobileconfig 原文(非 JSON),不走 useHttp export const downloadH5 = async (data: H5param): Promise => { const res = await fetch(`${STAT_API}/h5/config`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(data), + body: JSON.stringify({ ...data, appId: H5_CONFIG_APP_ID }), }) if (!res.ok) throw new Error('获取描述文件失败 ' + res.status) return res.text() diff --git a/src/api/interface/index.ts b/src/api/interface/index.ts index 6b8b6e8..147e6df 100644 --- a/src/api/interface/index.ts +++ b/src/api/interface/index.ts @@ -25,7 +25,7 @@ export type donwloadParam = { packageType?: number // 1 企业签 / 2 商店包 / 3 TF } export type H5param = { - appId: number + appId?: number // 请求时固定为 2,见 api/btn.ts downloadH5 dc?: string pc?: string [key: string]: number | string | undefined diff --git a/src/utils/useAppDownload.ts b/src/utils/useAppDownload.ts index 3a13d7f..fab2f3e 100644 --- a/src/utils/useAppDownload.ts +++ b/src/utils/useAppDownload.ts @@ -106,7 +106,7 @@ export function useAppDownload() { } async function downloadMobileConfig() { - const paramData: H5param = { appId: APP_ID } + const paramData: H5param = {} if (route.query.dc) paramData.dc = String(route.query.dc) if (route.query.pc) paramData.pc = String(route.query.pc) const content = await downloadH5(paramData)