更新文件上传时请求参数

This commit is contained in:
2024-10-08 10:42:09 +08:00
parent 1a76727331
commit ff809d87d7

View File

@@ -206,13 +206,16 @@ function upload(uri, data, file, showLoading = true, extParams = {}) {
url: baseUrl + uri,
formData: data,
name: "file",
filePath: file.path,
filePath: file.path||file.url,
header: getHeader()
}, extParams)
).then((httpData) => {
// uni.upload 返回bodyData 的是 string类型。 需要解析。
httpData.data = JSON.parse(httpData.data)
return Promise.resolve(httpData)
}).catch(err=>{
uni.hideLoading()
infoBox.showErrorToast(`上传失败`)
})
})
}