fix(partner): resolve WeChat image picker auth denied on store create

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-03 15:32:53 +08:00
parent 30eb8ff8a6
commit 81413e4d08
6 changed files with 49 additions and 8 deletions
+6 -1
View File
@@ -51,12 +51,17 @@ export async function chooseWechatImages(
const sourceType = options.sourceType ?? ['album', 'camera'];
if (platform === 'wechat-h5') {
const pageUrl = typeof window !== 'undefined' ? window.location.href.split('#')[0] : '';
await ensureJssdkReady({
apiBase: config.apiBase ?? '/api/v1',
clientApp: config.clientApp,
getAccessToken: config.getAccessToken,
url: pageUrl,
jsApiList: ['chooseImage', 'getLocalImgData'],
});
if (!window.wx?.chooseImage) return null;
if (!window.wx?.chooseImage) {
throw new Error('微信选图接口不可用,请刷新页面后重试');
}
const localIds = await new Promise<string[]>((resolve, reject) => {
window.wx!.chooseImage!({