shaogen1995 преди 3 години
родител
ревизия
ec8d9cbc9c

+ 11 - 0
webM/package-lock.json

@@ -9,6 +9,7 @@
       "version": "0.1.0",
       "dependencies": {
         "core-js": "^3.6.5",
+        "pdfh5": "^1.4.2",
         "vant": "^2.12.47",
         "vue": "^2.6.11",
         "vue-router": "^3.2.0",
@@ -9612,6 +9613,11 @@
         "node": ">=0.12"
       }
     },
+    "node_modules/pdfh5": {
+      "version": "1.4.2",
+      "resolved": "https://registry.npmmirror.com/pdfh5/-/pdfh5-1.4.2.tgz",
+      "integrity": "sha512-1BL8HIx/EEZowRPBgas7/WokbGEv1gxKNRmmHSimG113178mKxIBH4pxWBc0tj6d25Sy+EwnlQwv9cUUmQa42w=="
+    },
     "node_modules/performance-now": {
       "version": "2.1.0",
       "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz",
@@ -22210,6 +22216,11 @@
         "sha.js": "^2.4.8"
       }
     },
+    "pdfh5": {
+      "version": "1.4.2",
+      "resolved": "https://registry.npmmirror.com/pdfh5/-/pdfh5-1.4.2.tgz",
+      "integrity": "sha512-1BL8HIx/EEZowRPBgas7/WokbGEv1gxKNRmmHSimG113178mKxIBH4pxWBc0tj6d25Sy+EwnlQwv9cUUmQa42w=="
+    },
     "performance-now": {
       "version": "2.1.0",
       "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz",

+ 1 - 0
webM/package.json

@@ -8,6 +8,7 @@
   },
   "dependencies": {
     "core-js": "^3.6.5",
+    "pdfh5": "^1.4.2",
     "vant": "^2.12.47",
     "vue": "^2.6.11",
     "vue-router": "^3.2.0",

BIN
webM/public/data/Pdf/1.pdf


BIN
webM/public/data/Pdf/2.pdf


Файловите разлики са ограничени, защото са твърде много
+ 1087936 - 0
webM/public/data/Pdf/3.pdf


BIN
webM/public/data/Pdf/4.pdf


BIN
webM/public/data/Pdf/5.pdf


BIN
webM/public/data/Pdf/6.pdf


+ 65 - 5
webM/src/views/Publications/lookPdf.vue

@@ -1,14 +1,53 @@
 <template>
-  <div class="lookPdf">lookPdf</div>
+  <div class="lookPdf">
+    <div id="pdf"></div>
+  </div>
 </template>
 
 <script>
+import Pdfh5 from "pdfh5";
+import "pdfh5/css/pdfh5.css";
 export default {
   name: "lookPdf",
   components: {},
   data() {
     //这里存放数据
-    return {};
+    return {
+      imgList: [
+        {
+          id: 1,
+          imgUrl: "/data/Publications/Exhibition/1.jpg",
+          name: "A_brief_history_of_Beijing.pdf",
+        },
+        {
+          id: 2,
+          imgUrl: "/data/Publications/Exhibition/2.jpg",
+          name: "Geneva.pdf",
+        },
+        {
+          id: 3,
+          imgUrl: "/data/Publications/Exhibition/3.jpg",
+          name: "Renaissance.pdf",
+        },
+        {
+          id: 4,
+          imgUrl: "/data/Publications/Exhibition/4.jpg",
+          name: "TheMetropolisesandtheProsperities.pdf",
+        },
+        {
+          id: 5,
+          imgUrl: "/data/Publications/Exhibition/5.jpg",
+          name: "Andes.pdf",
+        },
+        {
+          id: 6,
+          imgUrl: "/data/Publications/Exhibition/6.jpg",
+          name: "smileofkhmer.pdf",
+        },
+      ],
+      info: {},
+      loding: true,
+    };
   },
   //监听属性 类似于data概念
   computed: {},
@@ -18,25 +57,46 @@ export default {
   methods: {},
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    // 获取id
+    let id = this.$route.query.id;
+    id = Number(id);
+    this.imgList.forEach((v) => {
+      if (v.id === id) this.info = v;
+    });
     // 隐藏底部
     this.$nextTick(() => {
       setTimeout(() => {
         let dom = document.querySelector(".Layout .bottom");
         dom.style.display = "none";
+        document.title = this.info.name;
       }, 100);
     });
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
+  mounted() {
+    new Pdfh5("#pdf", {
+      pdfurl: `/data/Pdf/${this.info.id}.pdf`,
+      goto: 1,
+      lazy: true,
+    });
+  },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
-  destroyed() {}, //生命周期 - 销毁完成
+  destroyed() {
+    let dom = document.querySelector(".Layout .bottom");
+    dom.style.display = "";
+  }, //生命周期 - 销毁完成
   activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style lang='less' scoped>
-//@import url(); 引入公共css类
+.lookPdf {
+  position: relative;
+  padding-top: 50px;
+  width: 100vw;
+  height: 100vh;
+}
 </style>