|
@@ -100,16 +100,17 @@ export default {
|
|
|
|
|
|
getFileMD5(this.form.file, async (md5) => {
|
|
|
this.record('文件MD5:' + md5)
|
|
|
- const start = await this.$api.startChunks({md5: md5, fileName: this.form.file.name,sourceId:this.$constants.sourceId})
|
|
|
+ var time = new Date().getTime()
|
|
|
+ const start = await this.$api.startChunks({md5: md5, fileName: this.form.file.name,sourceId:this.$constants.sourceId,time:time})
|
|
|
if(!start.data){
|
|
|
return
|
|
|
}
|
|
|
this.state = 1
|
|
|
- await this.uploadChunks(fileChunks, md5, 0)
|
|
|
+ await this.uploadChunks(fileChunks, md5, 0,time)
|
|
|
this.state = 2
|
|
|
// this.record('等待服务器合并分片')
|
|
|
this.recordMessage = '等待服务器合并分片'
|
|
|
- const response = await this.$api.mergeChunks({ md5: md5, fileName: this.form.file.name })
|
|
|
+ const response = await this.$api.mergeChunks({ md5: md5, fileName: this.form.file.name,time:time })
|
|
|
if(response.code != 200){
|
|
|
return
|
|
|
}
|
|
@@ -131,7 +132,7 @@ export default {
|
|
|
this.currentIndex += 1
|
|
|
this.percentage =parseInt( this.currentIndex / this.len * 100)
|
|
|
},
|
|
|
- async uploadChunks(fileChunks, md5, index=0) {
|
|
|
+ async uploadChunks(fileChunks, md5, index=0,time) {
|
|
|
for(var i = index;i<fileChunks.length;i++){
|
|
|
|
|
|
await new Promise((resolve,reject) => {
|
|
@@ -139,6 +140,7 @@ export default {
|
|
|
formData.append('file', fileChunks[i].file)
|
|
|
formData.append('md5', md5)
|
|
|
formData.append('index', i)
|
|
|
+ formData.append('time', time)
|
|
|
formData.append('sourceId', this.$constants.sourceId)
|
|
|
// setTimeout(()=>{
|
|
|
// const status = `将分片上传至服务器(${i + 1}/${fileChunks.length})`
|