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() {