|
|
@@ -83,7 +83,19 @@ const system = { |
|
|
|
socket.on('open', () => { |
|
|
|
socket.send([fileIpfsId, projectName, fileName, dirName].join('|')); |
|
|
|
}); |
|
|
|
socket.on('message', (e) => { onProcessHandler(e, socket); }); |
|
|
|
socket.on('message', (e) => { |
|
|
|
if(e.data === '-1') { |
|
|
|
notify.error('文件下载失败'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(e.data === '-2') { |
|
|
|
notify.error('请先关闭本地文件后再下载'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
onProcessHandler(e, socket); |
|
|
|
}); |
|
|
|
socket.on('error', e => { |
|
|
|
onErrorHandler(e); |
|
|
|
}); |
|
|
@@ -161,6 +173,16 @@ const system = { |
|
|
|
|
|
|
|
socket.on('message', async (e) => { |
|
|
|
console.log('receive download file message:', e); |
|
|
|
if(e.data === '-1') { |
|
|
|
notify.error('文件上传失败'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(e.data === '-2') { |
|
|
|
notify.error('请先关闭本地文件后再上传'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
const progressData = JSON.parse(e.data); |
|
|
|
const { size, process, hash } = progressData; |
|
|
@@ -203,6 +225,16 @@ const system = { |
|
|
|
socket.send(data); |
|
|
|
}); |
|
|
|
socket.on('message', async (e) => { |
|
|
|
if(e.data === '-1') { |
|
|
|
notify.error('文件上传失败'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(e.data === '-2') { |
|
|
|
notify.error('请先关闭本地文件后再上传'); |
|
|
|
onErrorHandler(e); |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
const progressData = JSON.parse(e.data); |
|
|
|
const { size, process, hash } = progressData; |
|
|
|