full_screen.js 1.01 KB
 module.exports = {
	//判断要不要显示全屏广告 
	get_the_full_screen(th){	
		var stoid=getApp().globalData.setting.stoid;
        if(getApp().globalData.full_screen) {
            return false;
        }
		if(th.data.full_ad) {
			return false;		
		}

		//获取全屏的广告
		getApp().promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + stoid,{
			data: { enabled: 1 }
		}).then(res=>{
			//判断是不是有全屏广告
			if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
				getApp().globalData.full_screen=res.data.data.pageData[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)
			}else{
				getApp().globalData.full_screen=true;
			}
		})




	}
}