|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="home" @click="autoplay" @touchstart="autoplay">
|
|
|
+ <div class="home" @click="autoplay" @touchstart="autoplay" @touchend='huadong'>
|
|
|
<audio
|
|
|
v-if="audio"
|
|
|
class="audio"
|
|
@@ -43,10 +43,12 @@
|
|
|
controls
|
|
|
autoplay
|
|
|
></video>
|
|
|
+
|
|
|
+ <!-- :src="fixUrl(item)" -->
|
|
|
<iframe
|
|
|
@click="colseParent()"
|
|
|
v-else
|
|
|
- :src="fixUrl(item)"
|
|
|
+ :src="fixUrl(myFim[i])"
|
|
|
frameborder="0"
|
|
|
></iframe>
|
|
|
</div>
|
|
@@ -102,6 +104,7 @@ export default {
|
|
|
name: "Home",
|
|
|
data() {
|
|
|
return {
|
|
|
+ myFim:[],
|
|
|
videoLength:true,
|
|
|
loadAuto: false,
|
|
|
audio: "",
|
|
@@ -165,6 +168,21 @@ export default {
|
|
|
SwiperSlide,
|
|
|
},
|
|
|
methods: {
|
|
|
+ huadong(){
|
|
|
+ // console.log(666);
|
|
|
+ //点击的时候才加载,防止一次运行过多iframe标签导致页面崩溃
|
|
|
+ let myFim =document.querySelectorAll('.swiper-wrapper .swiper-slide')
|
|
|
+ let myFimCente =document.querySelectorAll('.swiper-wrapper .swiper-slide-active iframe')
|
|
|
+ myFim.forEach((v,i)=>{
|
|
|
+ //拿到当前在屏幕中间的iframe
|
|
|
+ if(v.className.includes('swiper-slide-active') && i>1) {
|
|
|
+ // console.log(myFimCente[0].src);
|
|
|
+ if(myFimCente[0].src){
|
|
|
+ myFimCente[0].src =this.fixUrl(this.data.model[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
autoplay() {
|
|
|
if (this.loadAuto) {
|
|
|
return;
|
|
@@ -178,11 +196,22 @@ export default {
|
|
|
},
|
|
|
async getData() {
|
|
|
// http://192.168.0.44:8110
|
|
|
- let url = `http://192.168.0.44:8110/data/${
|
|
|
+ let url = `http://192.168.0.44:8110/data//${
|
|
|
this.id
|
|
|
}/hot/js/data.js?time=${Math.random()}`;
|
|
|
let result = (await this.$http.get(url)).data;
|
|
|
this.data = result[this.m];
|
|
|
+
|
|
|
+
|
|
|
+ //进页面只让iframe加载2个
|
|
|
+ // console.log(9999999,this.data.model);
|
|
|
+ if(this.data.model){
|
|
|
+ this.myFim[0]=this.data.model[0]
|
|
|
+ this.myFim[1]=this.data.model[1]
|
|
|
+ }
|
|
|
+ // this.myFim=this.data.model
|
|
|
+
|
|
|
+
|
|
|
if (!this.data) {
|
|
|
return alert("热点解析错误");
|
|
|
}
|
|
@@ -206,10 +235,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
fixUrl(item) {
|
|
|
- return 'http://192.168.0.44:8110/'+item;
|
|
|
+ return 'http://192.168.0.44:8110'+item;
|
|
|
},
|
|
|
slideto(action) {
|
|
|
this.swiper[action]();
|
|
|
+
|
|
|
+
|
|
|
+ //点击的时候才加载,防止一次运行过多iframe标签导致页面崩溃
|
|
|
+ let myFim =document.querySelectorAll('.swiper-wrapper .swiper-slide')
|
|
|
+ let myFimCente =document.querySelectorAll('.swiper-wrapper .swiper-slide-active iframe')
|
|
|
+ myFim.forEach((v,i)=>{
|
|
|
+ //拿到当前在屏幕中间的iframe
|
|
|
+ if(v.className.includes('swiper-slide-active') && i>1) {
|
|
|
+ // console.log(myFimCente[0].src);
|
|
|
+ if(myFimCente[0].src){
|
|
|
+ myFimCente[0].src =this.fixUrl(this.data.model[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
@@ -217,7 +260,7 @@ export default {
|
|
|
setTimeout(() => {
|
|
|
let videos =document.querySelectorAll('.slide video')
|
|
|
let Imgs =document.querySelectorAll('.slide img')
|
|
|
- console.log(11111,Imgs.length);
|
|
|
+ // console.log(11111,Imgs.length);
|
|
|
if(videos.length===1 || Imgs.length===1) this.videoLength = false
|
|
|
|
|
|
}, 100);
|
|
@@ -376,6 +419,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
@media screen and (max-width: 1000px) {
|
|
|
+ .swiper-pagination-fraction, .swiper-pagination-custom, .swiper-container-horizontal > .swiper-pagination-bullets{
|
|
|
+ bottom: 240px;
|
|
|
+ }
|
|
|
.home {
|
|
|
background: url('../assets/images/Mbac.png') no-repeat center;
|
|
|
background-size: cover;
|
|
@@ -400,7 +446,7 @@ export default {
|
|
|
}
|
|
|
iframe {
|
|
|
width: 100%;
|
|
|
- height: 100vh;
|
|
|
+ height: 55vh;
|
|
|
}
|
|
|
}
|
|
|
}
|