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 }} - + - +