From 66f39ea9e2329a00f8985dca3e2b1c058e28cb9b Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Sun, 28 Dec 2025 00:46:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E6=B7=BB=E5=8A=A0=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=86=E4=BA=AB=E5=92=8C=E5=89=AA=E8=B4=B4=E6=9D=BF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/index.html | 60 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index d07b277..61ce187 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -310,9 +310,10 @@
- - - + + + +
@@ -446,7 +447,10 @@
- +
+ + +
@@ -1252,7 +1256,53 @@ task.pattern = item.pattern; task.replace = item.replace; } - } + }, + copyText(text, callback = () => { }) { + if (!text) { + console.error('No text to copy'); + return; + } + if (navigator.clipboard && window.isSecureContext) { + navigator.clipboard.writeText(text); + } else { + const textarea = document.createElement('textarea'); + textarea.value = text; + textarea.style.position = 'fixed'; + textarea.style.top = '0'; + textarea.style.left = '0'; + textarea.style.opacity = '0'; + document.body.appendChild(textarea); + textarea.select(); + textarea.setSelectionRange(0, 99999); + document.execCommand("copy"); + document.body.removeChild(textarea); + } + callback() + }, + copyTaskToClipboard(index) { + const task = { ...this.formData.tasklist[index] }; + delete task.addition; + this.copyText(JSON.stringify(task), function () { + console.log("任务参数已复制到剪贴板"); + }); + }, + addTaskForClipboard() { + // 读取剪贴板内容 + navigator.clipboard.readText().then(text => { + if (text) { + try { + const task = JSON.parse(text); + task.addition = config_data.task_plugins_config_default;; + this.formData.tasklist.push(task); + } catch (error) { + console.error("解析剪贴板内容失败:", error); + return; + } + } + }).catch(err => { + console.error("读取剪贴板内容失败:", err); + }); + }, } });