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"
})
}
}
})
}
}
})
}
})
}
})
}
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » uniapp 微信小程序将图片下载到手机
发表评论 取消回复