jinx 9 mēneši atpakaļ
vecāks
revīzija
2dd2daf713

+ 9 - 2
public/html/model.html

@@ -24,12 +24,19 @@
       // fdage.embed(`../model/${m}.4dage`, {
       fdage.embed(`../model/${decodeURIComponent(m)}`, {
         transparentBackground: true,
-        width: 800,
-        height: 600,
+        // width: 800,
+        // height: 600,
         autoStart: true,
         fullFrame: true,
         pagePreset: false,
       });
+      document.addEventListener("model_loaded", function (event) {
+        window.parent.postMessage({ action: "model_loaded" }, "*");
+      });
+      // console.error(window.modelLoding);
+      // setTimeout(() => {
+      //   console.error(window.modelLoding);
+      // }, 5000);
     </script>
   </body>
 </html>

+ 2 - 2
public/index.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-    <title></title>
+    <title>红军长征过丽江纪念馆</title>
     <meta name="description" content="四维时代" />
     <meta property="og:title" content="四维时代" />
     <meta property="og:description" content="四维时代" />
@@ -15,6 +15,6 @@
 
   <body>
     <div id="app"></div>
-    <script src="<%= VUE_APP_STATIC_DIR %>/lib/4dage.js"></script>
+    <!-- <script src="<%= VUE_APP_STATIC_DIR %>/lib/4dage.js"></script> -->
   </body>
 </html>

+ 8 - 1
public/lib/4dage.js

