const downImage = (imgUrl) => {
uni.getImageInfo({
src: imgUrl,
success: res => {
uni.saveImageToPhotosAlbum({
filePath: res.path,
success: res => {
console.log(res)
},
fail: err => {
if (openSetting.value == "openSetting:ok") {
return
}
uni.showModal({
title: "提示",
content: "需要授权保存到相册",
success: res => {
if (res.confirm) {
uni.openSetting({
success: res => {
console.log(999, res
.errMsg)
if (res.authSetting[
'scope.writePhotosAlbum'
]) {
uni.showModal({
title: "获取授权成功",
icon: "none"
})
openSetting.value =
"openSetting:ok"
} else {
uni.showModal({
title: "获取权限失败",
icon: "none"
})
}
}
})
}
}
})
}
})
}
})
}