|
@@ -3,55 +3,99 @@
|
|
|
<div class="main">
|
|
|
<div class="myTitle">{{ myTitle }}</div>
|
|
|
<div class="mainCon" v-show="!oneTxt">
|
|
|
- <audio id="myAudio" v-if="audio" v-show="isOneAduio" :src="urlToFitFu(audio)" controls></audio>
|
|
|
+ <audio
|
|
|
+ id="myAudio"
|
|
|
+ v-if="audio"
|
|
|
+ v-show="isOneAduio"
|
|
|
+ :src="urlToFitFu(audio)"
|
|
|
+ controls
|
|
|
+ ></audio>
|
|
|
<!-- 如果只有一个模块 -->
|
|
|
- <div class="oneTabNum" v-if="
|
|
|
+ <!-- <div class="oneTabNum" v-if="
|
|
|
flooTab.length === 1 &&
|
|
|
data[myType] &&
|
|
|
data[myType].length &&
|
|
|
data[myType].length > 1
|
|
|
">
|
|
|
{{ myInd + 1 }} / {{ data[myType].length }}
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
|
|
|
<!-- 主要内容 -->
|
|
|
|
|
|
- <div class="contenBoxMain">
|
|
|
- <div class="contenBox" :class="{ contenBoxAc: index === myInd }" v-for="(item, index) in data[myType]"
|
|
|
- :key="myType === 'video' ? item.url : item">
|
|
|
- <!-- 模型页面 -->
|
|
|
- <div class="modelBox" v-if="myType === 'model'">
|
|
|
- <iframe :src="urlToFitFu(item)" frameborder="0" v-if="index === myInd"></iframe>
|
|
|
- </div>
|
|
|
- <!-- 视频页面 -->
|
|
|
- <div class="videoBox" v-else-if="myType === 'video'">
|
|
|
- <video controls controlslist="nodownload" :src="urlToFitFu(item.url)" v-if="index === myInd"></video>
|
|
|
- </div>
|
|
|
- <!-- 图片页面 -->
|
|
|
- <div class="imgBox" v-else-if="myType === 'img'">
|
|
|
- <div class="smImgBox" @click="lookImg(urlToFitFu(item))">
|
|
|
- <img v-lazy="urlToFitFu(item)" alt="" />
|
|
|
+ <div class="contenBoxMain swiper-container">
|
|
|
+ <div class="swiper-wrapper">
|
|
|
+ <div
|
|
|
+ class="contenBox swiper-slide"
|
|
|
+ v-for="(item, index) in data[myType]"
|
|
|
+ :key="myType === 'video' ? item.url : item"
|
|
|
+ >
|
|
|
+ <!-- 模型页面 -->
|
|
|
+ <div class="modelBox" v-if="myType === 'model'">
|
|
|
+ <iframe
|
|
|
+ :src="urlToFitFu(item)"
|
|
|
+ frameborder="0"
|
|
|
+ v-if="index === myInd"
|
|
|
+ ></iframe>
|
|
|
+ </div>
|
|
|
+ <!-- 视频页面 -->
|
|
|
+ <div class="videoBox" v-else-if="myType === 'video'">
|
|
|
+ <video
|
|
|
+ controls
|
|
|
+ controlslist="nodownload"
|
|
|
+ :src="urlToFitFu(item.url)"
|
|
|
+ v-if="index === myInd"
|
|
|
+ ></video>
|
|
|
+ </div>
|
|
|
+ <!-- 图片页面 -->
|
|
|
+ <div class="imgBox" v-else-if="myType === 'img'">
|
|
|
+ <div class="smImgBox">
|
|
|
+ <img
|
|
|
+ v-lazy="urlToFitFu(item)"
|
|
|
+ alt=""
|
|
|
+ @click="lookImg(urlToFitFu(item))"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 左右箭头 -->
|
|
|
- <div @click="cutMyInd(-1, myInd === 0)" class="leftJJ awccJJ" :class="{ noClick: myInd === 0 }"
|
|
|
- v-if="data[myType] && data[myType].length > 1"></div>
|
|
|
- <div @click="cutMyInd(1, myInd === data[myType].length - 1)" class="rightJJ awccJJ"
|
|
|
- :class="{ noClick: myInd === data[myType].length - 1 }" v-if="data[myType] && data[myType].length > 1">
|
|
|
- </div>
|
|
|
+ <template v-if="!isMobile">
|
|
|
+ <div
|
|
|
+ @click="cutMyInd(-1, myInd === 0)"
|
|
|
+ class="leftJJ awccJJ"
|
|
|
+ :class="{ noClick: myInd === 0 }"
|
|
|
+ v-if="data[myType] && data[myType].length > 1"
|
|
|
+ ></div>
|
|
|
+ <div
|
|
|
+ @click="cutMyInd(1, myInd === data[myType].length - 1)"
|
|
|
+ class="rightJJ awccJJ"
|
|
|
+ :class="{ noClick: myInd === data[myType].length - 1 }"
|
|
|
+ v-if="data[myType] && data[myType].length > 1"
|
|
|
+ ></div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <div
|
|
|
+ class="swiper-pagination"
|
|
|
+ v-if="data[myType] && data[myType].length > 1"
|
|
|
+ ></div>
|
|
|
+
|
|
|
<!-- 下面的文字介绍 -->
|
|
|
<div class="flooTxt" :class="{ flooTxtOne: oneTxt }">
|
|
|
<div class="flooTxtBox">
|
|
|
<!-- <div class="myTitle">{{ myTitle }}</div> -->
|
|
|
<!-- 视频的介绍 -->
|
|
|
- <div class="myTxt" v-if="myType === 'video' && videoTxt[myInd]" v-html="videoTxt[myInd]">
|
|
|
- </div>
|
|
|
- <div class="myTxt" v-if="myType === 'img' && imgTxt[myInd]" v-html="imgTxt[myInd]">
|
|
|
- </div>
|
|
|
+ <div
|
|
|
+ class="myTxt"
|
|
|
+ v-if="myType === 'video' && videoTxt[myInd]"
|
|
|
+ v-html="videoTxt[myInd]"
|
|
|
+ ></div>
|
|
|
+ <div
|
|
|
+ class="myTxt"
|
|
|
+ v-if="myType === 'img' && imgTxt[myInd]"
|
|
|
+ v-html="imgTxt[myInd]"
|
|
|
+ ></div>
|
|
|
<div class="myTxt" v-html="myTxt"></div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -63,24 +107,45 @@
|
|
|
|
|
|
<!-- 底部的tab -->
|
|
|
<div class="flooTabBox" v-if="flooTab.length > 1">
|
|
|
- <div @click="myType = item.type" class="tabRow" :class="{ tabRowAc: myType === item.type }"
|
|
|
- v-for="item in flooTab" :key="item.id">
|
|
|
- <img :src="require(`@/assets/images/pc/icon${item.id}${myType === item.type ? 'Ac' : ''
|
|
|
- }.png`)
|
|
|
- " alt="" />
|
|
|
+ <div
|
|
|
+ @click="myType = item.type"
|
|
|
+ class="tabRow"
|
|
|
+ :class="{ tabRowAc: myType === item.type }"
|
|
|
+ v-for="item in flooTab"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="
|
|
|
+ require(`@/assets/images/pc/icon${item.id}${
|
|
|
+ myType === item.type ? 'Ac' : ''
|
|
|
+ }.png`)
|
|
|
+ "
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
<div>
|
|
|
{{ item.name }}
|
|
|
- <span v-if="
|
|
|
- data[item.type] &&
|
|
|
- data[item.type].length &&
|
|
|
- data[item.type].length > 1
|
|
|
- ">{{ item.type === myType ? myInd + 1 + "/" : null
|
|
|
- }}{{ data[item.type].length }}</span>
|
|
|
+ <span
|
|
|
+ v-if="
|
|
|
+ data[item.type] &&
|
|
|
+ data[item.type].length &&
|
|
|
+ data[item.type].length > 1
|
|
|
+ "
|
|
|
+ >{{ item.type === myType ? myInd + 1 + "/" : null
|
|
|
+ }}{{ data[item.type].length }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 音频图标 -->
|
|
|
- <div class="tabRow" v-if="audio && !isOneAduio" @click="audioSta = !audioSta" :title="audioSta ? '关闭音频' : '打开音频'">
|
|
|
- <img :src="require(`@/assets/images/pc/audio${audioSta ? 'Ac' : ''}.png`)" alt="" />
|
|
|
+ <div
|
|
|
+ class="tabRow"
|
|
|
+ v-if="audio && !isOneAduio"
|
|
|
+ @click="audioSta = !audioSta"
|
|
|
+ :title="audioSta ? '关闭音频' : '打开音频'"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="require(`@/assets/images/pc/audio${audioSta ? 'Ac' : ''}.png`)"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
<div>音频</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -88,10 +153,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import Swiper from "swiper";
|
|
|
+import "swiper/css/swiper.min.css";
|
|
|
+
|
|
|
export default {
|
|
|
name: "Home",
|
|
|
+ components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isMobile: /iPhone|iPad|iPod|Android/i.test(navigator.userAgent),
|
|
|
m: this.$route.query.m,
|
|
|
id: this.$route.query.id,
|
|
|
// 音频地址
|
|
@@ -131,52 +201,56 @@ export default {
|
|
|
|
|
|
// 只有标题和文字(没有视频,没有模型,没有图片)
|
|
|
oneTxt: false,
|
|
|
- baseUrl: ''
|
|
|
- }
|
|
|
+ baseUrl: "",
|
|
|
+ };
|
|
|
},
|
|
|
watch: {
|
|
|
myType() {
|
|
|
- this.myInd = 0
|
|
|
+ this.myInd = 0;
|
|
|
},
|
|
|
// 音频的开启和关闭
|
|
|
audioSta(val) {
|
|
|
- const dom = document.querySelector("#myAudio")
|
|
|
+ const dom = document.querySelector("#myAudio");
|
|
|
if (val) {
|
|
|
- dom.play()
|
|
|
+ dom.play();
|
|
|
dom.onended = () => {
|
|
|
// console.log("----音频播放完毕");
|
|
|
- this.audioSta = false
|
|
|
- }
|
|
|
- } else dom.pause()
|
|
|
+ this.audioSta = false;
|
|
|
+ };
|
|
|
+ } else dom.pause();
|
|
|
},
|
|
|
},
|
|
|
computed: {},
|
|
|
- components: {},
|
|
|
methods: {
|
|
|
// 本地化 url 适配
|
|
|
urlToFitFu(url) {
|
|
|
- // return url
|
|
|
- const resUrl = url
|
|
|
+ // return url;
|
|
|
+ const resUrl = url;
|
|
|
if (url.includes("https://super.4dage.com")) {
|
|
|
- return url.replace("https://super.4dage.com", this.baseUrl)
|
|
|
+ return url.replace("https://super.4dage.com", this.baseUrl);
|
|
|
} else if (url.includes("http://super.4dage.com")) {
|
|
|
- return url.replace("http://super.4dage.com", this.baseUrl)
|
|
|
- } else return resUrl
|
|
|
+ return url.replace("http://super.4dage.com", this.baseUrl);
|
|
|
+ } else return resUrl;
|
|
|
},
|
|
|
|
|
|
// 点击左右箭头
|
|
|
- cutMyInd(num, flag) {
|
|
|
- if (flag) return
|
|
|
- this.myInd += num
|
|
|
+ cutMyInd(num) {
|
|
|
+ console.log(num, this.swiper);
|
|
|
+ if (!this.swiper) return;
|
|
|
+ if (num > 0) {
|
|
|
+ this.swiper.slideNext();
|
|
|
+ } else {
|
|
|
+ this.swiper.slidePrev();
|
|
|
+ }
|
|
|
},
|
|
|
// 点击查看大图
|
|
|
lookImg(url) {
|
|
|
// console.log(url)
|
|
|
- let dom = this.$refs.viewer.$viewer
|
|
|
- this.lookPics = [url]
|
|
|
+ let dom = this.$refs.viewer.$viewer;
|
|
|
+ this.lookPics = [url];
|
|
|
// console.log(Object.keys(dom))
|
|
|
- dom.options.toolbar = false
|
|
|
- dom.show()
|
|
|
+ dom.options.toolbar = false;
|
|
|
+ dom.show();
|
|
|
},
|
|
|
async getData() {
|
|
|
// https://www.4dmodel.com/
|
|
@@ -184,15 +258,15 @@ export default {
|
|
|
// let url = `https://super.4dage.com/data/${
|
|
|
// 线上数据
|
|
|
|
|
|
- let url = `${this.baseUrl}data/${
|
|
|
+ let url = `../scene/data/${
|
|
|
//本地化部署
|
|
|
this.id
|
|
|
- }/hot/js/data.js?time=${Math.random()}`
|
|
|
- let result = (await this.$http.get(url)).data
|
|
|
- const resData = result[this.m]
|
|
|
+ }/hot/js/data.js?time=${Math.random()}`;
|
|
|
+ let result = (await this.$http.get(url)).data;
|
|
|
+ const resData = result[this.m];
|
|
|
// console.log("----", resData);
|
|
|
if (resData) {
|
|
|
- this.audio = resData.backgroundMusic
|
|
|
+ this.audio = resData.backgroundMusic;
|
|
|
// 只有单独的音频上传
|
|
|
if (
|
|
|
resData.backgroundMusic &&
|
|
@@ -200,50 +274,62 @@ export default {
|
|
|
!resData.video &&
|
|
|
!resData.images
|
|
|
) {
|
|
|
- this.isOneAduio = true
|
|
|
+ this.isOneAduio = true;
|
|
|
}
|
|
|
// 底部的tab
|
|
|
- const arr = []
|
|
|
- const obj = {}
|
|
|
+ const arr = [];
|
|
|
+ const obj = {};
|
|
|
if (resData.model) {
|
|
|
- obj.model = resData.model
|
|
|
- arr.push({ id: 1, type: "model", name: "模型" })
|
|
|
+ obj.model = resData.model;
|
|
|
+ arr.push({ id: 1, type: "model", name: "模型" });
|
|
|
}
|
|
|
if (resData.video) {
|
|
|
- obj.video = resData.video
|
|
|
- arr.push({ id: 2, type: "video", name: "视频" })
|
|
|
+ obj.video = resData.video;
|
|
|
+ arr.push({ id: 2, type: "video", name: "视频" });
|
|
|
}
|
|
|
if (resData.images) {
|
|
|
- obj.img = resData.images
|
|
|
- arr.push({ id: 3, type: "img", name: "图片" })
|
|
|
+ obj.img = resData.images;
|
|
|
+ arr.push({ id: 3, type: "img", name: "图片" });
|
|
|
}
|
|
|
- this.flooTab = arr
|
|
|
- this.data = obj
|
|
|
+ this.flooTab = arr;
|
|
|
+ this.data = obj;
|
|
|
|
|
|
// 当前type的值 应该为
|
|
|
- if (resData.model) this.myType = "model"
|
|
|
- else if (resData.video) this.myType = "video"
|
|
|
- else if (resData.images) this.myType = "img"
|
|
|
+ if (resData.model) this.myType = "model";
|
|
|
+ else if (resData.video) this.myType = "video";
|
|
|
+ else if (resData.images) this.myType = "img";
|
|
|
|
|
|
- this.myTitle = resData.title || ""
|
|
|
- this.myTxt = resData.content || ""
|
|
|
- this.videoTxt = resData.videosDesc || []
|
|
|
- this.imgTxt = resData.imagesDesc || []
|
|
|
+ this.myTitle = resData.title || "";
|
|
|
+ this.myTxt = resData.content || "";
|
|
|
+ this.videoTxt = resData.videosDesc || [];
|
|
|
+ this.imgTxt = resData.imagesDesc || [];
|
|
|
|
|
|
// 只有 标题和 文字介绍(没有视频,没有模型,没有图片)
|
|
|
if (!obj.model && !obj.video && !obj.img && !resData.backgroundMusic) {
|
|
|
- this.oneTxt = true
|
|
|
+ this.oneTxt = true;
|
|
|
}
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const _this = this;
|
|
|
+ this.swiper = new Swiper(".contenBoxMain", {
|
|
|
+ on: {
|
|
|
+ slideChange() {
|
|
|
+ _this.myInd = this.activeIndex;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ el: ".swiper-pagination",
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.baseUrl = window.location.href.split('hot')[0] + 'scene/'
|
|
|
-
|
|
|
-
|
|
|
- this.getData()
|
|
|
+ this.baseUrl = window.location.href.split("hot")[0] + "scene/";
|
|
|
+ this.getData();
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -253,15 +339,31 @@ export default {
|
|
|
background-size: 100% 100%;
|
|
|
border-radius: 10px;
|
|
|
color: rgba(80, 61, 42, 0.9);
|
|
|
+ .swiper-pagination {
|
|
|
+ margin: 10px 0 0;
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ gap: 6px;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ :deep(.swiper-pagination-bullet) {
|
|
|
+ width: 24px;
|
|
|
+ height: 4px;
|
|
|
+ border-radius: 2px;
|
|
|
+ background: #66442c49;
|
|
|
+ opacity: 1;
|
|
|
+
|
|
|
+ &.swiper-pagination-bullet-active {
|
|
|
+ background: #603c23;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
.viewerCla img {
|
|
|
display: none;
|
|
|
}
|
|
|
- position: relative;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);
|
|
|
- width: 60%;
|
|
|
- height: 65%;
|
|
|
+ height: 100%;
|
|
|
position: relative;
|
|
|
#myAudio {
|
|
|
z-index: 11;
|
|
@@ -292,7 +394,7 @@ export default {
|
|
|
border-radius: 6px;
|
|
|
overflow: hidden;
|
|
|
width: 100%;
|
|
|
- height: calc(100% - 200px);
|
|
|
+ height: calc(100% - 300px);
|
|
|
.oneTabNum {
|
|
|
z-index: 10;
|
|
|
position: absolute;
|
|
@@ -308,15 +410,6 @@ export default {
|
|
|
height: 100%;
|
|
|
}
|
|
|
.contenBox {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- opacity: 0;
|
|
|
- pointer-events: none;
|
|
|
- transition: all 0.5s;
|
|
|
-
|
|
|
.modelBox,
|
|
|
.videoBox,
|
|
|
.imgBox {
|
|
@@ -343,7 +436,6 @@ export default {
|
|
|
height: 100%;
|
|
|
// cursor: zoom-in;
|
|
|
& > img {
|
|
|
- pointer-events: none;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
object-fit: contain;
|
|
@@ -351,27 +443,24 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .contenBoxAc {
|
|
|
- opacity: 1;
|
|
|
- pointer-events: auto;
|
|
|
- }
|
|
|
.awccJJ {
|
|
|
cursor: pointer;
|
|
|
position: absolute;
|
|
|
top: 50%;
|
|
|
transform: translateY(-50%);
|
|
|
- left: 10px;
|
|
|
- width: 30px;
|
|
|
- height: 40px;
|
|
|
+ left: 30px;
|
|
|
+ width: 16px;
|
|
|
+ height: 30px;
|
|
|
background-image: url("../assets/images/pc/left.png");
|
|
|
background-size: 100% 100%;
|
|
|
+ z-index: 1;
|
|
|
&:focus {
|
|
|
outline: none;
|
|
|
}
|
|
|
}
|
|
|
.rightJJ {
|
|
|
left: auto;
|
|
|
- right: 10px;
|
|
|
+ right: 30px;
|
|
|
background-image: url("../assets/images/pc/right.png");
|
|
|
}
|
|
|
.noClick {
|
|
@@ -381,9 +470,10 @@ export default {
|
|
|
}
|
|
|
.flooTxt {
|
|
|
margin: 0 auto;
|
|
|
- margin-top: 20px;
|
|
|
+ margin-top: 10px;
|
|
|
width: 70%;
|
|
|
- max-height: 120px;
|
|
|
+ height: 100%;
|
|
|
+ max-height: 200px;
|
|
|
.flooTxtBox {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -457,11 +547,17 @@ export default {
|
|
|
// 移动端
|
|
|
@media screen and (max-width: 1000px) {
|
|
|
.home {
|
|
|
- width: 90%;
|
|
|
- height: 55%;
|
|
|
background: url("../assets/images/pc/hot_bg_M.png") no-repeat center center;
|
|
|
background-size: cover !important;
|
|
|
- transform: translate(-50%, -65%);
|
|
|
+ .swiper-pagination {
|
|
|
+ margin: 10px 0 0;
|
|
|
+ gap: 4px;
|
|
|
+
|
|
|
+ :deep(.swiper-pagination-bullet) {
|
|
|
+ width: 15px;
|
|
|
+ height: 3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
#myAudio {
|
|
|
width: 90vw;
|
|
|
max-width: 500px;
|
|
@@ -473,6 +569,7 @@ export default {
|
|
|
position: absolute;
|
|
|
.myTitle {
|
|
|
font-size: 16px;
|
|
|
+ margin: 8px 0;
|
|
|
}
|
|
|
.mainCon {
|
|
|
border-radius: 0;
|
|
@@ -516,9 +613,10 @@ export default {
|
|
|
margin-top: -5px;
|
|
|
width: 100%;
|
|
|
padding: 10px 15px 0px 15px;
|
|
|
- max-height: 98px;
|
|
|
+ max-height: 250px;
|
|
|
|
|
|
.flooTxtBox {
|
|
|
+ padding: 0;
|
|
|
.myTxt {
|
|
|
font-size: 14px;
|
|
|
line-height: 22px;
|