From e8e07a3725d777e82c3493b3fe7c2af948b26ad7 Mon Sep 17 00:00:00 2001 From: jmal Date: Thu, 13 Apr 2023 18:05:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=8D=E5=88=B6=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileTree/DirTree.vue | 2 +- src/components/FileTree/index.vue | 2 +- src/components/ShowFile/ShowFile.vue | 26 +++++++++++++++----------- src/websocket/sockJS.js | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/components/FileTree/DirTree.vue b/src/components/FileTree/DirTree.vue index 3d43a86..f5b675d 100644 --- a/src/components/FileTree/DirTree.vue +++ b/src/components/FileTree/DirTree.vue @@ -180,7 +180,7 @@ export default { userId: this.$store.state.user.userId }).then((res) => { data.newFolder = false - data.id = res.data.id + data.id = res.data }).catch(() => { window.event.preventDefault() window.event.stopPropagation() diff --git a/src/components/FileTree/index.vue b/src/components/FileTree/index.vue index c214212..39680fe 100644 --- a/src/components/FileTree/index.vue +++ b/src/components/FileTree/index.vue @@ -141,7 +141,7 @@ userId: this.$store.state.user.userId }).then((res) => { data.newFolder = false - data.id = res.data.id + data.id = res.data }).catch(() => { window.event.preventDefault() window.event.stopPropagation() diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 0102e21..b42e2fc 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -465,6 +465,7 @@ @close="clearTreeNode" >   正在' + operation + '' + message: operation + '中...' }); this.dialogMoveOrCopyVisible = false api[operating]({ @@ -2845,7 +2847,7 @@ export default { }).then(() => { copying.iconClass = null copying.type = 'success' - copying.message = operation + '成功' + copying.message = operation + '中...' if (this.rowContextData.isFolder) { this.$refs.directoryTree.append(this.rowContextData, to) } @@ -2875,15 +2877,17 @@ export default { if (parentData.path) { path = parentData.path + parentData.name + path } + let newFolderName = document.getElementById("treeInput").value api.newFolder({ isFolder: true, - filename: encodeURI(data.name), - currentDirectory: encodeURI(this.$route.query.path), + filename: encodeURI(newFolderName), + currentDirectory: encodeURI(path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { data.newFolder = false - data.id = res.data.id + data.name = newFolderName + data.id = res.data }).catch(() => { window.event.preventDefault() window.event.stopPropagation() @@ -3070,7 +3074,7 @@ export default { this.unzip(file, undefined, true) }, unzipTo(file) { - this.dialogMoveOrCopyVisible = true + this.showDialogMoveOrCopyVisible() this.titlePrefix = '解压到: ' this.unzipOperating = true const that = this diff --git a/src/websocket/sockJS.js b/src/websocket/sockJS.js index 5a90869..80a16b8 100644 --- a/src/websocket/sockJS.js +++ b/src/websocket/sockJS.js @@ -38,6 +38,24 @@ function connect(username,token){ Bus.$emit('msg/synced', msg) } else { Bus.$emit('msg/file/change', msg) + if ('copyFile' === url) { + let doc = JSON.parse(msg.body) + if (doc.code === 0) { + Bus.$notify({ + title: '操作成功', + dangerouslyUseHTMLString: true, + message: `

form:

${doc.from}

to:

${doc.to}
`, + type: 'success' + }); + } else { + Bus.$notify({ + title: '操作失败', + dangerouslyUseHTMLString: true, + message: `${doc.msg}`, + type: 'error' + }); + } + } } }, ws.headers); }, (err) => {