Commit 0f4ba510ad7f5377ecce7fe57c3a9656311c6da5
1 parent
feecc3ca
1. 白屏的bug优化
Showing
6 changed files
with
41 additions
and
37 deletions
components/full_screen/full_screen.js
| @@ -21,28 +21,23 @@ Component({ | @@ -21,28 +21,23 @@ Component({ | ||
| 21 | clearInterval(this.data.full_screen); | 21 | clearInterval(this.data.full_screen); |
| 22 | }, | 22 | }, |
| 23 | }, | 23 | }, |
| 24 | - | ||
| 25 | - ready: function () { | ||
| 26 | - var th=this; | ||
| 27 | - setTimeout(function(){ | ||
| 28 | - th.setData({hidden:1,}) | ||
| 29 | - },2600) | ||
| 30 | - }, | ||
| 31 | - | 24 | + |
| 25 | + ready: function () {}, | ||
| 32 | properties: {}, | 26 | properties: {}, |
| 33 | methods: { | 27 | methods: { |
| 34 | close_full_screen(){ | 28 | close_full_screen(){ |
| 35 | - this.setData({is_full_screen_show:0,sec_show:0,is_full_screen_men:0}); | 29 | + this.setData({is_full_screen_show:0,sec_show:0}); |
| 36 | }, | 30 | }, |
| 37 | //-- 跳转到满屏广告的链接 -- | 31 | //-- 跳转到满屏广告的链接 -- |
| 38 | go_full_ad(){ | 32 | go_full_ad(){ |
| 39 | if(!this.data.full_ad) return false; | 33 | if(!this.data.full_ad) return false; |
| 40 | if(!this.data.full_ad.ad_weapplink) return false; | 34 | if(!this.data.full_ad.ad_weapplink) return false; |
| 41 | getApp().goto(this.data.full_ad.ad_weapplink); | 35 | getApp().goto(this.data.full_ad.ad_weapplink); |
| 42 | - this.setData({is_full_screen_show:0,is_full_screen_men:0}); | ||
| 43 | }, | 36 | }, |
| 44 | get_the_full_screen(){ | 37 | get_the_full_screen(){ |
| 45 | - if(this.data.full_ad) return false; | 38 | + if(this.data.full_ad) { |
| 39 | + return false; | ||
| 40 | + } | ||
| 46 | var th=this; | 41 | var th=this; |
| 47 | //获取全屏的广告 | 42 | //获取全屏的广告 |
| 48 | getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{ | 43 | getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{ |
| @@ -53,8 +48,7 @@ Component({ | @@ -53,8 +48,7 @@ Component({ | ||
| 53 | th.setData({ | 48 | th.setData({ |
| 54 | is_full_screen_show:1, | 49 | is_full_screen_show:1, |
| 55 | full_ad:res.data.data.pageData[0], | 50 | full_ad:res.data.data.pageData[0], |
| 56 | - }) | ||
| 57 | - | 51 | + }) |
| 58 | //--定时关闭-- | 52 | //--定时关闭-- |
| 59 | th.data.full_screen=setInterval(function(){ | 53 | th.data.full_screen=setInterval(function(){ |
| 60 | if(!th.data.sec_show) { | 54 | if(!th.data.sec_show) { |
| @@ -65,16 +59,8 @@ Component({ | @@ -65,16 +59,8 @@ Component({ | ||
| 65 | th.data.sec_show--; | 59 | th.data.sec_show--; |
| 66 | th.setData({sec_show:th.data.sec_show}); | 60 | th.setData({sec_show:th.data.sec_show}); |
| 67 | },1000) | 61 | },1000) |
| 68 | - | ||
| 69 | - | ||
| 70 | - setTimeout(function(){ | ||
| 71 | - th.setData({is_full_screen_men:0}); | ||
| 72 | - },1000) | ||
| 73 | - }else{ | ||
| 74 | - th.setData({ | ||
| 75 | - is_full_screen_men:0 | ||
| 76 | - }) | ||
| 77 | - } | 62 | + |
| 63 | + } | ||
| 78 | }) | 64 | }) |
| 79 | } | 65 | } |
| 80 | }, | 66 | }, |
components/full_screen/full_screen.wxml
| 1 | <!-- 全屏控制 --> | 1 | <!-- 全屏控制 --> |
| 2 | -<view hidden="{{!is_full_screen_men || hidden}}" class="full_screen" style="background-color: #fff;"></view> | ||
| 3 | <view wx:if="{{is_full_screen_show}}" class="full_screen" bindtap="go_full_ad" style="background-image: url('{{url+full_ad.ad_code}}');"> | 2 | <view wx:if="{{is_full_screen_show}}" class="full_screen" bindtap="go_full_ad" style="background-image: url('{{url+full_ad.ad_code}}');"> |
| 4 | <view catchtap="close_full_screen" class="skip_box">跳过 <text>{{sec_show}}</text></view> | 3 | <view catchtap="close_full_screen" class="skip_box">跳过 <text>{{sec_show}}</text></view> |
| 5 | </view> | 4 | </view> |
components/full_screen/full_screen.wxss
| @@ -8,8 +8,6 @@ | @@ -8,8 +8,6 @@ | ||
| 8 | background-size: 100% 100%; | 8 | background-size: 100% 100%; |
| 9 | background-repeat: no-repeat; | 9 | background-repeat: no-repeat; |
| 10 | } | 10 | } |
| 11 | - | ||
| 12 | - | ||
| 13 | .skip_box{ | 11 | .skip_box{ |
| 14 | float: right; margin-top: 10rpx; margin-right: 10rpx; | 12 | float: right; margin-top: 10rpx; margin-right: 10rpx; |
| 15 | background-color: gainsboro; width: 120rpx; | 13 | background-color: gainsboro; width: 120rpx; |
pages/index/index/index.js
| @@ -253,8 +253,20 @@ Page({ | @@ -253,8 +253,20 @@ Page({ | ||
| 253 | 253 | ||
| 254 | //有加载过一次首页,就显示 | 254 | //有加载过一次首页,就显示 |
| 255 | if(show || userInfo || getApp().globalData.user_id){ | 255 | if(show || userInfo || getApp().globalData.user_id){ |
| 256 | - var full_screen = th.selectComponent("#full_screen"); //组件的id | ||
| 257 | - full_screen.get_the_full_screen(); | 256 | + setTimeout(function(){ |
| 257 | + var full_screen = th.selectComponent("#full_screen"); //组件的id | ||
| 258 | + full_screen.get_the_full_screen(); | ||
| 259 | + },660) | ||
| 260 | + //动画效果 | ||
| 261 | + if(!th.data.f_hidden){ | ||
| 262 | + wx.showLoading({ | ||
| 263 | + title:'加载中..' | ||
| 264 | + }); | ||
| 265 | + setTimeout(function(){ | ||
| 266 | + th.setData({f_hidden:1}) | ||
| 267 | + wx.hideLoading(); | ||
| 268 | + },800) | ||
| 269 | + } | ||
| 258 | }else{ | 270 | }else{ |
| 259 | getApp().globalData.isLoad_ad=1; | 271 | getApp().globalData.isLoad_ad=1; |
| 260 | } | 272 | } |
| @@ -371,7 +383,6 @@ Page({ | @@ -371,7 +383,6 @@ Page({ | ||
| 371 | flash_data = e.data.data.pageData; | 383 | flash_data = e.data.data.pageData; |
| 372 | if (flash_data == null || flash_data.length <= 0) return false; | 384 | if (flash_data == null || flash_data.length <= 0) return false; |
| 373 | 385 | ||
| 374 | - | ||
| 375 | //当前时间戳 | 386 | //当前时间戳 |
| 376 | var nt = ut.gettimestamp(); | 387 | var nt = ut.gettimestamp(); |
| 377 | 388 |
pages/index/index/index.wxml
| 1 | -<!-- <import src="../../tabbar/tabbar.wxml" /> --> | ||
| 2 | -<!-- <template is="tabBar" data="{{tabBar}}"/> --> | 1 | +<view hidden="{{f_hidden}}" class="full_screen" style="background-color: #fff;"></view> |
| 2 | +<full_screen id="full_screen"></full_screen> | ||
| 3 | <!--普通界面--> | 3 | <!--普通界面--> |
| 4 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> | 4 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> |
| 5 | + | ||
| 6 | +<block wx:if="{{f_hidden}}"> | ||
| 7 | + | ||
| 5 | <view class="container rel" wx:if="{{ishow}}"> | 8 | <view class="container rel" wx:if="{{ishow}}"> |
| 6 | <block wx:if="{{banner}}"> | 9 | <block wx:if="{{banner}}"> |
| 7 | <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> | 10 | <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> |
| @@ -390,6 +393,8 @@ | @@ -390,6 +393,8 @@ | ||
| 390 | </block> | 393 | </block> |
| 391 | </view> | 394 | </view> |
| 392 | 395 | ||
| 396 | +</block> | ||
| 397 | + | ||
| 393 | <!-- 蒙尘 --> | 398 | <!-- 蒙尘 --> |
| 394 | <block wx:if="{{is_disgraceful}}"> | 399 | <block wx:if="{{is_disgraceful}}"> |
| 395 | <view class="disgraceful"> | 400 | <view class="disgraceful"> |
| @@ -417,8 +422,6 @@ | @@ -417,8 +422,6 @@ | ||
| 417 | </view> | 422 | </view> |
| 418 | </view> | 423 | </view> |
| 419 | </block> | 424 | </block> |
| 420 | - | ||
| 421 | - | ||
| 422 | 425 | ||
| 423 | <block wx:if="{{showHongbaoSmall}}"> | 426 | <block wx:if="{{showHongbaoSmall}}"> |
| 424 | <view> | 427 | <view> |
| @@ -426,9 +429,6 @@ | @@ -426,9 +429,6 @@ | ||
| 426 | </view> | 429 | </view> |
| 427 | </block> | 430 | </block> |
| 428 | 431 | ||
| 429 | -<!-- <hongbao id="hongbao" bind:closeHongbao="closeHongbao" wx:if="{{showHongbao}}" url="{{url}}"></hongbao> --> | ||
| 430 | -<full_screen id="full_screen"></full_screen> | ||
| 431 | - | ||
| 432 | 432 | ||
| 433 | 433 | ||
| 434 | 434 |
pages/index/index/index.wxss
| @@ -966,4 +966,14 @@ page { | @@ -966,4 +966,14 @@ page { | ||
| 966 | /* transform: translateY(-50%); */ | 966 | /* transform: translateY(-50%); */ |
| 967 | z-index: 10000; | 967 | z-index: 10000; |
| 968 | } | 968 | } |
| 969 | -.dis_top{position: fixed; top: 0; left: 0; width: 100%; z-index: 100000;} | ||
| 970 | \ No newline at end of file | 969 | \ No newline at end of file |
| 970 | +.dis_top{position: fixed; top: 0; left: 0; width: 100%; z-index: 100000;} | ||
| 971 | +.full_screen{ | ||
| 972 | + position: fixed;left: 0;top: 0; | ||
| 973 | + z-index: 1000000000000; | ||
| 974 | + background-color: rgba(0,0,0,0.4); | ||
| 975 | + width: 100%; | ||
| 976 | + height: 100%; | ||
| 977 | + background-position: center; | ||
| 978 | + background-size: 100% 100%; | ||
| 979 | + background-repeat: no-repeat; | ||
| 980 | +} |