From db7180fed1dde7fb7b04426ba1bf499a61866979 Mon Sep 17 00:00:00 2001 From: kim131 <1035828775@qq.com> Date: Wed, 2 Dec 2020 15:42:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=B8=80=E6=AC=A1=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/system.js | 15 +++++++++++++-- src/views/main_web/workspace/workspace.new.vue | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/services/system.js b/src/services/system.js index caf5eec0..50657077 100644 --- a/src/services/system.js +++ b/src/services/system.js @@ -203,8 +203,11 @@ const system = { projectId, projectName, folderId, folderName, folderLevelId, distFileRelativePath = '', fileName, fileExtension, sourceFilePath, - fileList, onSuccess: onSuccessHandler, onProgress: onProgressHandler = identity, onError: onErrorHandler = identity + fileList, onSuccess: onSuccessHandler, onProgress: onProgressHandler = identity, onError: onErrorHandler = identity, + totalReadyUploadNum } = params; + let {tempNumWrap} = params;//已经完成的上传文件上传数量 + const extensionedFileName = fileExtension ? `${fileName}.${fileExtension}`: fileName; const distFilePath = `${folderName}${distFileRelativePath ? `/${distFileRelativePath}`: ''}`; const maybeFile = fileList.find(iFile => distFileRelativePath === iFile.relativePath && `${iFile.archName}${iFile.extension ? `.${iFile.extension}` : ''}` === extensionedFileName); @@ -313,7 +316,15 @@ const system = { return; } //notify.success(maybeFile ? '上传成功, 已覆盖同名文件' : '上传成功'); - notify.success('文件已上传。') + tempNumWrap.tempNumCount += 1; + // console.log('tempNumCount', tempNumWrap.tempNumCount); + // console.log('totalReadyUploadNum', totalReadyUploadNum); + if(tempNumWrap.tempNumCount == totalReadyUploadNum) { + notify.success('文件已上传。') + } + + + resolveSuccess(uploadFile); } catch (e) { console.error('socket-upload-file parse data have error:', e); diff --git a/src/views/main_web/workspace/workspace.new.vue b/src/views/main_web/workspace/workspace.new.vue index 66584490..ed6ca8fe 100644 --- a/src/views/main_web/workspace/workspace.new.vue +++ b/src/views/main_web/workspace/workspace.new.vue @@ -826,11 +826,19 @@ export default { if(ifHaveRepeatFile) { let confirmRes = false; try { - await Vue.prototype.$confirm('监测到文件夹存在同名文件,是否继续上传并覆盖同名文件?'); + await Vue.prototype.$confirm('监测到文件夹存在同名文件,是否继续上传并覆盖同名文件?',"",{ + showClose: false, + type: "warning" + }); confirmRes = true; } catch(e) { console.log('user canceled'); } if(!confirmRes) return; } + + let tempNumWrap = {//为了了让这个数量被保存使用修改 这里用作为对象属性传递 + tempNumCount: 0 + } + const totalReadyUploadNum = uploadTasks ? uploadTasks.length : 0;//全部要上传的文件数量 uploadTasks.forEach(uploadTask => { const { fullPath: sourceFilePath, fileName, extension: fileExtension, relativePath } = uploadTask; // 生成 @@ -871,7 +879,9 @@ export default { }, } // console.log(folderName, levelId, folderId); - system.uploadFile(params); + + + system.uploadFile({...params, totalReadyUploadNum, tempNumWrap}); }) }, /**