From 698aee6067a539396d92c179b0bd865d6dacc8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=92=B8=E9=B1=BC?= Date: Sun, 13 Mar 2022 22:43:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8=E6=97=A0=E6=B3=95=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileHandler.vue | 13 +++++-------- src/components/SearchResult.vue | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/components/FileHandler.vue b/src/components/FileHandler.vue index a24e3d3..07a7a95 100644 --- a/src/components/FileHandler.vue +++ b/src/components/FileHandler.vue @@ -129,7 +129,6 @@ import { FileQueueHandler as FileQueue } from '@/service/FileUpload/FileUploadQu import axios from 'axios' import SearchResult from '@/components/SearchResult.vue' import API from '@/api' -import FormUtils from '@/utils/FormUtils' import MduiDialog from './ui/MduiDialog.vue' import MduiCheckbox from './ui/MduiCheckbox.vue' import MduiBtn from './ui/MduiBtn.vue' @@ -377,17 +376,15 @@ export default { /** * 搜索框中的文件被点击时,打开下载 */ - fileClick(path) { - const url = (API.server || location.origin) + '/api/' + API.file.getContent(this.uid, path).url.replace(/\/+/g, '/') - FormUtils.jumpWithPost(url, true, { - Token: this.token - }) + fileClick(fileInfo) { + const url = (API.server || location.origin) + '/api/' + API.resource.downloadFileByMD5(fileInfo.md5, fileInfo.name).url.replace(/\/+/g, '/') + window.open(url, '_blank') }, /** * 搜索框中的目录被点击时,打开网盘目录对应的视图 - * @param {String} path */ - dirClick(path) { + dirClick(dirInfo) { + let path = dirInfo.path path = path.split('/').map(encodeURIComponent).join('/') this.searchMode = false location.href = `/#/${this.viewRouteName}` + path diff --git a/src/components/SearchResult.vue b/src/components/SearchResult.vue index b38d7c9..cec45e7 100644 --- a/src/components/SearchResult.vue +++ b/src/components/SearchResult.vue @@ -99,17 +99,21 @@ export default { mdui.alert(e.msg) }) }, - clickFile(info) { - this.d_loading = true - - this.parseNode(this.uid, info.dir ? info.md5 : info.node).then(e => { - this.d_loading = false - if (info.dir) { - this.$emit('clickDir', e) - } else { - this.$emit('clickFile', `${e}/${info.name}`) + async clickFile(info) { + if (!info.dir) { + this.$emit('clickFile', info) + } else { + this.d_loading = true + try { + const path = await this.parseNode(this.uid, info.dir ? info.md5 : info.node) + info.path = path + this.$emit('clickDir', path) + this.d_loading = false + } catch (err) { + mdui.alert(err.toString()) } - }).catch(this.d_loading = false) + this.d_loading = false + } }, clickPath(info) { this.d_loading = true -- Gitee