From 3cd892bd364f53010a42b27c304e39024aa36272 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Mon, 25 Jul 2022 15:19:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=8A=E6=97=A5=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/homepage.vue | 61 ++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/src/components/homepage.vue b/src/components/homepage.vue index 452d0ff..a0ef291 100644 --- a/src/components/homepage.vue +++ b/src/components/homepage.vue @@ -161,7 +161,14 @@ babyBirthdayData: 0, babyNotice:0,//宝宝提醒数量 dynamicPictureData: "", - noonArr: [], + noonArr: [ + // { + // Ampm:'上午', + // Content:[ + // {TimePart:'05:32',Name:'阿斯蒂芬'} + // ] + // }, + ], moId:"", model:"", className:'',//班级名称 @@ -229,13 +236,15 @@ EquipmentID: this.$storage.get('EquipmentID') }, }); - if(data.data.data.VideoUrls!=undefined){ - this.videoSrc = data.data.data.VideoUrls; - this.$storage.set('videoSrc',this.videoSrc); - } - if(data.data.data.PictureUrls.length){ - this.classImgArr = data.data.data.PictureUrls; - this.$storage.set('classImgArr',this.classImgArr); + if(data.data.data){ + if(data.data.data.VideoUrls!=undefined){ + this.videoSrc = data.data.data.VideoUrls; + this.$storage.set('videoSrc',this.videoSrc); + } + if(data.data.data.PictureUrls.length){ + this.classImgArr = data.data.data.PictureUrls; + this.$storage.set('classImgArr',this.classImgArr); + } } } else { if(this.$storage.get('videoSrc')!=undefined){ @@ -265,20 +274,28 @@ }, // 滚动动画 scrollEv(){ - this.topVal = 0; - clearInterval(this.monitorTimer); - let parentHeight = $('.right-content').height(); - let childrenHeight = $('#innerbox').height(); - this.diffHeight = childrenHeight - parentHeight; - this.monitorTimer = setInterval(()=>{ - let topFlag = $('#innerbox').position().top; - if(-topFlag*1==0){ - this.upEv(); + if(this.noonArr.length){ + this.topVal = 0; + clearInterval(this.monitorTimer); + let parentHeight = $('.right-content').height(); + let childrenHeight = $('#innerbox').height(); + this.diffHeight = childrenHeight - parentHeight; + let timeLen = 100; + if(this.diffHeight<100){ + timeLen = 500; } - if(-topFlag*1==this.diffHeight*1){ - this.downEv(); + if(childrenHeight>(parentHeight)){ + this.monitorTimer = setInterval(()=>{ + let topFlag = $('#innerbox').position().top; + if(-topFlag*1==0){ + this.upEv(); + } + if(-topFlag*1==this.diffHeight*1){ + this.downEv(); + } + },timeLen) } - },100) + } }, downEv(){ $('#innerbox').animate({top:0+'px'},(this.diffHeight/4)*100,'linear'); @@ -327,7 +344,7 @@ EquipmentID: this.$storage.get('EquipmentID') }, }); - if(data.data.data!=null){ + if(data.data.data){ this.noticeData = data.data.count; this.noticeObj = data.data.data; this.noticeObj.PublishTime = this.noticeObj.PublishTime.slice(0,11); @@ -355,7 +372,7 @@ EquipmentID: this.$storage.get('EquipmentID') }, }); - if(data.data.data!=undefined){ + if(data.data.data){ this.noonArr = data.data.data[0].WeekData; this.$storage.set('noonArr',this.noonArr) this.animate = true;