|
@ -176,6 +176,9 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 获取图片信息并保存到相册 |
|
|
// 获取图片信息并保存到相册 |
|
|
imgApi(image) { |
|
|
imgApi(image) { |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '保存中...' |
|
|
|
|
|
}) |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
|
// 先下载图片到本地临时路径 |
|
|
// 先下载图片到本地临时路径 |
|
@ -188,9 +191,11 @@ export default { |
|
|
wx.saveImageToPhotosAlbum({ |
|
|
wx.saveImageToPhotosAlbum({ |
|
|
filePath: tempFilePath, |
|
|
filePath: tempFilePath, |
|
|
success: () => { |
|
|
success: () => { |
|
|
|
|
|
uni.hideLoading() |
|
|
wx.showToast({ title: '保存成功', icon: 'success' }); |
|
|
wx.showToast({ title: '保存成功', icon: 'success' }); |
|
|
}, |
|
|
}, |
|
|
fail: (err) => { |
|
|
fail: (err) => { |
|
|
|
|
|
uni.hideLoading() |
|
|
console.error('保存失败:', err); |
|
|
console.error('保存失败:', err); |
|
|
wx.showToast({ title: '保存失败', icon: 'none' }); |
|
|
wx.showToast({ title: '保存失败', icon: 'none' }); |
|
|
} |
|
|
} |
|
@ -198,6 +203,7 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: (err) => { |
|
|
fail: (err) => { |
|
|
|
|
|
uni.hideLoading() |
|
|
console.error('下载失败:', err); |
|
|
console.error('下载失败:', err); |
|
|
wx.showToast({ title: '图片下载失败', icon: 'none' }); |
|
|
wx.showToast({ title: '图片下载失败', icon: 'none' }); |
|
|
} |
|
|
} |
|
|