From c9c34501ce26299b8e354a2b99789de99de6dbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Thu, 6 Nov 2025 16:42:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(ai-call):=20=E5=AE=9E=E7=8E=B0=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E5=B0=BA=E5=AF=B8=E5=92=8C=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加对话框尺寸状态保存与恢复功能 - 支持通过 sessionStorage 存储对话框宽高及坐标 -优化欢迎消息区域高度计算逻辑- 移除旧的状态处理机制,采用事件驱动方式- 确保在无保存状态时使用默认尺寸配置 --- src/views/portal/case/AICall.vue | 50 ++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/views/portal/case/AICall.vue b/src/views/portal/case/AICall.vue index 5a6dfcb3..84fb69a5 100644 --- a/src/views/portal/case/AICall.vue +++ b/src/views/portal/case/AICall.vue @@ -488,16 +488,48 @@ export default { } }, watch: { - dialogVisible(newVal) { - if(newVal){ - // this.$nextTick(() => { - // let doc = document.querySelector('.welcome-message') - // let sendBox = document.querySelector('.input-area-wrapper'); - // doc.style.height = `calc(600px - ${sendBox.offsetHeight}px - 120px)`; - // }); - } + dialogVisible: { + handler(newVal) { + if (newVal) { + this.$nextTick(() => { + // 获取对话框元素 + const dialogEl = document.querySelector('.case-expert-dialog .el-dialog'); + if (dialogEl) { + // 检查是否有保存的尺寸状态 + const savedSize = sessionStorage.getItem('aiCallDialogSize'); + if (savedSize) { + const { width, height, left, top } = JSON.parse(savedSize); + dialogEl.style.width = width + 'px'; + dialogEl.style.height = height + 'px'; + dialogEl.style.left = left + 'px'; + dialogEl.style.top = top + 'px'; + } - // 移除之前的逻辑,因为现在通过事件机制处理状态恢复 + // 检查是否有保存的位置状态 + const savedPosition = sessionStorage.getItem('aiCallDialogPosition'); + if (savedPosition) { + const { left, top } = JSON.parse(savedPosition); + dialogEl.style.left = left + 'px'; + dialogEl.style.top = top + 'px'; + } + } + + let doc = document.querySelector('.welcome-message') + let sendBox = document.querySelector('.input-area-wrapper'); + // 只有在没有保存的尺寸状态时才使用默认值 + if (doc && sendBox) { + const savedSize = sessionStorage.getItem('aiCallDialogSize'); + if (!savedSize) { + doc.style.height = `calc(600px - ${sendBox.offsetHeight}px - 120px)`; + } else { + const { height } = JSON.parse(savedSize); + doc.style.height = `calc(${height}px - ${sendBox.offsetHeight}px - 120px)`; + } + } + }); + } + }, + immediate: true }, messageList: { handler() {