From e37eebf4018c2cd057b933644f1000df3cdae63a Mon Sep 17 00:00:00 2001 From: kim131 <1035828775@qq.com> Date: Wed, 9 Dec 2020 14:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=8A=B6=E6=80=81=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E6=9C=AA=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=88=90=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BAloding=E8=92=99=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/main_web/index/index.vue | 4 +- .../workspace/components/file-item.vue | 76 +++++++++++++++---- .../main_web/workspace/workspace.new.vue | 18 ++--- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/src/views/main_web/index/index.vue b/src/views/main_web/index/index.vue index d343eeb0..e136d2a3 100644 --- a/src/views/main_web/index/index.vue +++ b/src/views/main_web/index/index.vue @@ -421,7 +421,9 @@ export default { } this.$router.push({ name: "workspace", - }); + }).catch(err => { + console.log(err); + }) sessionStorage.pageName = "workspace"; }, /** diff --git a/src/views/main_web/workspace/components/file-item.vue b/src/views/main_web/workspace/components/file-item.vue index 6efb921c..f2b38921 100644 --- a/src/views/main_web/workspace/components/file-item.vue +++ b/src/views/main_web/workspace/components/file-item.vue @@ -1,12 +1,18 @@ - - + - + + + + + 上传中 {{loadingState.loadProgress}} --> - + @@ -193,6 +199,7 @@ {{`${loadingState.loadSize || '--'} ${loadingState.loadUnit || ''} / ${loadingState.totalSize || '--'} ${loadingState.unit || ''}`}} + @@ -283,8 +290,11 @@ export default { const { file, currentFolder } = this; return file.folderId === this.nodeFolder.id; }, + isLocalIpfsCidValidate() { + return !!this.localFileHashMap; + }, localIpfsCid() { - return this.localFileHashMap[this.fileStoreKey]; + return this.localFileHashMap && this.localFileHashMap[this.fileStoreKey]; }, isWorking() { return this.file.workStatus === WORKING; @@ -324,15 +334,23 @@ export default { }, methods: { oneOf, + dblclickFile() { + if(this.isLocalIpfsCidValidate) { + this.$emit('dblclickFile'); + } + }, fileRightBtnClick(e) { - this.isFileRightMenuVisible = true; - this.fileRightMenuLeft = e.offsetX; - if(e.target === this.domFileName) { - this.fileRightMenuTop = e.offsetY + this.downLoadIconHeight; - } else { - this.fileRightMenuTop = e.offsetY + console.log(this.isLocalIpfsCidValidate); + if(this.isLocalIpfsCidValidate) { + this.isFileRightMenuVisible = true; + this.fileRightMenuLeft = e.offsetX; + if(e.target === this.domFileName) { + this.fileRightMenuTop = e.offsetY + this.downLoadIconHeight; + } else { + this.fileRightMenuTop = e.offsetY + } + this.$emit('oneFileRightBtnClick', this.file.id); } - this.$emit('oneFileRightBtnClick', this.file.id); }, closeFileRightMenu() { this.isFileRightMenuVisible = false; @@ -360,7 +378,7 @@ export default { }, tempRightFileId(val) { this.isFileRightMenuVisible = (val === this.file.id); - } + }, } }; @@ -408,4 +426,36 @@ export default { color:rgb(167,168,183); } + + + + \ No newline at end of file diff --git a/src/views/main_web/workspace/workspace.new.vue b/src/views/main_web/workspace/workspace.new.vue index 3a2f1461..62bc9a92 100644 --- a/src/views/main_web/workspace/workspace.new.vue +++ b/src/views/main_web/workspace/workspace.new.vue @@ -46,7 +46,7 @@ class="section_item section_item_aside_fl" > 工作文件 @@ -94,7 +94,7 @@ :nodeFolder="currentNodeFolder" :currentFolder="currentFolder" :commitFile="commitFile" - @dblclick.native="fileClick(file)" + @dblclickFile="fileClick(file)" @openfileBtnClick="fileClick(file)" @copyFileBtnClick="copyWorkFileBtnClick(file)" @oneFileRightBtnClick="oneFileRightBtnClick" @@ -213,7 +213,7 @@ :showFileMilestone="showFileMilestone" :nodeFolder="currentNodeFolder" :currentFolder="currentFolder" - @dblclick.native="fileClick(file)" + @dblclickFile="fileClick(file)" @oneFileRightBtnClick="oneFileRightBtnClick" :localFileHashMap="localFileHashMap" :loadingState="localFileLoadStateMap[file.id]" @@ -429,7 +429,7 @@ export default { neibianju: "neibianju", // 协作文件槽样式 showadow: false, - localFileHashMap: {}, // { `${节点名称}\\${文件名称}.${文件扩展名}`: `${ipfsCid}` } + localFileHashMap: null, // { `${节点名称}\\${文件名称}.${文件扩展名}`: `${ipfsCid}` } /** * 文件本地加载状态表 * 格式: { @@ -471,7 +471,8 @@ export default { this.socketIns = system.entryProject( sessionStorage.projName, sessionStorage.userId, - this.onSocketFileChangeDetected.bind(this), (localWorkspacePrefix) => { this.localWorkspacePrefix = localWorkspacePrefix;}, + this.onSocketFileChangeDetected.bind(this), + (localWorkspacePrefix) => { this.localWorkspacePrefix = localWorkspacePrefix;}, errorEvent => { notify.error('本地网关通讯失败'); } ); this.intervalTask(); @@ -492,7 +493,7 @@ export default { computed: { // 当前节点文件夹在节点文件夹数组中的顺序 nowFolderIndex() { - return this.nodeFolders.indexOf(this.currentNodeFolder); + return this.nodeFolders && this.nodeFolders.indexOf(this.currentNodeFolder); }, // 当前节点文件夹的名称 nowFolderName() { @@ -514,7 +515,7 @@ export default { }, // 删除文件夹 递归删除文件夹下面的所有文件 deleteFolderClick(id) { - const { subFolderList, workFileList, subFolderMap, userId, localFileHashMap, reverseLocalFileHashMap } = this; + const { isClient, subFolderList, workFileList, subFolderMap, userId, localFileHashMap, reverseLocalFileHashMap } = this; const deleteFolderName = subFolderMap[id].folderName; const thisApp = this; const totalDeleteFileLists = []; @@ -541,7 +542,7 @@ export default { // 删除文件夹 let counter = 0; totalDeleteFileLists.forEach(async delFile => { - delete localFileHashMap[reverseLocalFileHashMap[delFile.ipfsCid]]; + isClient && delete localFileHashMap[reverseLocalFileHashMap[delFile.ipfsCid]]; const res = await services.deleteFile(delFile.id); counter = res.Code == 0 ? counter+1 : counter; if(counter == totalNum) { @@ -1041,7 +1042,6 @@ export default { * } */ async clientUpload(filePaths) { // uploadTask - console.log('filePaths'); const tasksGroup = await Promise.all(filePaths.map(path => system.analyzeSystemPath(path))); const uploadTasks = flatten(tasksGroup); const { folderName, levelId, id: folderId } = this.currentNodeFolder;