From b7213f8c47b9dc2ffba71672c89eeffc0626c2da Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 16 Jan 2026 10:26:57 +0000 Subject: [PATCH] =?UTF-8?q?feat(ai-assistant):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加全屏按钮,支持点击或双击标题栏切换全屏 - 全屏时禁用拖动和调整大小 - 全屏状态下占满视口(保留 12px 边距) - 关闭窗口时自动退出全屏状态 --- .../js/components/AIAssistant/index.vue | 45 ++++++++++++++++- .../js/components/AIAssistant/modal.vue | 50 +++++++++++++++---- 2 files changed, 83 insertions(+), 12 deletions(-) diff --git a/resources/assets/js/components/AIAssistant/index.vue b/resources/assets/js/components/AIAssistant/index.vue index 68f66933f..801627c2b 100644 --- a/resources/assets/js/components/AIAssistant/index.vue +++ b/resources/assets/js/components/AIAssistant/index.vue @@ -1281,7 +1281,7 @@ export default { .ai-assistant-header-actions { display: flex; align-items: center; - gap: 4px; + gap: 6px; .ai-assistant-header-btn { display: flex; @@ -1650,6 +1650,31 @@ export default { cursor: sw-resize; } + .ai-assistant-fullscreen { + position: absolute; + top: 11px; + right: 48px; + z-index: 1; + width: 28px; + height: 28px; + padding: 4px; + border-radius: 6px; + cursor: pointer; + transition: all 0.2s; + svg { + width: 100%; + height: 100%; + stroke: #777; + transition: stroke 0.2s; + } + &:hover { + background-color: rgba(0, 0, 0, 0.06); + svg { + stroke: #444; + } + } + } + .ai-assistant-close { position: absolute; top: 6px; @@ -1673,7 +1698,7 @@ export default { } .ai-assistant-header { - margin: 6px 48px 6px 16px; + margin: 6px 82px 6px 16px; .ai-assistant-header-title { > span { @@ -1780,6 +1805,22 @@ export default { .ai-assistant-input { padding: 4px 12px 12px; } + + // 全屏状态 + &.is-fullscreen { + top: 12px; + left: 12px; + right: 12px; + bottom: 12px; + width: auto; + height: auto; + max-width: none; + max-height: none; + + .ai-assistant-drag-handle { + cursor: default; + } + } } .ai-assistant-modal { diff --git a/resources/assets/js/components/AIAssistant/modal.vue b/resources/assets/js/components/AIAssistant/modal.vue index f5b0a21c2..f1332dfd7 100644 --- a/resources/assets/js/components/AIAssistant/modal.vue +++ b/resources/assets/js/components/AIAssistant/modal.vue @@ -5,23 +5,37 @@ v-if="visible" ref="chatWindow" class="ai-assistant-chat" + :class="{'is-fullscreen': isFullscreen}" :style="chatStyle"> +
+ + + + + + + + +
-
-
-
-
-
-
-
-
+ @@ -98,6 +112,8 @@ export default { resizing: false, resizeDirection: null, resizeRecord: {}, + // 全屏状态 + isFullscreen: false, }; }, @@ -141,6 +157,10 @@ export default { opacity: 0, }; } + // 全屏时不应用自定义尺寸和位置 + if (this.isFullscreen) { + return {}; + } const style = { left: `${this.left}px`, top: `${this.top}px`, @@ -162,6 +182,9 @@ export default { this.$nextTick(() => { this.updateWindowSize(); }); + } else if (!val) { + // 关闭时重置全屏状态 + this.isFullscreen = false; } }, windowWidth() { @@ -252,8 +275,8 @@ export default { * 拖动:鼠标按下 */ onDragMouseDown(e) { - // 只响应鼠标左键 - if (e.button !== 0) return; + // 只响应鼠标左键,全屏时禁用拖动 + if (e.button !== 0 || this.isFullscreen) return; this.updateWindowSize(); this.record = { @@ -267,6 +290,13 @@ export default { document.addEventListener('contextmenu', this.onContextMenu); }, + /** + * 切换全屏 + */ + toggleFullscreen() { + this.isFullscreen = !this.isFullscreen; + }, + /** * 右键菜单弹出时取消拖动/调整大小 */