mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-20 16:26:43 +08:00
feat(AICall): 实现对话框拖拽边界限制并优化显示逻辑
调整了 AI 呼叫页面中对话框的拖拽行为,新增边界检测以防止拖出可视区域。 同时修正内容区域的条件渲染逻辑,确保在不同语言服务状态下的正确显示。
This commit is contained in:
committed by
liu.zixi
parent
a1d5d0f079
commit
85152e2e25
@@ -42,12 +42,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="content-wrapper" v-show="isLan">
|
||||
<div class="content-wrapper" v-show="isLan">
|
||||
<lan-service-checker :value.sync="isLan" />
|
||||
</div>
|
||||
v-show="!isLan" -->
|
||||
<!-- 内容区域 -->
|
||||
<div class="content-wrapper">
|
||||
<div class="content-wrapper" v-show="!isLan">
|
||||
<div
|
||||
class="welcome-message"
|
||||
ref="messageContainer"
|
||||
@@ -230,8 +229,26 @@ export default {
|
||||
const deltaX = event.clientX - startX;
|
||||
const deltaY = event.clientY - startY;
|
||||
|
||||
dialogEl.style.left = startLeft + deltaX + "px";
|
||||
dialogEl.style.top = startTop + deltaY + "px";
|
||||
// 计算新位置
|
||||
let newLeft = startLeft + deltaX;
|
||||
let newTop = startTop + deltaY;
|
||||
|
||||
// 获取对话框尺寸
|
||||
const dialogWidth = dialogEl.offsetWidth;
|
||||
const dialogHeight = dialogEl.offsetHeight;
|
||||
|
||||
// 限制拖拽范围在浏览器可视区域内
|
||||
// 左边界
|
||||
newLeft = Math.max(-500, newLeft);
|
||||
// 右边界
|
||||
newLeft = Math.min(window.innerWidth - dialogWidth, newLeft);
|
||||
// 上边界
|
||||
newTop = Math.max(0, newTop);
|
||||
// 下边界 (确保标题栏始终可见,标题栏高度约为80px)
|
||||
newTop = Math.min(window.innerHeight - 80, newTop);
|
||||
|
||||
dialogEl.style.left = newLeft + "px";
|
||||
dialogEl.style.top = newTop + "px";
|
||||
};
|
||||
|
||||
const stopDrag = () => {
|
||||
|
||||
Reference in New Issue
Block a user