diff --git a/public/cloud.html b/public/cloud.html index 0360e9c..746b9b2 100644 --- a/public/cloud.html +++ b/public/cloud.html @@ -1,55 +1,78 @@ - - - - 云盘上传 - - - + + + + 云盘上传 + - - + - - + function upload(file, currentIndx) { + var formData = new FormData() + formData.append('songFile', file) + axios({ + method: 'post', + url: `http://localhost:3000/cloud?time=${Date.now()}`, + headers: { + 'Content-Type': 'multipart/form-data', + }, + data: formData, + }).then(res => { + console.log(`${file.name} 上传成功`) + if (currentIndx >= fileLength) { console.log('上传完毕') } + }).catch(async err => { + console.log(err) + console.log(fileUpdateTime) + fileUpdateTime[file.name] ? fileUpdateTime[file.name] += 1 : fileUpdateTime[file.name] = 1 + if (fileUpdateTime[file.name] >= 4) { + console.error(`丢,这首歌怎么都传不上:${file.name}`) + return + } else { + console.error(`${file.name} 失败 ${fileUpdateTime[file.name]} 次`) + } + await login() + upload(file, currentIndx) + }) + } + + + + \ No newline at end of file