From c84026a4cbbce562d4a5a86806715df2f22cbe3c Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 29 Jan 2021 13:37:04 +0800 Subject: [PATCH] 小程序全屏广告 --- components/full_screen/filter.wxs | 12 ++++++++++++ components/full_screen/full_screen.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ components/full_screen/full_screen.json | 4 ++++ components/full_screen/full_screen.wxml | 7 +++++++ components/full_screen/full_screen.wxss | 18 ++++++++++++++++++ 5 files changed, 94 insertions(+), 0 deletions(-) create mode 100644 components/full_screen/filter.wxs create mode 100644 components/full_screen/full_screen.js create mode 100644 components/full_screen/full_screen.json create mode 100644 components/full_screen/full_screen.wxml create mode 100644 components/full_screen/full_screen.wxss diff --git a/components/full_screen/filter.wxs b/components/full_screen/filter.wxs new file mode 100644 index 0000000..68e2458 --- /dev/null +++ b/components/full_screen/filter.wxs @@ -0,0 +1,12 @@ +var format = function (text) { + + if (!text) { + return + } + var reg = getRegExp('\\\\n', 'g') + return text.replace(reg, '\n') +} + +module.exports = { + format: format +} diff --git a/components/full_screen/full_screen.js b/components/full_screen/full_screen.js new file mode 100644 index 0000000..031877f --- /dev/null +++ b/components/full_screen/full_screen.js @@ -0,0 +1,53 @@ +// components/userqy_pop_up/userqy_pop_up.js +Component({ + /** + * 页面的初始数据 + */ + data: { + control: 1, + is_full_screen_show:0, //全屏显示 + sec_show:3, //倒计时的秒数 + full_ad:null, //全屏广告 + }, + + properties: { + + }, + ready: function () { + + }, + + methods: { + close_full_screen(){ + this.setData({is_full_screen_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(){ + 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] + }) + } + }) + } + + }, + + + + + +}) \ No newline at end of file diff --git a/components/full_screen/full_screen.json b/components/full_screen/full_screen.json new file mode 100644 index 0000000..a88fc2f --- /dev/null +++ b/components/full_screen/full_screen.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/full_screen/full_screen.wxml b/components/full_screen/full_screen.wxml new file mode 100644 index 0000000..68d95ab --- /dev/null +++ b/components/full_screen/full_screen.wxml @@ -0,0 +1,7 @@ + + + 跳过 {{sec_show}} + + + + diff --git a/components/full_screen/full_screen.wxss b/components/full_screen/full_screen.wxss new file mode 100644 index 0000000..6225eac --- /dev/null +++ b/components/full_screen/full_screen.wxss @@ -0,0 +1,18 @@ +.full_screen{ + position: fixed;left: 0;top: 0; + z-index: 1000000000000; + background-color: rgba(0,0,0,0.4); + width: 100%; + height: 100%; + background-position: center; + background-size: cover; + 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: 10rpx; + } \ No newline at end of file -- libgit2 0.21.4