Files
PropertyDeployment/resources/Web/MicroCommunityMallWeb/html/js/chunk-17aba150.a20da58a.js
Anfioo adfd019d2d 江门
1
2026-02-01 15:37:55 +08:00

2 lines
2.7 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-17aba150"],{"08f1":function(e,i,t){"use strict";t("4837")},4837:function(e,i,t){},"6ddd":function(e,i,t){"use strict";t.r(i);var s=function(){var e=this,i=e._self._c;return i("div",[i("img",{directives:[{name:"show",rawName:"v-show",value:e.showImage,expression:"showImage"}],staticClass:"thumbnail",staticStyle:{width:"100%",position:"absolute",top:"0",left:"0",height:"100%"},attrs:{id:"imgView",src:e.advertVedioViewInfo.imgUrl}}),i("video",{directives:[{name:"show",rawName:"v-show",value:!e.showImage,expression:"!showImage"}],ref:"videoPlayer",staticStyle:{"object-fit":"fill",width:"100%",height:"100%"},attrs:{id:"videoView",src:"",volume:"true"}})])},r=[],o=t("b775"),d=t("7323");function a(e){return new Promise((i,t)=>{Object(o["a"])({url:"/advertVedioView/list",method:"get",params:{...e,shopId:Object(d["f"])()}}).then(e=>{const t=e.data;i(t)}).catch(e=>{t(e)})})}var h={name:"AdvertVedioView",data(){return{curr:0,imagePlayTime:1e4,showImage:!0,advertVedioViewInfo:{imgUrl:"",notices:"",imgsAndVideos:[],words:""},videoPlayer:null}},mounted(){this.initVideoPlayer(),this.setVideoHeight(),this.loadAdvertVedioData()},methods:{initVideoPlayer(){this.videoPlayer=this.$refs.videoPlayer,this.videoPlayer.onended=this.handleVideoEnded},setVideoHeight(){const e=document.documentElement.clientHeight;this.$refs.videoPlayer.style.height=e+"px"},async loadAdvertVedioData(){const e=this.$route.query.machineCode;if(!e)return void this.$message.error("请求参数中未包含设备编码");const i=Object(d["f"])();if(i)try{const t=await a({machineCode:e,shopId:i}),s=this.refreshAdvertActive(t);this.startInterval(s)}catch(t){console.error("请求失败:",t)}else this.$message.error("请求参数中未包含小区信息")},startInterval(e){this.advertVedioViewInfo.imgsAndVideos=e,this.handleImgVideoUrl(this.advertVedioViewInfo.imgsAndVideos)},handleImgVideoUrl(e){const i=e.map(e=>`${e.suffix}:${e.url}`),t=i[this.curr];if(t.includes("VIDEO:")){this.showImage=!1;const e=t.replace("VIDEO:","");this.videoPlayer.src=e,this.videoPlayer.load(),this.videoPlayer.play()}else{const s=t.replace("JPEG:","");this.advertVedioViewInfo.imgUrl=s,this.showImage=!0,setTimeout(()=>{if(this.curr++,this.curr>=i.length)return this.curr=0,void this.loadAdvertVedioData();this.handleImgVideoUrl(e)},this.imagePlayTime)}},handleVideoEnded(){this.curr++,this.curr>=this.advertVedioViewInfo.imgsAndVideos.length&&(this.curr=0),this.handleImgVideoUrl(this.advertVedioViewInfo.imgsAndVideos)},refreshAdvertActive(e){return e.sort((e,i)=>e.seq-i.seq)}}},n=h,l=(t("08f1"),t("2877")),c=Object(l["a"])(n,s,r,!1,null,"8d7a02da",null);i["default"]=c.exports}}]);
//# sourceMappingURL=chunk-17aba150.a20da58a.js.map