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 63f0e6c7..0006b20a 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}); }) }, /**