diff --git a/pages/API/download-file/download-file.uvue b/pages/API/download-file/download-file.uvue index 1fad4fe3be3167a79624d014df62de9dc2eb36cf..48d1d9f947640afa32abf9ae0973f39e4f4752b1 100644 --- a/pages/API/download-file/download-file.uvue +++ b/pages/API/download-file/download-file.uvue @@ -55,11 +55,13 @@ success: (res) => { console.log('downloadFile success, res is', res.tempFilePath) self.imageSrc = res.tempFilePath; - uni.hideLoading(); }, fail: (err) => { console.log('downloadFile fail, err is:', err) - uni.hideLoading(); + }, + complete: (res) => { + uni.hideLoading(); + this.task = null; } }); this.task?.onProgressUpdate((update) => { diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index ed74e5b10096a7ec6be05b48e1786dc57877c6a1..35d8c378bd103cad4a9e9638e3fd2e0734efc4d9 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -218,7 +218,8 @@ }); }, complete: () => { - uni.hideLoading() + uni.hideLoading() + this.task = null }, }); }, diff --git a/pages/API/upload-file/upload-file.uvue b/pages/API/upload-file/upload-file.uvue index fab01a8a5ca9275c8506e28234086522d73d628f..9368ff95605552dd9feefaf0c5fc5dfc131885d6 100644 --- a/pages/API/upload-file/upload-file.uvue +++ b/pages/API/upload-file/upload-file.uvue @@ -61,7 +61,6 @@ }, success: (res) => { console.log('uploadImage success, res is:', res) - uni.hideLoading(); uni.showToast({ title: '上传成功', icon: 'success', @@ -71,12 +70,15 @@ }, fail: (err) => { console.log('uploadImage fail', err); - uni.hideLoading(); uni.showModal({ content: err.errMsg, showCancel: false }); - }, + }, + complete: (res) => { + uni.hideLoading(); + this.task = null + } }); }, fail: (err) => { @@ -87,7 +89,7 @@ //自动化测试例专用 jest_uploadFile() { const imageSrc = "/static/uni.png"; - this.task = uni.uploadFile({ + uni.uploadFile({ url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址 filePath: imageSrc, name: 'file', @@ -160,7 +162,7 @@ }, jest_cookie_upload(needCookie : boolean) { const imageSrc = "/static/uni.png"; - this.task = uni.uploadFile({ + uni.uploadFile({ url: 'https://request.dcloud.net.cn/api/http/header/upload', filePath: imageSrc, name: 'file', @@ -180,7 +182,7 @@ }, jest_files_upload() { const imageSrc = "/static/uni.png"; - this.task = uni.uploadFile({ + uni.uploadFile({ url: 'https://unidemo.dcloud.net.cn/upload', files: [ {