// components/userqy_pop_up/userqy_pop_up.js var o = getApp().globalData.setting Component({ /** * 页面的初始数据 */ data: { control: 1, is_full_screen_show:0, //全屏显示 sec_show:3, //倒计时的秒数 full_ad:null, //全屏广告 url:o.imghost, full_screen:0, is_full_screen_men:1, hidden:0, }, pageLifetimes:{ hide: function() { // 页面被隐藏 clearInterval(this.data.full_screen); }, }, ready: function () {}, properties: {}, methods: { close_full_screen(){ this.setData({is_full_screen_show:0,sec_show:0}); }, //-- 跳转到满屏广告的链接 -- go_full_ad(){ if(!this.data.full_ad) return false; if(!this.data.full_ad.ad_weapplink) return false; getApp().goto(this.data.full_ad.ad_weapplink); }, get_the_full_screen(){ if(this.data.full_ad) { return false; } var th=this; //获取全屏的广告 getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{ data: { enabled: 1 } }).then(res=>{ //判断是不是有全屏广告 if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ th.setData({ 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) } }) } }, })