From 1bd23ec4ae27415d2da14037672cb6b10af93ee7 Mon Sep 17 00:00:00 2001 From: yukaidi Date: Fri, 29 May 2026 12:13:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=9B=AE=E5=BD=95=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=8D=E5=88=B6=E7=9B=B4=E9=93=BE=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-front/src/components/DirectoryTree.vue | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/web-front/src/components/DirectoryTree.vue b/web-front/src/components/DirectoryTree.vue index 805d54b..fa90d1a 100644 --- a/web-front/src/components/DirectoryTree.vue +++ b/web-front/src/components/DirectoryTree.vue @@ -190,6 +190,14 @@ > 发送到下载器 + + 复制直链 +
@@ -258,6 +266,14 @@ > 发送到下载器 + + 复制直链 +
@@ -324,6 +340,14 @@ > 发送到下载器 + + 复制直链 +
@@ -391,6 +415,7 @@ export default { downloadInfo: null, downloadLoading: false, singleSendLoading: false, + copyLinkLoading: false, treeProps: { label: 'fileName', children: 'children', @@ -743,6 +768,32 @@ export default { this.fileDialogVisible = false this.selectedFile = null }, + async copyDirectLink(file) { + if (!file?.parserUrl) { + this.$message.warning('该文件暂无直链') + return + } + const rawUrl = file.parserUrl.startsWith('http') ? file.parserUrl : (window.location.origin + file.parserUrl) + const url = this.appendToken(rawUrl) + this.copyLinkLoading = true + try { + await navigator.clipboard.writeText(url) + this.$message.success('直链已复制到剪贴板') + } catch { + // fallback + const ta = document.createElement('textarea') + ta.value = url + ta.style.position = 'fixed' + ta.style.opacity = '0' + document.body.appendChild(ta) + ta.select() + document.execCommand('copy') + document.body.removeChild(ta) + this.$message.success('直链已复制到剪贴板') + } finally { + this.copyLinkLoading = false + } + }, closePreview() { this.isPreviewing = false this.previewUrl = ''