1
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user