let base64 = this.poster.replace(/^data:image\/\w+;base64,/, "");; //图片替换
let filePath = `${wx.env.USER_DATA_PATH}/${this.config.name}.png`;
uni.getFileSystemManager().writeFile({
filePath: filePath, //创建一个临时文件名
data: base64, //写入的文本或二进制数据
encoding: 'base64', //写入当前文件的字符编码
success: (res) => {
uni.saveImageToPhotosAlbum({
filePath: filePath,
success: () => {
uni.showToast({
title: '保存成功',
icon: "none",
duration: 5000
})
},
fail: (err) => {
console.log(err);
uni.showToast({
title: '保存失败',
icon: "none",
duration: 5000
})
}
})
},
fail: (err) => {
console.log(err)
}
})

1***@qq.com
- 发布:2025-03-03 03:09
- 更新:2025-03-03 03:09
- 阅读:115