@@ -6269,7 +6269,14 @@ fdage = {
                 //     dom.style.opacity = 0
                 //     dom.style.pointerEvents = 'none'
                 // }, 500);
-
+                const myEvent = new CustomEvent('model_loaded', {
+                  detail: { message: 'model is loadedfinish!' },
+                  bubbles: true, // 事件是否冒泡
+                  cancelable: true // 是否可以取消事件的默认行为
+                });
+                 
+                // 触发事件
+                document.dispatchEvent(myEvent);
                 this.scene.view.updateView(),
                     this.ui.showActiveView(),
                     this.requestFrame(this.update.bind(this)),

+ 0 - 14
public/数据结构.txt

@@ -1,14 +0,0 @@
-model文件夹用于存放三维文物模型文件
-
-
-thumb 文件夹用于存放封面图。
-    mode:三维文物封面图;
-    pano:全景漫游封面图;
-    scene:场景探索封面图;
-
-
-json文件是存放整个json数据
-
-
-
-

+ 8 - 1
src/pages/antiques/index.vue

@@ -247,11 +247,13 @@ export default {
           height: 70px;
           background-image: url(../../assets/images/icon-back.png);
           background-repeat: no-repeat;
+          background-position: center;
           background-size: 100%;
           cursor: pointer;
         }
         .logo {
           margin-left: 20px;
+          // max-width: 203px;
         }
         .options-bar {
           height: 100%;
@@ -296,10 +298,15 @@ export default {
                 position: absolute;
                 background: url(../../assets/images/lingxing1.png) no-repeat;
                 background-size: 100%;
-                right: -0.4333rem;
+                right: -35px;
                 top: 50%;
                 transform: translateY(-50%);
               }
+              &:last-of-type {
+                &::before {
+                  display: none;
+                }
+              }
               &.active {
                 font-weight: bold;
                 &::after {

+ 69 - 29
src/pages/detail/model.vue

@@ -2,14 +2,17 @@
 <template>
   <div class="model-box" :class="{ isMobile }">
     <div class="close-btn" @click="onClose"></div>
-    <div class="control-bar">
+    <div class="control-bar" :class="{ bottom: isMobile && isFullscreen }" v-if="modelLoaded">
       <template v-for="(i, index) in controls">
         <div class="item" @click="onClickBar(i)" :style="`background-image:url(${i.url});`"></div>
       </template>
     </div>
     <div class="model-content">
-      <div class="model-view">
-        <iframe id="ifr" :src="`/html/model.html?m=${encodeURIComponent(info.fileName)}`" frameborder="0"></iframe>
+      <div class="model-view" :class="{ full: isFullscreen }">
+        <!-- <div class="model-view"> -->
+        <div class="frame-box">
+          <iframe id="ifr" :src="`/html/model.html?m=${encodeURIComponent(info.fileName)}`" frameborder="0"></iframe>
+        </div>
       </div>
       <div class="model-text">
         <p class="title">{{ info.name }}</p>
@@ -31,7 +34,7 @@ export default {
     return {
       isMobile: browser.mobile,
       isFullscreen: false,
-
+      modelLoaded: false,
       num: 0,
       controls: [
         { url: require("@/assets/images/bigger.png"), name: "big" },
@@ -73,29 +76,29 @@ export default {
       }
     },
     onFullScreen() {
-      let element = document.documentElement;
-      if (this.isFullscreen) {
-        if (document.exitFullscreen) {
-          document.exitFullscreen();
-        } else if (document.webkitCancelFullScreen) {
-          document.webkitCancelFullScreen();
-        } else if (document.mozCancelFullScreen) {
-          document.mozCancelFullScreen();
-        } else if (document.msExitFullscreen) {
-          document.msExitFullscreen();
-        }
-      } else {
-        if (element.requestFullscreen) {
-          element.requestFullscreen();
-        } else if (element.webkitRequestFullScreen) {
-          element.webkitRequestFullScreen();
-        } else if (element.mozRequestFullScreen) {
-          element.mozRequestFullScreen();
-        } else if (element.msRequestFullscreen) {
-          element.msRequestFullscreen();
-        }
-      }
-      // 改变当前全屏状态
+      this.isFullscreen = !this.isFullscreen;
+      // let element = document.documentElement;
+      // if (this.isFullscreen) {
+      //   if (document.exitFullscreen) {
+      //     document.exitFullscreen();
+      //   } else if (document.webkitCancelFullScreen) {
+      //     document.webkitCancelFullScreen();
+      //   } else if (document.mozCancelFullScreen) {
+      //     document.mozCancelFullScreen();
+      //   } else if (document.msExitFullscreen) {
+      //     document.msExitFullscreen();
+      //   }
+      // } else {
+      //   if (element.requestFullscreen) {
+      //     element.requestFullscreen();
+      //   } else if (element.webkitRequestFullScreen) {
+      //     element.webkitRequestFullScreen();
+      //   } else if (element.mozRequestFullScreen) {
+      //     element.mozRequestFullScreen();
+      //   } else if (element.msRequestFullscreen) {
+      //     element.msRequestFullscreen();
+      //   }
+      // }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -111,6 +114,18 @@ export default {
         this.isFullscreen = !this.isFullscreen;
       });
     });
+
+    window.addEventListener(
+      "message",
+      (e) => {
+        if (e.data) {
+          if (e.data.action == "model_loaded") {
+            this.modelLoaded = true;
+          }
+        }
+      },
+      false
+    );
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
@@ -136,6 +151,7 @@ export default {
     width: 32px;
     right: 40px;
     bottom: 100px;
+    z-index: 101;
     .item {
       width: 32px;
       height: 32px;
@@ -153,6 +169,7 @@ export default {
     top: 60px;
     position: absolute;
     cursor: pointer;
+    z-index: 99;
   }
   .model-content {
     width: 50%;
@@ -166,9 +183,29 @@ export default {
       flex-direction: column;
       width: 100%;
       height: 70%;
-      iframe {
+      .frame-box {
         width: 100%;
         height: 100%;
+        iframe {
+          width: 100%;
+          height: 100%;
+        }
+      }
+
+      &.full {
+        .frame-box {
+          background: rgba(0, 0, 0, 0.5);
+          backdrop-filter: blur(10px);
+          position: fixed;
+          z-index: 100;
+          width: 100%;
+          height: 100%;
+          left: 0;
+          top: 0;
+          // animation: full_model 0.3s;
+          iframe {
+          }
+        }
       }
     }
     .model-text {
@@ -183,7 +220,7 @@ export default {
         font-size: 14px;
         color: rgba(255, 255, 255, 0.6);
         line-height: 32px;
-        text-align: justified;
+        text-align: justify;
       }
     }
   }
@@ -205,6 +242,9 @@ export default {
       left: 50%;
       transform: translateX(-50%);
       bottom: 30%;
+      &.bottom {
+        bottom: 0.5333rem;
+      }
     }
     .model-content {
       width: 100%;