From edf690d5bd7720ac38a0440e08da3cd6471a82ad Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Fri, 29 May 2020 00:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=90=9C=E7=B4=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=97=A0=E6=B3=95=E9=A2=84=E8=A7=88=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E8=83=BD=E7=9B=B4=E6=8E=A5=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20#30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/page/GoList.vue | 40 +++++++++++++----------- src/views/page/components/grid/index.vue | 6 ++-- src/views/page/components/list/index.vue | 15 ++++----- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/views/page/GoList.vue b/src/views/page/GoList.vue index 672400b..ab07c88 100644 --- a/src/views/page/GoList.vue +++ b/src/views/page/GoList.vue @@ -12,7 +12,7 @@ :data="buildFiles" v-if="mode === 'list'" :icons="getIcon" - :go="go" + :action="action" :copy="copy" />
- + { @@ -256,7 +259,7 @@ export default { inited(viewer) { this.$viewer = viewer; }, - go(file, target) { + action(file, target) { if (file.mimeType.indexOf("image") != -1) { this.viewer = true; this.$nextTick(() => { @@ -265,19 +268,25 @@ export default { }); return; } - let path = file.path; let cmd = this.$route.params.cmd; if (cmd && cmd === "search") { this.goSearchResult(file, target); return; } + this.target(file, target); + }, + target(file, target) { + let path = file.path; if (target === "_blank") { window.open(path); return; } + if (target === "copy") { + this.copy(path) + return; + } if (target === "down" || (!checkExtends(path) && !file.isFolder)) { - let temp_path = this.$route.params.path ? this.$route.params.path : ""; - location.href = `/${this.$route.params.id}:down/${temp_path}/${encodePath(file.name)}`; + location.href = path.replace(/^\/(\d+:)\//,"/$1down/"); return; } if (target === "view") { @@ -319,22 +328,15 @@ export default { }, goSearchResult(file, target) { this.loading = true; - let cur = window.current_drive_order; + let id = this.$route.params.id; axios - .post(`/${cur}:id2path`, { id: file.id }) + .post(`/${id}:id2path`, { id: file.id }) .then((res) => { this.loading = false; let data = res.data; if (data) { - var href = checkoutPath(data, file); - href = `/${cur}:${data}`; - if (target === "_blank") { - window.open(href); - } else { - this.$router.push({ - path: checkView(href), - }); - } + file.path = `/${id}:${data}`; + this.target(file, target) } }) .catch((e) => { diff --git a/src/views/page/components/grid/index.vue b/src/views/page/components/grid/index.vue index 39c75fc..018d0bf 100644 --- a/src/views/page/components/grid/index.vue +++ b/src/views/page/components/grid/index.vue @@ -5,7 +5,7 @@ class="column is-one-quarter" v-for="(file, index) in folders" :key="'folder_' + index" - @click="go(file)" + @click="action(file)" >
@@ -24,7 +24,7 @@ class="column is-one-quarter" v-for="(file, index) in files" :key="'file_' + index" - @click="go(file, 'view')" + @click="action(file, 'view')" >
{{ file.size }} - + - +