function message (data){
completeImageData.value = data.save_image_chunk;
console.log(completeImageData.value.length)
finishImage.value = true
const fs = uni.getFileSystemManager();
const filePath = `${plus.io.convertLocalFileSystemURL('file://')}/image.png`;
console.log(filePath)
fs.writeFile({
filePath: filePath,
data: data.save_image_chunk.replace(/^data:image\/\w+;base64,/, ""), // 移除前缀
encoding: 'base64',
success: (res) => {
console.log('图片保存成功:', res);
uni.showToast({
title: '图片保存成功',
icon: 'success'
});
},
fail: (err) => {
console.error('保存图片失败:', err);
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});}
0 个回复