Commit c84026a4cbbce562d4a5a86806715df2f22cbe3c

Authored by yvan.ni
1 parent 51c3bb3b

小程序全屏广告

components/full_screen/filter.wxs 0 → 100644
  1 +var format = function (text) {
  2 +
  3 + if (!text) {
  4 + return
  5 + }
  6 + var reg = getRegExp('\\\\n', 'g')
  7 + return text.replace(reg, '\n')
  8 +}
  9 +
  10 +module.exports = {
  11 + format: format
  12 +}
components/full_screen/full_screen.js 0 → 100644
  1 +// components/userqy_pop_up/userqy_pop_up.js
  2 +Component({
  3 + /**
  4 + * 页面的初始数据
  5 + */
  6 + data: {
  7 + control: 1,
  8 + is_full_screen_show:0, //全屏显示
  9 + sec_show:3, //倒计时的秒数
  10 + full_ad:null, //全屏广告
  11 + },
  12 +
  13 + properties: {
  14 +
  15 + },
  16 + ready: function () {
  17 +
  18 + },
  19 +
  20 + methods: {
  21 + close_full_screen(){
  22 + this.setData({is_full_screen_show:0});
  23 + },
  24 + //跳转到满屏广告的链接
  25 + go_full_ad(){
  26 + if(!full_ad) return false;
  27 + if(!full_ad.ad_weapplink) return false;
  28 + getApp().goto(full_ad.ad_weapplink);
  29 + },
  30 +
  31 + get_the_full_screen(){
  32 + var th=this;
  33 + //获取全屏的广告
  34 + getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{
  35 + data: { enabled: 1 }
  36 + }).then(res=>{
  37 + //判断是不是有全屏广告
  38 + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
  39 + th.setData({
  40 + is_full_screen_show:1,
  41 + full_ad:res.data.data.pageData[0]
  42 + })
  43 + }
  44 + })
  45 + }
  46 +
  47 + },
  48 +
  49 +
  50 +
  51 +
  52 +
  53 +})
0 \ No newline at end of file 54 \ No newline at end of file
components/full_screen/full_screen.json 0 → 100644
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
0 \ No newline at end of file 5 \ No newline at end of file
components/full_screen/full_screen.wxml 0 → 100644
  1 +<!-- 全屏控制 -->
  2 +<view wx:if="{{is_full_screen_show}}" class="full_screen" bindtap="go_full_ad" style="background-image: url('{{url+full_ad.code}}');">
  3 + <view catchtap="close_full_screen" class="full_show_box">跳过 <text>{{sec_show}}</text></view>
  4 +</view>
  5 +
  6 +
  7 +
components/full_screen/full_screen.wxss 0 → 100644
  1 +.full_screen{
  2 + position: fixed;left: 0;top: 0;
  3 + z-index: 1000000000000;
  4 + background-color: rgba(0,0,0,0.4);
  5 + width: 100%;
  6 + height: 100%;
  7 + background-position: center;
  8 + background-size: cover;
  9 + background-repeat: no-repeat;
  10 +}
  11 +
  12 +
  13 +.skip_box{
  14 + float: right; margin-top: 10rpx; margin-right: 10rpx;
  15 + background-color: gainsboro; width: 120rpx;
  16 + height: 48rpx; font-size: 28rpx; line-height: 48rpx;
  17 + text-align: center; border-radius: 10rpx;
  18 + }
0 \ No newline at end of file 19 \ No newline at end of file