This commit is contained in:
aihe 2024-05-27 18:36:37 +08:00
parent 33584ce731
commit af1a22e4ee
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import qs from "@/common/libs/qs" import qs from "@/common/libs/qs"
import { saveAs } from "file-saver"
const tabBarUrls = [ const tabBarUrls = [
'/pages/tabBar/deal/deal', '/pages/tabBar/deal/deal',
@ -113,7 +114,10 @@ const saveNetFile = (url) => {
try{ try{
let { tempFilePath } = await downloadFile(url) let { tempFilePath } = await downloadFile(url)
console.log("save:orgin:tempFilePath", tempFilePath) console.log("save:orgin:tempFilePath", tempFilePath)
let res = await saveFile({ tempFilePath }) // #ifdef H5
saveAs(tempFilePath)
// #endif
// let res = await saveFile({ tempFilePath })
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.io.convertLocalFileSystemURL(tempFilePath); plus.io.convertLocalFileSystemURL(tempFilePath);
@ -122,7 +126,7 @@ const saveNetFile = (url) => {
hideLoading() hideLoading()
showToast('保存成功') showToast('保存成功')
resolve(res) resolve(tempFilePath)
}catch(e){ }catch(e){
hideLoading() hideLoading()
showToast('保存失败') showToast('保存失败')

View File

@ -14,7 +14,8 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"dayjs": "^1.11.10" "dayjs": "^1.11.10",
"file-saver": "2.0.5"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [