diff --git a/pages/index/index/full_screen.js b/pages/index/index/full_screen.js
new file mode 100644
index 0000000..16cf312
--- /dev/null
+++ b/pages/index/index/full_screen.js
@@ -0,0 +1,31 @@
+ module.exports = {
+ //判断要不要显示全屏广告
+ get_the_full_screen(th){
+ var stoid=getApp().globalData.setting.stoid;
+ 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){
+ 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)
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index 4fcd618..da34677 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -15,6 +15,7 @@ var regeneratorRuntime = require('../../../utils/runtime.js');
var api = require('../../../api/api.js');
var d = getApp().globalData;
+var full_screen = require('full_screen.js');
Page({
data: {
@@ -75,13 +76,17 @@ Page({
showHongbao: false,
showHongbaoSmall: false,
-
+
+ is_full_screen_show:0, //全屏显示
+ sec_show:3, //倒计时的秒数
+ full_ad:null, //全屏广告
+ full_screen:0, //全屏广告
+
},
onLoad: async function(tt) {
console.log("进入首页-------------");
- console.log(tt);
-
+ console.log(tt);
var th = this;
var first_leader=tt.first_leader;
if(!first_leader && tt.scene){
@@ -97,7 +102,7 @@ Page({
getApp().globalData.guide_id=res.data.data.id;
}
})
- }
+ }
// 判断是否有红包活动
getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/'+getApp().globalData.setting.stoid, {
@@ -146,7 +151,6 @@ Page({
await this.init_load();
-
//显示的时候要开启计时器
this.data.is_timer = 1;
//如果是自定义模板
@@ -255,9 +259,8 @@ Page({
if(!userInfo || !userInfo.user_id) userInfo=null;
//有加载过一次首页,就显示
if(show || userInfo || getApp().globalData.user_id){
- setTimeout(function(){
- var full_screen = th.selectComponent("#full_screen"); //组件的id
- full_screen.get_the_full_screen();
+ setTimeout(function(){
+ full_screen.get_the_full_screen(th);
},800)
//动画效果
if(!th.data.f_hidden){
@@ -282,6 +285,8 @@ Page({
this.data.is_timer = 0;
clearInterval(this.data.pt_timer);
clearInterval(this.data.w_holiday_pop);
+ clearInterval(this.data.full_screen);
+
this.data.w_holiday_pop=0;
for(var i = 1; i < 100; i++) {
clearInterval(i);
@@ -1005,5 +1010,17 @@ Page({
showHongbaoSmall: true, //显示抢红包小图标
});
},
+
+ /*-- 全屏广告 --*/
+ 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);
+ this.close_full_screen();
+ },
});
\ No newline at end of file
diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml
index fcec284..3d62bcf 100644
--- a/pages/index/index/index.wxml
+++ b/pages/index/index/index.wxml
@@ -1,5 +1,11 @@
-
+
+
+
+
+ 跳过 {{sec_show}}
+
+
diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss
index b28ea57..2ed7fee 100644
--- a/pages/index/index/index.wxss
+++ b/pages/index/index/index.wxss
@@ -977,3 +977,9 @@ page {
background-size: 100% 100%;
background-repeat: no-repeat;
}
+.skip_box{
+ 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: 20rpx;
+ }