-
Notifications
You must be signed in to change notification settings - Fork 516
修复 sdk 最近的一些 issue #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修复 sdk 最近的一些 issue #400
Changes from all commits
506da8b
1c4b28f
f420dad
3d8a8f8
24f816e
a3318db
1d851a4
ddb7391
1fa7df5
806e3f1
27c80bc
3a073e8
56b2300
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,7 +188,6 @@ export class UploadManager { | |
removeLocalFileInfo(this.file); | ||
return; | ||
} | ||
setLocalFileInfo(this.file, this.ctxList); | ||
} | ||
); | ||
return result; | ||
|
@@ -231,12 +230,16 @@ export class UploadManager { | |
onProgress, | ||
onCreate | ||
}).then(response => { | ||
// 在某些浏览器环境下,xhr 的 progress 事件无法被触发,progress 为 null,这里在每次分片上传完成后都手动更新下 progress | ||
onProgress({ loaded: chunk.size }); | ||
|
||
this.ctxList[index] = { | ||
time: new Date().getTime(), | ||
ctx: response.data.ctx, | ||
size: chunk.size, | ||
md5: md5 | ||
}; | ||
setLocalFileInfo(this.file, this.ctxList); | ||
}); | ||
}); | ||
} | ||
|
@@ -272,9 +275,16 @@ export class UploadManager { | |
this.onData(this.progress); | ||
} | ||
|
||
finishDirectProgress(){ | ||
finishDirectProgress() { | ||
// 在某些浏览器环境下,xhr 的 progress 事件无法被触发,progress 为 null, 这里 fake 下 | ||
if (!this.progress) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 整体流程上看 progress 为 null 的情况确认只需要处理这一处吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 有两处啊,毕竟上传方式有两种 |
||
this.progress = { total: this.getProgressInfoItem(this.file.size, this.file.size) }; | ||
this.onData(this.progress); | ||
return; | ||
} | ||
|
||
let total = this.progress.total; | ||
this.progress.total = this.getProgressInfoItem(total.loaded + 1, total.size); | ||
this.progress = { total: this.getProgressInfoItem(total.loaded + 1, total.size) }; | ||
this.onData(this.progress); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,9 @@ | |
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-runtime": "^6.26.0", | ||
"qiniu-js":"^2.0.2", | ||
"es3ify-loader": "^0.2.0", | ||
"open-browser-webpack-plugin": "0.0.5", | ||
"qiniu-js": "^2.5.4", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 只需要更新一个 demo 的依赖? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是的,只有这个是单独有自己的node_modules |
||
"uglifyjs-webpack-plugin": "^1.1.6", | ||
"webpack": "^3.6.0", | ||
"webpack-dev-server": "^2.9.1" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确认一下 progress 多触发一两次没问题吗?
另外触发顺序检查了吗?(确保 progress 一定是增的或者说不减的,并且一定在 complete 前触发)