图片上传

parent 34c97c57
......@@ -145,44 +145,44 @@ const convertSize = (sizeInKB) => {
// 下载图片
const handleDownload = () => {
uni.downloadFile({
url: previewImages.value[index.value],
success: (res) => {
if (res.statusCode === 200) {
// 保存图片到相册
plus.gallery.save(res.tempFilePath, () => {
uni.showToast({
title: '图片保存成功',
icon: 'success'
});
}, (err) => {
console.error('保存图片失败', err);
uni.showToast({
title: '图片保存失败',
icon: 'none'
});
});
} else {
console.error('图片下载失败');
}
}, fail: (err) => {
console.error('图片下载失败', err);
}
});
// xma.downloadFile({
// url: previewImages.value[index.value], // 替换为你要下载的图片URL
// success: (res) => {
// if (res.statusCode === 200) {
// // 下载成功后保存图片到相册
// saveImage(res.tempFilePath);
// } else {
// console.error('下载图片失败');
// }
// },
// fail: (err) => {
// console.error('下载图片失败', err);
// }
// uni.downloadFile({
// url: previewImages.value[index.value],
// success: (res) => {
// if (res.statusCode === 200) {
// // 保存图片到相册
// plus.gallery.save(res.tempFilePath, () => {
// uni.showToast({
// title: '图片保存成功',
// icon: 'success'
// });
// }, (err) => {
// console.error('保存图片失败', err);
// uni.showToast({
// title: '图片保存失败',
// icon: 'none'
// });
// });
// } else {
// console.error('图片下载失败');
// }
// }, fail: (err) => {
// console.error('图片下载失败', err);
// }
// });
xma.downloadFile({
url: previewImages.value[index.value], // 替换为你要下载的图片URL
success: (res) => {
if (res.statusCode === 200) {
// 下载成功后保存图片到相册
saveImage(res.tempFilePath);
} else {
console.error('下载图片失败');
}
},
fail: (err) => {
console.error('下载图片失败', err);
}
});
}
// function saveImage(filePath) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment