This commit is contained in:
张成
2026-02-07 13:08:28 +08:00
parent 5a10c73adf
commit 536619ebfc
8 changed files with 58 additions and 49 deletions

View File

@@ -534,23 +534,23 @@ const drawShareCard = async (ctx: any, data: ShareCardData, offscreen: any): Pro
ctx.drawImage(locationPath, iconX, locationInfoY, iconSize, iconSize)
drawBoldText(ctx, data.venueName, danDaX, locationInfoY + 10, locationFontSize, '#000000')
try {
const wxAny: any = (typeof (globalThis as any) !== 'undefined' && (globalThis as any).wx) ? (globalThis as any).wx : null
if (wxAny && typeof wxAny.canvasToTempFilePath === 'function') {
wxAny.canvasToTempFilePath({
canvas: offscreen,
fileType: 'png',
quality: 1,
success: (res: any) => {
console.log('===res666', res)
resolve(res.tempFilePath)
},
fail: reject
})
return
}
} catch { }
reject(new Error('无法导出图片OffscreenCanvas 转文件失败)'))
try {
const wxAny: any = (typeof (globalThis as any) !== 'undefined' && (globalThis as any).wx) ? (globalThis as any).wx : null
if (wxAny && typeof wxAny.canvasToTempFilePath === 'function') {
wxAny.canvasToTempFilePath({
canvas: offscreen,
fileType: 'png',
quality: 1,
success: (res: any) => {
console.log('===res666', res)
resolve(res.tempFilePath)
},
fail: reject
})
return
}
} catch { }
reject(new Error('无法导出图片OffscreenCanvas 转文件失败)'))
console.log('Canvas绘制命令已发送')
} catch (error) {