@zyzgroup/core-web 0.0.87 → 0.0.89
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.
- package/dist/zyzgroup_core_web.iife.js +1 -1
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +4 -8
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +1 -1
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/types/file.d.ts +1 -1
- package/types/file.d.ts.map +1 -1
|
@@ -2967,6 +2967,8 @@ class Rc {
|
|
|
2967
2967
|
uploadURL;
|
|
2968
2968
|
// 要上传的文件
|
|
2969
2969
|
file;
|
|
2970
|
+
// 本地文件 MD5 hash
|
|
2971
|
+
fileHash;
|
|
2970
2972
|
// 文件切割块大小
|
|
2971
2973
|
chunkSize;
|
|
2972
2974
|
// 文件总切割数量
|
|
@@ -2982,18 +2984,12 @@ class Rc {
|
|
|
2982
2984
|
onTime;
|
|
2983
2985
|
onProgress;
|
|
2984
2986
|
onComplete;
|
|
2985
|
-
// 本地文件 MD5 hash
|
|
2986
|
-
fileHash;
|
|
2987
2987
|
constructor(t) {
|
|
2988
2988
|
this.axios = new ih({
|
|
2989
2989
|
baseURL: t.baseURL,
|
|
2990
2990
|
interceptor: {
|
|
2991
2991
|
request: (e) => e,
|
|
2992
|
-
|
|
2993
|
-
},
|
|
2994
|
-
response: (e) => (e.config.url == this.uploadURL && (this.onProgress?.(this.currentChunk++, this.chunks), this.end == this.file.size ? (this.isUploading = !1, this.stopTimeCount(), this.onComplete?.()) : this.isUploading && this.uploadChunk()), e),
|
|
2995
|
-
responseError: (e) => {
|
|
2996
|
-
}
|
|
2992
|
+
response: (e) => (e.config.url == this.uploadURL && e.status == 200 && (this.onProgress?.(this.currentChunk++, this.chunks), this.end == this.file.size ? (this.isUploading = !1, this.stopTimeCount(), this.onComplete?.()) : this.isUploading && this.uploadChunk()), e)
|
|
2997
2993
|
}
|
|
2998
2994
|
}), this.checkURL = t.checkURL, this.uploadURL = t.uploadURL, this.file = t.file, this.chunkSize = t.chunkSize || 1 * 1024 * 1024, this.chunks = Math.ceil(this.file.size / this.chunkSize), this.onTime = t.onTime, this.onProgress = t.onProgress, this.onComplete = t.onComplete;
|
|
2999
2995
|
}
|
|
@@ -3001,7 +2997,7 @@ class Rc {
|
|
|
3001
2997
|
this.fileHash || (this.fileHash = await hh(this.file, this.chunkSize)), (await this.axios.post(this.checkURL, {
|
|
3002
2998
|
fileName: this.file.name,
|
|
3003
2999
|
fileHash: this.fileHash
|
|
3004
|
-
})).isExist ? (this.isUploading = !1, this.onComplete?.()) : this.isUploading || (this.startTimeCount(), await this.uploadChunk());
|
|
3000
|
+
})).isExist ? (this.isUploading = !1, this.stopTimeCount(), this.onComplete?.()) : this.isUploading || (this.startTimeCount(), await this.uploadChunk());
|
|
3005
3001
|
}
|
|
3006
3002
|
pause() {
|
|
3007
3003
|
this.isUploading && (this.isUploading = !1, this.stopTimeCount());
|