소스 검색

上传文件夹只显示一次成功弹窗

dev-remain
kim131 4 년 전
부모
커밋
db7180fed1
2개의 변경된 파일25개의 추가작업 그리고 4개의 파일을 삭제
  1. +13
    -2
      src/services/system.js
  2. +12
    -2
      src/views/main_web/workspace/workspace.new.vue

+ 13
- 2
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);


+ 12
- 2
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});
})
},
/**


불러오는 중...
취소
저장