From bcee5cd49c38973e2c6c316e1405f27ab1b74db7 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期五, 16 八月 2024 15:42:55 +0800
Subject: [PATCH] 体育与健康pdf

---
 src/views/readerPages/home.vue |  180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 172 insertions(+), 8 deletions(-)

diff --git a/src/views/readerPages/home.vue b/src/views/readerPages/home.vue
index 47ca510..f42ac05 100644
--- a/src/views/readerPages/home.vue
+++ b/src/views/readerPages/home.vue
@@ -1,30 +1,194 @@
 <template>
   <div class="homePage">
-    <webHome v-if="!homeBoxHide"/>
-    <mobileHome v-if="homeBoxHide"/>
+    <webHome v-if="!homeBoxHide" />
+    <mobileHome v-if="homeBoxHide" />
+  </div>
+  <div class="pdfDialog">
+    <el-dialog v-model="dialogState.dialogVisible" width="60vw" top="2vh" lock-scroll :show-close="false"
+      class="custom-dialog">
+      <template #header>
+        <div class="header_title">
+          <span>{{ dialogState.pdfTitle }}</span>
+          <span @click="dialogState.dialogVisible = false"> x </span>
+        </div>
+      </template>
+      <div class="pdfModal" v-if="dialogState.dialogVisible">
+        <preView :isClear="dialogState.dialogVisible" :md5="dialogState.p_md5"></preView>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script setup lang="ts">
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, reactive, inject } from 'vue'
 import webHome from '@/views//readerPages/webHome.vue'
 import mobileHome from '@/views//readerPages/mobileHome.vue'
+import preView from '../components/pdfview.vue'
+// import { da } from 'element-plus/es/locale'
+const qiankunActions = inject('qiankunActions')
 const screenWidth = ref(
   window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
 )
 const homeBoxHide = ref(false)
-
+const dialogState = reactive({
+  dialogVisible: false,
+  pdfTitle: '',
+  isClear: false,
+  p_md5: ''
+})
 onMounted(() => {
   if (screenWidth.value < 420) {
     homeBoxHide.value = true
-  }else{
+  } else {
     homeBoxHide.value = false
   }
+  window.qiankunActions.setGlobalState({
+    openPDF: (data) => {
+      console.log('鐖跺簲鐢�', data)
+      if (data.data.md5) {
+        const { md5, title } = data.data
+        dialogState.p_md5 = md5
+        dialogState.pdfTitle = title
+      }
+      dialogState.dialogVisible = true
+    }
+  })
 })
 </script>
 
 <style lang="less">
-.homePage{
-    width:100%;
-    height:100%;
+.homePage {
+  width: 100%;
+  height: 100%;
+}
+
+
+.el-dialog {
+  padding: 0;
+}
+
+
+.el-dialog__header {
+  background-color: rgba(0, 0, 0, 0.8);
+  padding: 0;
+  padding: 10px 0;
+
+  .header_title {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    color: #fff;
+    font-weight: 900;
+    font-size: 16px;
+    font-family: 'FZLTXIHJW';
+    padding: 5px 20px;
+    box-sizing: border-box;
+
+    span:nth-child(2):hover {
+      cursor: pointer;
+    }
+  }
+
+  .el-dialog__title,
+  .el-dialog__headerbtn .el-dialog__close {
+    color: #fff;
+    font-weight: 900;
+    font-size: 16px;
+    font-family: 'FZLTXIHJW';
+  }
+}
+
+
+
+
+
+
+
+
+.pdfModal {
+  width: 100%;
+  height: 90vh;
+
+  .pdfBox-component {
+    width: 100%;
+    height: 100%;
+    position: relative;
+
+    .preview {
+      width: 100%;
+      height: 100%;
+
+      .imageBox {
+        height: calc(100% - 30px);
+        overflow-x: hidden;
+        overflow-y: auto;
+        background: #ccc;
+        box-sizing: border-box;
+
+        img {
+          margin: 0 auto;
+          display: flex;
+          justify-content: center;
+        }
+
+      }
+
+      .imageBox:hover {
+        cursor: zoom-in !important;
+      }
+
+      ::v-deep .el-dialog__header {
+        background-color: rgba(0, 0, 0, 0.8);
+
+        .header_title {
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+          color: #fff;
+          font-weight: 900;
+          font-size: 16px;
+          font-family: 'FZLTXIHJW';
+
+          span:nth-child(2):hover {
+            cursor: pointer;
+          }
+        }
+
+        ::v-deep .el-dialog__title,
+        ::v-deep .el-dialog__headerbtn .el-dialog__close {
+          color: #fff;
+          font-weight: 900;
+          font-size: 16px;
+          font-family: 'FZLTXIHJW';
+        }
+      }
+
+      .bottom_tool {
+        height: 30px;
+        background-color: rgba(0, 0, 0, 0.8);
+        display: flex;
+        justify-content: flex-end;
+        align-items: center;
+
+        svg {
+          margin-right: 15px;
+          fill: #d1d1d1;
+        }
+
+        svg:hover {
+          fill: #fff;
+          cursor: pointer;
+        }
+      }
+    }
+
+    .notBox {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: calc(100% - 30px);
+      min-height: 300px;
+    }
+  }
 }
 </style>

--
Gitblit v1.9.1