Explorar el Código

bugfix:补全index

XieXing hace 4 meses
padre
commit
49feb4934c

+ 31 - 7
shudao-vue-frontend/src/components/MobilePdfViewer.vue

@@ -146,13 +146,11 @@ onUnmounted(() => {
 .mobile-pdf-viewer {
   width: 100%;
   height: 100%;
-  min-height: 300px;
   background-color: #f3f4f6;
   position: relative;
-  overflow-y: auto;
-  -webkit-overflow-scrolling: touch;
-  touch-action: pan-y;
-  overscroll-behavior: contain;
+  display: flex;
+  flex-direction: column;
+  overflow: hidden;
 }
 
 .loading-container, .error-container {
@@ -162,7 +160,6 @@ onUnmounted(() => {
   justify-content: center;
   padding: 40px 20px;
   text-align: center;
-  height: 100%;
 }
 
 .loading-spinner {
@@ -212,9 +209,36 @@ onUnmounted(() => {
 
 .pdf-container {
   width: 100%;
-  min-height: 100%;
+  height: 100%;
   padding: 10px;
   box-sizing: border-box;
+  overflow-y: auto;
+  overflow-x: hidden;
+  -webkit-overflow-scrolling: touch;
+  /* 确保移动端滚动流畅 */
+  overscroll-behavior: contain;
+  /* 防止滚动穿透到父元素 */
+  touch-action: pan-y;
+  /* 只允许垂直滑动 */
+}
+
+/* 自定义滚动条样式(仅在支持的浏览器中显示) */
+.pdf-container::-webkit-scrollbar {
+  width: 6px;
+}
+
+.pdf-container::-webkit-scrollbar-track {
+  background: rgba(0, 0, 0, 0.05);
+  border-radius: 3px;
+}
+
+.pdf-container::-webkit-scrollbar-thumb {
+  background: rgba(0, 0, 0, 0.2);
+  border-radius: 3px;
+}
+
+.pdf-container::-webkit-scrollbar-thumb:hover {
+  background: rgba(0, 0, 0, 0.3);
 }
 
 @keyframes spin {

+ 6 - 31
shudao-vue-frontend/src/views/mobile/m-PolicyDocument.vue

@@ -193,7 +193,7 @@
 </template>
 
 <script setup>
-import { ref, computed, onMounted, onUnmounted, watch } from "vue";
+import { ref, computed, onMounted, onUnmounted } from "vue";
 import { useRouter } from "vue-router";
 import MobileHeader from "@/components/MobileHeader.vue";
 import MobilePdfViewer from "@/components/MobilePdfViewer.vue";
@@ -406,38 +406,10 @@ onMounted(() => {
     fetchPolicyFiles();
 });
 
-// 滚动位置存储
-let savedScrollPosition = 0;
-
-const lockBodyScroll = () => {
-    savedScrollPosition = window.scrollY;
-    document.body.style.position = 'fixed';
-    document.body.style.top = `-${savedScrollPosition}px`;
-    document.body.style.width = '100%';
-    document.body.style.overflow = 'hidden';
-};
-
-const unlockBodyScroll = () => {
-    document.body.style.position = '';
-    document.body.style.top = '';
-    document.body.style.width = '';
-    document.body.style.overflow = '';
-    window.scrollTo(0, savedScrollPosition);
-};
-
 onUnmounted(() => {
-    unlockBodyScroll();
     if (scrollTimer) clearTimeout(scrollTimer);
     if (searchTimer) clearTimeout(searchTimer);
 });
-
-watch(previewVisible, (val) => {
-    if (val) {
-        lockBodyScroll();
-    } else {
-        unlockBodyScroll();
-    }
-});
 </script>
 
 <style lang="less" scoped>
@@ -828,15 +800,18 @@ watch(previewVisible, (val) => {
 .preview-body {
     flex: 1;
     background: #111827;
-    position: relative;
+    display: flex;
+    align-items: center;
+    justify-content: center;
     overflow: hidden;
+    /* 防止内容溢出 */
+    position: relative;
 }
 
 .preview-frame {
     width: 100%;
     height: 100%;
     border: none;
-    display: block;
 }
 
 .preview-placeholder {