LAPTOP-1LHD2FP6\joeny hace 5 meses
padre
commit
a13fb49681
Se han modificado 1 ficheros con 40 adiciones y 13 borrados
  1. 40 13
      src/views/report.vue

+ 40 - 13
src/views/report.vue

@@ -416,7 +416,14 @@
       </div>
     </div>
 
-    <div class="right_menu" :class="{ collapsed: isRightMenuCollapsed || !enableWebSearch }" :style="{ width: rightMenuWidth + 'px' }">
+    <div 
+      class="right_menu" 
+      :class="{ 
+        collapsed: (isRightMenuCollapsed || !enableWebSearch) && 
+                  !(activeTab === 'preview' && attachedFiles.length > 0)
+      }" 
+      :style="{ width: rightMenuWidth + 'px' }"
+    >
       <!-- 添加拖动条 -->
       <div 
         class="resize-handle"
@@ -645,26 +652,22 @@ const toggleMenu = () => {
 
 // 修改右侧菜单切换逻辑
 const toggleRightMenu = () => {
+  // 如果当前是预览标签且有文件,不允许折叠
+  if (activeTab.value === 'preview' && attachedFiles.value.length > 0) {
+    return;
+  }
+  
   isRightMenuCollapsed.value = !isRightMenuCollapsed.value;
   
   if (isRightMenuCollapsed.value) {
-    // 收起菜单时的处理
     if (document.querySelector('.chat')) {
       document.querySelector('.chat').style.right = '0';
     }
   } else {
-    // 展开菜单时的处理
     if (document.querySelector('.chat')) {
       document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
     }
   }
-
-  if (isMobile.value) {
-    document.body.style.overflow = isRightMenuCollapsed.value ? 'auto' : 'hidden';
-    if (!isRightMenuCollapsed.value) {
-      isMenuCollapsed.value = true;
-    }
-  }
 };
 
 // 修改获取文档摘要的方法
@@ -863,6 +866,18 @@ const handleFileUpload = async (event) => {
   } finally {
     isUploading.value = false;
     event.target.value = ""; // 清空input以允许重复上传相同文件
+
+    // 上传完成后,展开右侧面板并切换到文档预览
+    if (attachedFiles.value.length > 0) {
+      isRightMenuCollapsed.value = false;
+      activeTab.value = 'preview';
+      // 更新聊天区域的样式
+      nextTick(() => {
+        if (document.querySelector('.chat')) {
+          document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
+        }
+      });
+    }
   }
 
   if (files.length > 0 && enableWebSearch.value) {
@@ -1185,6 +1200,18 @@ const handleFileDrop = async (event) => {
     console.error("文件上传失败:", error);
   } finally {
     isUploading.value = false;
+    
+    // 上传完成后,展开右侧面板并切换到文档预览
+    if (attachedFiles.value.length > 0) {
+      isRightMenuCollapsed.value = false;
+      activeTab.value = 'preview';
+      // 更新聊天区域的样式
+      nextTick(() => {
+        if (document.querySelector('.chat')) {
+          document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
+        }
+      });
+    }
   }
 
   if (files.length > 0 && enableWebSearch.value) {
@@ -1305,14 +1332,14 @@ const toggleWebSearch = () => {
   enableWebSearch.value = !enableWebSearch.value;
   isSearchEnabled.value = enableWebSearch.value;
   
-  // 当关闭搜索时,自动折叠右侧菜单
-  if (!enableWebSearch.value) {
+  // 只有当当前标签是搜索标签时才折叠面板
+  if (!enableWebSearch.value && activeTab.value === 'search') {
     isRightMenuCollapsed.value = true;
     currentSearchQuery.value = '';
     if (document.querySelector('.chat')) {
       document.querySelector('.chat').style.right = '0';
     }
-  } else if (inputContent.value.trim()) {
+  } else if (enableWebSearch.value && inputContent.value.trim()) {
     isRightMenuCollapsed.value = false;
     currentSearchQuery.value = inputContent.value;
     if (document.querySelector('.chat')) {