diff --git a/components/full_screen/full_screen.js b/components/full_screen/full_screen.js index 031877f..6a39979 100644 --- a/components/full_screen/full_screen.js +++ b/components/full_screen/full_screen.js @@ -1,4 +1,5 @@ // components/userqy_pop_up/userqy_pop_up.js +var o = getApp().globalData.setting Component({ /** * 页面的初始数据 @@ -8,27 +9,53 @@ Component({ is_full_screen_show:0, //全屏显示 sec_show:3, //倒计时的秒数 full_ad:null, //全屏广告 + url:o.imghost, + full_screen:0, }, + pageLifetimes:{ + //要处理一下,游客登录后的界面的变化,主要还该是改变会员 + show: function () { + var th=this; + th.setData({sec_show:3}); + //--如果有全屏广告的时候-- + if(this.data.is_full_screen_show){ + //--定时关闭-- + th.data.full_screen=setInterval(function(){ + if(!th.data.sec_show) { + clearInterval(th.data.full_screen); + th.close_full_screen(); + return false; + } + th.data.sec_show--; + th.setData({sec_show:th.data.sec_show}); + },1000) + } + }, + hide: function() { + // 页面被隐藏 + clearInterval(this.data.full_screen); + }, + }, + properties: { }, ready: function () { - + this.get_the_full_screen(); }, - methods: { close_full_screen(){ - this.setData({is_full_screen_show:0}); + this.setData({is_full_screen_show:0,sec_show:0}); }, - //跳转到满屏广告的链接 + //-- 跳转到满屏广告的链接 -- go_full_ad(){ - if(!full_ad) return false; - if(!full_ad.ad_weapplink) return false; - getApp().goto(full_ad.ad_weapplink); - }, - - get_the_full_screen(){ + if(!this.data.full_ad) return false; + if(!this.data.full_ad.ad_weapplink) return false; + getApp().goto(this.data.full_ad.ad_weapplink); + this.setData({is_full_screen_show:0}); + }, + get_the_full_screen(){ var th=this; //获取全屏的广告 getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{ @@ -40,14 +67,20 @@ Component({ is_full_screen_show:1, full_ad:res.data.data.pageData[0] }) + + //--定时关闭-- + th.data.full_screen=setInterval(function(){ + if(!th.data.sec_show) { + clearInterval(th.data.full_screen); + th.close_full_screen(); + return false; + } + th.data.sec_show--; + th.setData({sec_show:th.data.sec_show}); + },1000) } }) } - }, - - - - }) \ No newline at end of file diff --git a/components/full_screen/full_screen.wxml b/components/full_screen/full_screen.wxml index 68d95ab..ce01065 100644 --- a/components/full_screen/full_screen.wxml +++ b/components/full_screen/full_screen.wxml @@ -1,6 +1,6 @@ - - 跳过 {{sec_show}} + + 跳过 {{sec_show}} diff --git a/components/full_screen/full_screen.wxss b/components/full_screen/full_screen.wxss index 6225eac..0ed3e59 100644 --- a/components/full_screen/full_screen.wxss +++ b/components/full_screen/full_screen.wxss @@ -14,5 +14,5 @@ float: right; margin-top: 10rpx; margin-right: 10rpx; background-color: gainsboro; width: 120rpx; height: 48rpx; font-size: 28rpx; line-height: 48rpx; - text-align: center; border-radius: 10rpx; + text-align: center; border-radius: 20rpx; } \ No newline at end of file diff --git a/pages/index/index/index.json b/pages/index/index/index.json index 63d46fb..878ab3a 100644 --- a/pages/index/index/index.json +++ b/pages/index/index/index.json @@ -17,7 +17,8 @@ "picMax": "/components/diy_picMax/diy_picMax", "mvideo": "/components/diy_video/diy_video", "service": "/components/diy_service/diy_service", - "scan": "/components/diy_scan/diy_scan" + "scan": "/components/diy_scan/diy_scan", + "full_screen": "/components/full_screen/full_screen" }, "enablePullDownRefresh": false } \ No newline at end of file