diff --git a/common/untool.js b/common/untool.js index 426d9b1..105c712 100644 --- a/common/untool.js +++ b/common/untool.js @@ -1,4 +1,5 @@ import qs from "@/common/libs/qs" +import { saveAs } from "file-saver" const tabBarUrls = [ '/pages/tabBar/deal/deal', @@ -113,7 +114,10 @@ const saveNetFile = (url) => { try{ let { tempFilePath } = await downloadFile(url) console.log("save:orgin:tempFilePath", tempFilePath) - let res = await saveFile({ tempFilePath }) + // #ifdef H5 + saveAs(tempFilePath) + // #endif + // let res = await saveFile({ tempFilePath }) // #ifdef APP-PLUS plus.io.convertLocalFileSystemURL(tempFilePath); @@ -122,7 +126,7 @@ const saveNetFile = (url) => { hideLoading() showToast('保存成功') - resolve(res) + resolve(tempFilePath) }catch(e){ hideLoading() showToast('保存失败') diff --git a/package.json b/package.json index d21e6e0..50d5387 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "author": "", "license": "MIT", "dependencies": { - "dayjs": "^1.11.10" + "dayjs": "^1.11.10", + "file-saver": "2.0.5" }, "dcloudext": { "category": [