full_screen.js
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
}
})
}
}