From cb6c50b071a7fd3f8a91a0b492b4bd9bfafee4d9 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 19 Jan 2026 01:13:18 +0000 Subject: [PATCH] =?UTF-8?q?fix(ai-assistant):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=92=8C=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E8=A2=AB=E5=85=B6=E4=BB=96=E5=BC=B9=E7=AA=97=E9=81=AE=E6=8C=A1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 window.modalTransferIndex + 1000 作为动态 z-index - 添加定时刷新机制:弹窗可见时 5 秒刷新,不可见时 20 秒刷新 - modal.vue 通过 zIndex prop 接收并应用 z-index - float-button.vue 通过 $parent.topZIndex 获取 z-index - Dropdown 和 Select 使用 ViewUI 新增的 z-index prop --- .../components/AIAssistant/float-button.vue | 2 +- .../js/components/AIAssistant/index.vue | 130 ++++++++++++------ .../js/components/AIAssistant/modal.vue | 10 +- 3 files changed, 101 insertions(+), 41 deletions(-) diff --git a/resources/assets/js/components/AIAssistant/float-button.vue b/resources/assets/js/components/AIAssistant/float-button.vue index 8394253bf..15f6cbf64 100644 --- a/resources/assets/js/components/AIAssistant/float-button.vue +++ b/resources/assets/js/components/AIAssistant/float-button.vue @@ -127,6 +127,7 @@ export default { top: `${this.wrapperTop}px`, width: `${this.wrapperWidth}px`, height: `${this.wrapperHeight}px`, + zIndex: this.$parent?.topZIndex || 2000, }; }, @@ -478,7 +479,6 @@ $collapsed-height: 48px; .ai-float-button-wrapper { position: fixed; - z-index: 1000; display: flex; align-items: center; diff --git a/resources/assets/js/components/AIAssistant/index.vue b/resources/assets/js/components/AIAssistant/index.vue index ca584e064..c00454f20 100644 --- a/resources/assets/js/components/AIAssistant/index.vue +++ b/resources/assets/js/components/AIAssistant/index.vue @@ -2,7 +2,8 @@ + :shouldCreateNewSession="shouldCreateNewSession" + :zIndex="topZIndex">
@@ -16,7 +17,8 @@ v-if="sessionEnabled && hasSessionHistory" trigger="click" placement="bottom-end" - :transfer="true"> + :transfer="true" + :z-index="topZIndex + 1">
@@ -28,12 +30,12 @@ @click.native="loadSession(session.id)">
- {{ session.title }} - {{ formatSessionTime(session.updatedAt) }} -
-
- +
{{ session.title }}
+
+ +
+ {{ formatSessionTime(session.updatedAt) }}
@@ -153,7 +155,8 @@ :loading="modelsLoading" :disabled="modelsLoading || modelGroups.length === 0" :not-found-text="$L('暂无可用模型')" - transfer> + transfer + :z-index="topZIndex + 1"> { + this.updateTopZIndex(); + }, interval); + }, + + /** + * 停止 z-index 刷新定时器 + */ + stopZIndexTimer() { + if (this.zIndexTimer) { + clearInterval(this.zIndexTimer); + this.zIndexTimer = null; + } + }, }, } @@ -1901,7 +1945,7 @@ export default { .ai-assistant-history-menu { min-width: 240px; - max-width: 300px; + max-width: 260px; max-height: 320px; overflow-y: auto; @@ -1916,17 +1960,20 @@ export default { .history-item { display: flex; - align-items: center; - gap: 8px; + flex-direction: column; + gap: 2px; .history-item-content { flex: 1; min-width: 0; display: flex; - flex-direction: column; - gap: 2px; + gap: 8px; + line-height: 20px; + align-items: center; .history-item-title { + flex: 1; + min-width: 0; font-size: 13px; color: #303133; overflow: hidden; @@ -1934,35 +1981,40 @@ export default { white-space: nowrap; } - .history-item-time { - font-size: 11px; - color: #909399; + .history-item-delete { + flex-shrink: 0; + display: none; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + border-radius: 4px; + margin-right: -2px; + transition: opacity 0.2s, background-color 0.2s; + cursor: pointer; + + &:hover { + background-color: rgba(0, 0, 0, 0.08); + } + + > i { + font-size: 12px; + color: #909399; + } } } - .history-item-delete { - display: flex; - align-items: center; - justify-content: center; - width: 20px; - height: 20px; - border-radius: 4px; - opacity: 0; - transition: opacity 0.2s, background-color 0.2s; - cursor: pointer; - - &:hover { - background-color: rgba(0, 0, 0, 0.08); - } - - > i { - font-size: 12px; - color: #909399; - } + .history-item-time { + font-size: 11px; + color: #909399; } - &:hover .history-item-delete { - opacity: 1; + &:hover { + .history-item-content { + .history-item-delete { + display: flex; + } + } } } diff --git a/resources/assets/js/components/AIAssistant/modal.vue b/resources/assets/js/components/AIAssistant/modal.vue index f1332dfd7..854bc4e14 100644 --- a/resources/assets/js/components/AIAssistant/modal.vue +++ b/resources/assets/js/components/AIAssistant/modal.vue @@ -72,6 +72,10 @@ export default { shouldCreateNewSession: { type: Boolean, default: false + }, + zIndex: { + type: Number, + default: 2000 } }, @@ -155,15 +159,19 @@ export default { if (!this.positionLoaded) { return { opacity: 0, + zIndex: this.zIndex, }; } // 全屏时不应用自定义尺寸和位置 if (this.isFullscreen) { - return {}; + return { + zIndex: this.zIndex, + }; } const style = { left: `${this.left}px`, top: `${this.top}px`, + zIndex: this.zIndex, }; // 应用自定义尺寸 if (this.customSize.width) {