n20-common-lib 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -751,43 +751,6 @@ export default {
|
|
|
751
751
|
this.visiblePvT = setTimeout(() => {
|
|
752
752
|
this.visiblePv = false
|
|
753
753
|
}, 300)
|
|
754
|
-
},
|
|
755
|
-
/**
|
|
756
|
-
* 兜底上传请求实现(兼容外部不传 uploadHttpRequest)。
|
|
757
|
-
* @param {Object} opt 上传参数。
|
|
758
|
-
* @returns {Promise<any>} 上传结果。
|
|
759
|
-
*/
|
|
760
|
-
uploadHttpRequestBath(opt) {
|
|
761
|
-
if (this.uploadHttpRequest) {
|
|
762
|
-
return this.uploadHttpRequest(opt)
|
|
763
|
-
}
|
|
764
|
-
let FD = new FormData()
|
|
765
|
-
FD.append(opt.filename, opt.file)
|
|
766
|
-
|
|
767
|
-
let data = opt.data
|
|
768
|
-
if (data) {
|
|
769
|
-
for (let k in data) {
|
|
770
|
-
FD.append(k, data[k])
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
let abort
|
|
775
|
-
let Pro = axios.post(opt.action + '?r=' + Math.random(), FD, {
|
|
776
|
-
headers: Object.assign(auth.setHeaders(this.headers), { 'Content-Type': 'multipart/form-data' }),
|
|
777
|
-
loading: false,
|
|
778
|
-
timeout: 900000,
|
|
779
|
-
onUploadProgress: (arg) => {
|
|
780
|
-
if (opt.onProgress) {
|
|
781
|
-
arg.percent = arg.progress * 100
|
|
782
|
-
opt.onProgress(arg)
|
|
783
|
-
}
|
|
784
|
-
},
|
|
785
|
-
cancelToken: new _axios.CancelToken((cancel) => {
|
|
786
|
-
abort = cancel
|
|
787
|
-
})
|
|
788
|
-
})
|
|
789
|
-
Pro.abort = abort
|
|
790
|
-
return Pro
|
|
791
754
|
}
|
|
792
755
|
}
|
|
793
756
|
}
|