From d2c1fff13fc84c9bc9e9c04f1a1a1f2cc26b3f15 Mon Sep 17 00:00:00 2001 From: old burden Date: Wed, 1 Apr 2026 17:44:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20keydown=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portal-ui/src/components/VideoComposeCard.vue | 14 +- portal-ui/src/layout/components/Menu.vue | 48 +++++- portal-ui/src/views/AssetGroupManage.vue | 68 ++++---- portal-ui/src/views/AssetManage.vue | 157 +++++++----------- .../ai/service/impl/BaseByteApiService.java | 131 ++++----------- 5 files changed, 189 insertions(+), 229 deletions(-) diff --git a/portal-ui/src/components/VideoComposeCard.vue b/portal-ui/src/components/VideoComposeCard.vue index 66105db..98b10a4 100644 --- a/portal-ui/src/components/VideoComposeCard.vue +++ b/portal-ui/src/components/VideoComposeCard.vue @@ -1030,6 +1030,10 @@ const onEditorKeyup = (e) => { mentionActiveIndex.value = -1 return } + // 上下键由 keydown 中控制高亮索引,keyup 不应重置为首项 + if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') { + return + } mentionVisible.value = isReference.value && hasActiveMentionTrigger() if (mentionVisible.value && e.key === '@' && mentionCandidates.value.length === 0) { Message.warning('请等待上传完成后再引用') @@ -1037,7 +1041,15 @@ const onEditorKeyup = (e) => { mentionActiveIndex.value = -1 return } - mentionActiveIndex.value = mentionVisible.value && mentionCandidates.value.length ? 0 : -1 + if (mentionVisible.value && mentionCandidates.value.length) { + const max = mentionCandidates.value.length - 1 + mentionActiveIndex.value = + mentionActiveIndex.value >= 0 + ? Math.min(mentionActiveIndex.value, max) + : 0 + } else { + mentionActiveIndex.value = -1 + } } const selectMentionItem = (item) => { diff --git a/portal-ui/src/layout/components/Menu.vue b/portal-ui/src/layout/components/Menu.vue index 4044e09..9ff8af2 100644 --- a/portal-ui/src/layout/components/Menu.vue +++ b/portal-ui/src/layout/components/Menu.vue @@ -22,15 +22,11 @@