Bläddra i källkod

feat(文件查看):文件查看

sufan 3 månader sedan
förälder
incheckning
3672f133e2

+ 2 - 2
src/components/Upload/index.vue

@@ -452,8 +452,8 @@ export default {
         const newName = `预览图片${fileType || type}`
         window.open(`#/perview?fileId=${idNum}&absolutePath=${absolutePath}&name=${newName}`)
       } else {
-        window.open(`#/perview/pdf?fileId=${idNum}&resource=${fileType ? 0 : 1}`)
-        // window.open(`${process.env.VUE_APP_BASE_API}/system/fileStorage/preview?fileId=${idNum}&resource=${fileType ? 0 : 1}#toolbar=0&navpanes=0&scrollbar=0`)
+        // window.open(`#/perview/pdf?fileId=${idNum}&resource=${fileType ? 0 : 1}`)
+        window.open(`${process.env.VUE_APP_BASE_API}/system/fileStorage/preview?fileId=${idNum}&resource=${fileType ? 0 : 1}#toolbar=0&navpanes=0&scrollbar=0`)
       }
     },
     downloadClick(row) {

+ 1 - 1
src/views/myBusiness/supplementaryInfo/components/AddInfo.vue

@@ -225,7 +225,7 @@ export default {
           prop: 'name',
           ruleRequired: true,
           render: (h, row) => {
-            return row.typeStr === '实控人' ? <el-input disabled={this.disabled} v-model={ row.name} placeholder='请输入姓名'></el-input> : <span>{row.name}</span>
+            return row.typeStr === '实控人' || row.typeStr === '大股东' ? <el-input disabled={this.disabled} v-model={ row.name} placeholder='请输入姓名'></el-input> : <span>{row.name}</span>
           }
         },
         {

+ 42 - 11
src/views/perview/pdf.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="pdf-box">
-    <iframe id="pdfIframe" :src="url" frameborder="0" style="width: 100%; height: 100vh; z-index: 0; position: relative;" @contextmenu.prevent />
-    <!-- <div class="pdf-mark" @contextmenu.prevent /> -->
+    <iframe id="pdfIframe" :src="url" frameborder="0" />
+    <!-- <div class="pdf-mark" @contextmenu="markClick" /> -->
   </div>
 </template>
 
@@ -17,11 +17,26 @@ export default {
     this.url = `${process.env.VUE_APP_BASE_API}/system/fileStorage/preview?fileId=${fileId}&resource=${resource}#toolbar=0&navpanes=0&scrollbar=0`
   },
   mounted() {
-    console.log(window.frames['pdfIframe'].contentWindow, 8888)
-    console.log(window.frames['pdfIframe'].contentDocument.getElementById('viewer'), 11111111)
-    console.log(window.frames['pdfIframe'].document, 2222)
-    window.frames['pdfIframe'].contentDocument.body.oncontextmenu = function() {
-      return false
+    setTimeout(() => {
+      // const iframe = document.getElementById('pdfIframe')
+      // const iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindo
+      // console.log(iframeWin.document.getElementById('viewer'))
+      // console.log(iframe.height = iframeWin.document.getElementById('viewer').scrollHeight
+      // )
+      // iframeWin.document.getElementById('viewer').addEventListener('contextmenu', function(event) {
+      //   event.preventDefault()
+      //   return false
+      // })
+    }, 1000)
+
+    // const mask = document.querySelector('.pdf-mark')
+    // mask.addEventListener('scroll', function(params) {
+    //   iframe.scrollTop = mask.scrollTop
+    // })
+  },
+  methods: {
+    markClick() {
+      console.log(213123123)
     }
   }
 }
@@ -29,9 +44,25 @@ export default {
 
 <style lang="scss" scoped>
 .pdf-box {
-  width: 100vw;
-  height: 100vh;
-  overflow: hidden;
-  opacity: 0.99;
+  width: 100%;
+  height: 100%;
+  overflow: auto;
+  position: relative;
+  iframe {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    border: none;
+  }
+  .pdf-mark {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 100%;
+    height: 100%;
+    background-color: rgba(0, 0, 0, 0.5); /* 半透明遮罩 */
+    overflow: auto;
+    // pointer-events: none; /* 防止遮罩阻止鼠标事件 */
+  }
 }
 </style>