ソースを参照

bugfix:补全index

XieXing 4 ヶ月 前
コミット
8d2622765d

+ 0 - 6
shudao-vue-frontend/src/components/FileReportCard.vue

@@ -241,18 +241,12 @@ const openSourceUrl = () => {
 }
 }
 
 
 const openFile = () => {
 const openFile = () => {
-  console.log('📄 [FileReportCard] openFile 被调用')
-  console.log('📄 [FileReportCard] file_path:', props.report.file_path)
-  
   if (props.report.file_path) {
   if (props.report.file_path) {
     const fileName = props.report.report?.display_name || props.report.source_file || '未命名文件'
     const fileName = props.report.report?.display_name || props.report.source_file || '未命名文件'
-    console.log('📄 [FileReportCard] emit preview-file, fileName:', fileName)
     emit('preview-file', {
     emit('preview-file', {
       filePath: props.report.file_path,
       filePath: props.report.file_path,
       fileName: fileName
       fileName: fileName
     })
     })
-  } else {
-    console.warn('⚠️ [FileReportCard] file_path 为空')
   }
   }
 }
 }
 
 

+ 39 - 13
shudao-vue-frontend/src/components/MobilePdfViewer.vue

@@ -45,11 +45,15 @@ const loading = ref(true);
 const error = ref(null);
 const error = ref(null);
 const progress = ref(0);
 const progress = ref(0);
 const pdfContainer = ref(null);
 const pdfContainer = ref(null);
+const currentUrl = ref('');
 let pdfDoc = null;
 let pdfDoc = null;
 
 
 const loadPdf = async () => {
 const loadPdf = async () => {
   if (!props.url) return;
   if (!props.url) return;
+  // 如果正在加载当前URL,或者是已加载完成的URL,则跳过
+  if (loading.value && props.url === currentUrl.value) return;
   
   
+  currentUrl.value = props.url;
   loading.value = true;
   loading.value = true;
   error.value = null;
   error.value = null;
   progress.value = 0;
   progress.value = 0;
@@ -79,12 +83,14 @@ const loadPdf = async () => {
     loading.value = false;
     loading.value = false;
   } catch (err) {
   } catch (err) {
     console.error('PDF 加载失败:', err);
     console.error('PDF 加载失败:', err);
-    error.value = '文档加载失败,请稍后重试或尝试下载查看';
+    error.value = '文档加载失败,请稍后重试';
     loading.value = false;
     loading.value = false;
   }
   }
 };
 };
 
 
 const renderPage = async (pageNum) => {
 const renderPage = async (pageNum) => {
+  if (!pdfDoc) return; // 确保文档存在
+  
   try {
   try {
     const page = await pdfDoc.getPage(pageNum);
     const page = await pdfDoc.getPage(pageNum);
     
     
@@ -124,14 +130,18 @@ const renderPage = async (pageNum) => {
   }
   }
 };
 };
 
 
-watch(() => props.url, () => {
-  loadPdf();
+watch(() => props.url, (newUrl, oldUrl) => {
+  if (newUrl !== oldUrl) {
+    loadPdf();
+  }
 });
 });
 
 
 onMounted(() => {
 onMounted(() => {
   // 稍微延迟加载,确保容器已准备好
   // 稍微延迟加载,确保容器已准备好
   setTimeout(() => {
   setTimeout(() => {
-    loadPdf();
+    if (props.url) {
+      loadPdf();
+    }
   }, 100);
   }, 100);
 });
 });
 
 
@@ -153,28 +163,44 @@ onUnmounted(() => {
   overflow: hidden;
   overflow: hidden;
 }
 }
 
 
-.loading-container, .error-container {
+.loading-container {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
   display: flex;
   display: flex;
   flex-direction: column;
   flex-direction: column;
   align-items: center;
   align-items: center;
   justify-content: center;
   justify-content: center;
-  padding: 40px 20px;
-  text-align: center;
+  z-index: 10;
+  background: rgba(255, 255, 255, 0.8);
+  padding: 20px;
+  border-radius: 12px;
 }
 }
 
 
 .loading-spinner {
 .loading-spinner {
-  width: 40px;
-  height: 40px;
-  border: 4px solid #e5e7eb;
-  border-top: 4px solid #3b82f6;
+  width: 30px;
+  height: 30px;
+  border: 3px solid #e5e7eb;
+  border-top: 3px solid #3b82f6;
   border-radius: 50%;
   border-radius: 50%;
   animation: spin 1s linear infinite;
   animation: spin 1s linear infinite;
-  margin-bottom: 16px;
+  margin-bottom: 8px;
 }
 }
 
 
 .loading-text {
 .loading-text {
   color: #6b7280;
   color: #6b7280;
-  font-size: 14px;
+  font-size: 12px;
+}
+
+.error-container {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  padding: 40px 20px;
+  text-align: center;
+  height: 100%;
 }
 }
 
 
 .error-icon {
 .error-icon {

+ 0 - 5
shudao-vue-frontend/src/views/mobile/m-Chat.vue

@@ -2095,8 +2095,6 @@ const openInNewTab = () => {
 
 
 // 处理文件预览
 // 处理文件预览
 const handleFilePreview = (data) => {
 const handleFilePreview = (data) => {
-  console.log('移动端打开文件预览:', data)
-
   // 重置状态
   // 重置状态
   fileError.value = ''
   fileError.value = ''
   fileLoading.value = false  // 先设为false,让组件能够渲染
   fileLoading.value = false  // 先设为false,让组件能够渲染
@@ -2114,9 +2112,6 @@ const handleFilePreview = (data) => {
     previewFilePath.value = ''
     previewFilePath.value = ''
     previewFileName.value = ''
     previewFileName.value = ''
   }
   }
-
-  console.log('📄 预览文件路径:', previewFilePath.value)
-  console.log('📄 预览文件名:', previewFileName.value)
   
   
   showFilePreview.value = true
   showFilePreview.value = true
 }
 }

+ 1 - 1
shudao-vue-frontend/src/views/mobile/m-Index.vue

@@ -380,7 +380,7 @@ const handleLogout = () => {
     // 根据《移动客户端与H5对接规范》,优先使用 nativeClosePage() 方法
     // 根据《移动客户端与H5对接规范》,优先使用 nativeClosePage() 方法
     if (window.nativeClosePage && typeof window.nativeClosePage === 'function') {
     if (window.nativeClosePage && typeof window.nativeClosePage === 'function') {
       console.log('✅ 检测到 nativeClosePage 方法,准备调用原生接口...')
       console.log('✅ 检测到 nativeClosePage 方法,准备调用原生接口...')
-      window.nativeClosePage()
+      window.bridge.callNative("finishPage");
       console.log('✅ 已成功调用 nativeClosePage()')
       console.log('✅ 已成功调用 nativeClosePage()')
       return
       return
     }
     }