saveCode(){
uni.showModal({
title: '提示',
content: '是否保存到相册',
confirmText: '确定',
success: res => {
if (res.confirm) {
let base64 = this.codePath.replace(/^data:image\/\w+;base64,/, "");
let filepath = wx.env.USER_DATA_PATH + '/test.png';
console.log(filepath,'123123');
let FileSystemManager = uni.getFileSystemManager();
FileSystemManager.writeFile({
filePath: filepath,
data: base64,
encoding: 'base64',
success: res2 => {
console.log(res2,111111);
uni.saveImageToPhotosAlbum({
filePath: filepath,
success: res3 => {
uni.showModal({
title: '提示',
content: '保存成功',
confirmText: '确定',
showCancel: false
})
},
fail: err => {
uni.showModal({
title: '提示',
content: '保存失败',
confirmText: '确定',
showCancel: false
})
}
})
},
fail: err => {
uni.showModal({
title: '提示',
content: '保存失败',
confirmText: '确定',
showCancel: false
})
}
})
}
}
})
}
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
已经获取相册写权限。但是报错:saveImageToPhotosAlbum:fail permission denied, open ../../pages/images/decorate.jpg
看起来似乎是读取下载文件时获取文件的权限缺失。