From e50307b25f8630aeec232b968c4b58c4a670d28f Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Sat, 10 May 2025 13:18:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=81=E8=AE=B8=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E9=95=BF=E6=8C=89=E6=A0=87=E7=AD=BE=E6=8C=82=E8=B5=B7?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/TerminalTabBar.vue | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/TerminalTabBar.vue b/packages/frontend/src/components/TerminalTabBar.vue index d0553bf..8040c44 100644 --- a/packages/frontend/src/components/TerminalTabBar.vue +++ b/packages/frontend/src/components/TerminalTabBar.vue @@ -328,6 +328,41 @@ const handleDragStart = (event: DragEvent) => { } }; +// 新增:处理长按事件以在手机模式下触发挂起和取消挂起 +let touchTimeout: number | null = null; +const touchDuration = 800; // 长按时间阈值,单位毫秒 +let touchedSessionId: string | null = null; + +const handleTouchStart = (event: TouchEvent, sessionId: string) => { + if (props.isMobile) { + touchedSessionId = sessionId; + if (touchTimeout) { + clearTimeout(touchTimeout); + } + touchTimeout = window.setTimeout(() => { + if (touchedSessionId === sessionId) { + const sessionState = sessionStore.sessions.get(sessionId); + if (sessionState && sessionState.isMarkedForSuspend) { + console.log(`[TabBar] Long press to unmark suspend for session ID: ${sessionId}`); + sessionStore.requestUnmarkSshSuspend(sessionId); + } else if (sessionState) { + console.log(`[TabBar] Long press to mark suspend for session ID: ${sessionId}`); + sessionStore.requestStartSshSuspend(sessionId); + } + } + touchTimeout = null; + }, touchDuration); + } +}; + +const handleTouchEnd = (event: TouchEvent) => { + if (touchTimeout) { + clearTimeout(touchTimeout); + touchTimeout = null; + } + touchedSessionId = null; +}; +