diff --git a/src/utils/download.ts b/src/utils/download.ts index 3edeb11..d90a88e 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -3,9 +3,6 @@ */ import { isH5, isMpWeixin } from '@uni-helper/uni-env' -import { useToast } from 'wot-design-uni' - -const toast = useToast() /** 保存图片到相册 */ export async function saveImageToAlbum(url: string, fileName?: string): Promise { @@ -23,16 +20,12 @@ export async function saveImageToAlbum(url: string, fileName?: string): Promise< if (downloadResult.statusCode === 200) { saveToAlbum(downloadResult.tempFilePath, resolve, reject) } else { - // 注释 by 芋艿:使用 wd-toast 替代 - // uni.showToast({ icon: 'none', title: '下载失败' }) - toast.show('下载失败') + uni.showToast({ icon: 'none', title: '下载失败' }) reject(new Error('Download failed')) } }, fail: (err) => { - // 注释 by 芋艿:使用 wd-toast 替代 - // uni.showToast({ icon: 'none', title: '下载失败' }) - toast.show('下载失败') + uni.showToast({ icon: 'none', title: '下载失败' }) reject(err) }, }) @@ -52,11 +45,10 @@ function saveToAlbum( uni.saveImageToPhotosAlbum({ filePath, success: () => { - // uni.showToast({ - // icon: 'success', - // title: '已保存到相册', - // }) - toast.success('已保存到相册') + uni.showToast({ + icon: 'success', + title: '已保存到相册', + }) resolve() }, fail: (err) => { @@ -83,11 +75,10 @@ function saveToAlbum( }, }) } else { - // uni.showToast({ - // icon: 'none', - // title: '保存失败', - // }) - toast.show('保存失败') + uni.showToast({ + icon: 'none', + title: '保存失败', + }) reject(err) } },