|
@@ -2,14 +2,17 @@
|
|
<template>
|
|
<template>
|
|
<div class="model-box" :class="{ isMobile }">
|
|
<div class="model-box" :class="{ isMobile }">
|
|
<div class="close-btn" @click="onClose"></div>
|
|
<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">
|
|
<template v-for="(i, index) in controls">
|
|
<div class="item" @click="onClickBar(i)" :style="`background-image:url(${i.url});`"></div>
|
|
<div class="item" @click="onClickBar(i)" :style="`background-image:url(${i.url});`"></div>
|
|
</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
<div class="model-content">
|
|
<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>
|
|
<div class="model-text">
|
|
<div class="model-text">
|
|
<p class="title">{{ info.name }}</p>
|
|
<p class="title">{{ info.name }}</p>
|
|
@@ -31,7 +34,7 @@ export default {
|
|
return {
|
|
return {
|
|
isMobile: browser.mobile,
|
|
isMobile: browser.mobile,
|
|
isFullscreen: false,
|
|
isFullscreen: false,
|
|
-
|
|
|
|
|
|
+ modelLoaded: false,
|
|
num: 0,
|
|
num: 0,
|
|
controls: [
|
|
controls: [
|
|
{ url: require("@/assets/images/bigger.png"), name: "big" },
|
|
{ url: require("@/assets/images/bigger.png"), name: "big" },
|
|
@@ -73,29 +76,29 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onFullScreen() {
|
|
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实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -111,6 +114,18 @@ export default {
|
|
this.isFullscreen = !this.isFullscreen;
|
|
this.isFullscreen = !this.isFullscreen;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ window.addEventListener(
|
|
|
|
+ "message",
|
|
|
|
+ (e) => {
|
|
|
|
+ if (e.data) {
|
|
|
|
+ if (e.data.action == "model_loaded") {
|
|
|
|
+ this.modelLoaded = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ false
|
|
|
|
+ );
|
|
},
|
|
},
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
@@ -136,6 +151,7 @@ export default {
|
|
width: 32px;
|
|
width: 32px;
|
|
right: 40px;
|
|
right: 40px;
|
|
bottom: 100px;
|
|
bottom: 100px;
|
|
|
|
+ z-index: 101;
|
|
.item {
|
|
.item {
|
|
width: 32px;
|
|
width: 32px;
|
|
height: 32px;
|
|
height: 32px;
|
|
@@ -153,6 +169,7 @@ export default {
|
|
top: 60px;
|
|
top: 60px;
|
|
position: absolute;
|
|
position: absolute;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
+ z-index: 99;
|
|
}
|
|
}
|
|
.model-content {
|
|
.model-content {
|
|
width: 50%;
|
|
width: 50%;
|
|
@@ -166,9 +183,29 @@ export default {
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 70%;
|
|
height: 70%;
|
|
- iframe {
|
|
|
|
|
|
+ .frame-box {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 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 {
|
|
.model-text {
|
|
@@ -183,7 +220,7 @@ export default {
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
color: rgba(255, 255, 255, 0.6);
|
|
color: rgba(255, 255, 255, 0.6);
|
|
line-height: 32px;
|
|
line-height: 32px;
|
|
- text-align: justified;
|
|
|
|
|
|
+ text-align: justify;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -205,6 +242,9 @@ export default {
|
|
left: 50%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
transform: translateX(-50%);
|
|
bottom: 30%;
|
|
bottom: 30%;
|
|
|
|
+ &.bottom {
|
|
|
|
+ bottom: 0.5333rem;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.model-content {
|
|
.model-content {
|
|
width: 100%;
|
|
width: 100%;
|