فهرست منبع

更改文件查看器的头部定位方式

yangdr 1 ماه پیش
والد
کامیت
dc7d1e10e9
3فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 2 2
      .env.development
  2. 7 3
      src/components/FileViewer/FileViewer.vue
  3. 1 1
      src/views/KMPlatform/Home/Home.vue

+ 2 - 2
.env.development

@@ -1,4 +1,4 @@
 NODE_ENV = development
-# VITE_API_URL = http://173.18.12.205:8005
-VITE_API_URL = http://192.18.1.242:8000
+VITE_API_URL = http://173.18.12.205:8005
+# VITE_API_URL = http://192.18.1.242:8000
 # VITE_API_URL = http://192.18.1.235:8000

+ 7 - 3
src/components/FileViewer/FileViewer.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="document-viewer">
     <div class="mask"></div>
-    <div ref="containerRef" class="container" :style="{ width: props.width + 'px' }">
-      <div class="top" ref="topRef">
+    <div ref="containerRef" class="container"
+      :style="{ width: props.width + 'px', paddingTop: containerSize.offset + 'px' }">
+      <div class="top" ref="topRef" :style="{ width: props.width + 'px' }">
         <span v-show="props.fileName" class="file-name">{{ props.fileName }}</span>
         <span class="close">
           <el-icon @click="emit('closeViewer')">
@@ -46,6 +47,7 @@ const emit = defineEmits(['closeViewer'])
 const topRef = ref()
 const containerRef = ref() //.containerd的ref
 let containerSize = ref({
+  offset: 0,
   width: 0,
   height: 0,
 })
@@ -75,6 +77,7 @@ function errorHandler() {
 const handleResize = () => {
   console.log(containerRef.value.offsetHeight, topRef.value.offsetHeight)
   containerSize.value = {
+    offset: topRef.value.offsetHeight,
     width: containerRef.value.offsetWidth,
     height: containerRef.value.offsetHeight - topRef.value.offsetHeight - 3
   }
@@ -171,7 +174,8 @@ onBeforeUnmount(() => {
       background-color: white;
       clear: both;
       padding: 5px 10px;
-      position: sticky;
+      position: fixed;
+      // width: 100%;
       z-index: 65;
       top: 0px;
       // bottom: -1000000000px;

+ 1 - 1
src/views/KMPlatform/Home/Home.vue

@@ -89,7 +89,7 @@ watchEffect(() => {
 
 function handleModuleClick(path: string) {
   if (/^https?/g.test(path)) {
-    path = 'http://localhost:8081/home.html'
+    // path = 'http://localhost:8081/home.html'
     const newWindow = window.open(path, '_blank');
     timer = setInterval(() => {
       newWindow?.postMessage({ type: 'login', username: getSessionVar("full_name"), userId: getSessionVar("user_id") }, "*")