From 0958a1d146184e29afae59dc3adba103b21ff43a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 17 Dec 2025 22:45:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Adownload=20=E4=BD=BF=E7=94=A8=20wot?= =?UTF-8?q?-toast=20=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/download.ts | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) 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) } },