321
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
zpc 2026-04-13 18:37:57 +08:00
parent c54f049409
commit 4c261ce928

View File

@ -277,22 +277,52 @@ function handleSaveQrcode() {
uni.showToast({ title: '二维码未加载', icon: 'none' })
return
}
uni.saveImageToPhotosAlbum({
filePath: qrcodeUrl.value,
success: () => { uni.showToast({ title: '保存成功', icon: 'success' }) },
fail: (err) => {
if (err.errMsg.includes('auth deny')) {
uni.showModal({
title: '提示',
content: '需要您授权保存图片到相册',
confirmText: '去设置',
success: (res) => { if (res.confirm) uni.openSetting() }
})
} else {
uni.showToast({ title: '保存失败', icon: 'none' })
/**
* 保存图片到相册
* 需要先将网络图片下载到本地临时路径再调用保存接口
*/
function saveToAlbum(tempFilePath) {
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success: () => { uni.showToast({ title: '保存成功', icon: 'success' }) },
fail: (err) => {
if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize')) {
uni.showModal({
title: '提示',
content: '需要您授权保存图片到相册',
confirmText: '去设置',
success: (res) => { if (res.confirm) uni.openSetting() }
})
} else {
uni.showToast({ title: '保存失败', icon: 'none' })
}
}
}
})
})
}
//
if (qrcodeUrl.value.startsWith('http')) {
uni.showLoading({ title: '保存中...' })
uni.downloadFile({
url: qrcodeUrl.value,
success: (res) => {
uni.hideLoading()
if (res.statusCode === 200) {
saveToAlbum(res.tempFilePath)
} else {
uni.showToast({ title: '下载图片失败', icon: 'none' })
}
},
fail: () => {
uni.hideLoading()
uni.showToast({ title: '下载图片失败', icon: 'none' })
}
})
} else {
//
saveToAlbum(qrcodeUrl.value)
}
}
function handleShowWithdraw() {