From e3f50a1072cc40982b09336d4d528ef75cb34a88 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 28 May 2024 16:53:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=A4=A7=E9=87=8F=E6=96=87=E4=BB=B6=E4=BC=A0=E8=BE=93=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E5=8D=A1=E4=BD=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/file-api.js | 4 ++-- src/components/ShowFile/ShowFile.vue | 3 +++ .../SimpleUploader/globalUploader.vue | 22 +++++++++++-------- src/store/index.js | 7 ++++++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/api/file-api.js b/src/api/file-api.js index 1126801..bd92775 100644 --- a/src/api/file-api.js +++ b/src/api/file-api.js @@ -16,11 +16,11 @@ export default { }) }, // 检查文件是否存在 - checkExist: function (params) { + checkExist: function (data) { return request({ url: "checkExist", method: "post", - params + data }) }, // 上传文件夹 diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index d58c6f0..46c20f6 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1490,6 +1490,9 @@ export default { this.path = '' } if (fileDoc) { + if (this.$store.state.uploaderState) { + return + } if (fileDoc.$set) { let path = fileDoc.$set.path path = path.replace(/\\/g, '/') diff --git a/src/components/SimpleUploader/globalUploader.vue b/src/components/SimpleUploader/globalUploader.vue index e593b75..e59a8be 100755 --- a/src/components/SimpleUploader/globalUploader.vue +++ b/src/components/SimpleUploader/globalUploader.vue @@ -17,7 +17,7 @@ > - + 上传文件到当前目录下 @@ -190,7 +190,7 @@ export default { fileListScrollTop: 0, dragoverLoop: null, successMsg: null, - enableDragUplaod: false,// 是否启用拖拽上传 + enableDragUpload: false,// 是否启用拖拽上传 uploader: null, } }, @@ -200,7 +200,7 @@ export default { watch: { $route(route) { // 只有首页才启用拖拽上传 - this.enableDragUplaod = route.path === '/' + this.enableDragUpload = route.path === '/' }, message(msg) { switch (msg.event) { @@ -234,12 +234,12 @@ export default { } }, mounted() { - this.enableDragUplaod = this.$route.path === '/' + this.enableDragUpload = this.$route.path === '/' let that = this let dropbox = document.body document.body.ondragstart = function (e) { - if (that.enableDragUplaod) { + if (that.enableDragUpload) { if (e.target.slot === 'jmal') { that.isDragStart = true } @@ -357,6 +357,10 @@ export default { this.doUploadBefore(files) } }, + displayPanel(display) { + this.panelShow = display + this.$store.dispatch('updateUploaderState', display) + }, doUploadBefore(files) { this.fileListLength = this.uploader.fileList.length const filePaths = this.uploader.filePaths @@ -382,7 +386,7 @@ export default { } if (window.pc) { this.pc = true - this.panelShow = true + this.displayPanel(true) } else { this.pc = false this.shrink() @@ -490,7 +494,7 @@ export default { } if (this.process === -10 || this.process === 100 || this.fileListLength === 0) { this.uploader.cancel() - this.panelShow = false + this.displayPanel(false) } }, onFileError(rootFile, file, response) { @@ -641,7 +645,7 @@ export default { close() { if (this.process === -10 || this.process === 100 || this.fileListLength === 0) { this.uploader.cancel() - this.panelShow = false + this.displayPanel(false) } else { this.$confirm('还有文件正在上传, 确定要关闭吗?', '提示', { confirmButtonText: '确定', @@ -649,7 +653,7 @@ export default { type: 'warning' }).then(() => { this.uploader.cancel() - this.panelShow = false + this.displayPanel(false) }) } }, diff --git a/src/store/index.js b/src/store/index.js index 4247cbb..7421af5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -16,16 +16,23 @@ const store = new Vuex.Store({ getters, state: { message: null, + uploaderState: null, }, mutations: { setMessage(state, message) { state.message = message; }, + setUploaderState(state, uploaderState) { + state.uploaderState = uploaderState; + }, }, actions: { updateMessage({ commit }, message) { commit('setMessage', message); }, + updateUploaderState({ commit }, uploaderState) { + commit('setUploaderState', uploaderState); + }, } })