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 | 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 | 26 | properties: {}, |
| 33 | 27 | methods: { |
| 34 | 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 | 32 | go_full_ad(){ |
| 39 | 33 | if(!this.data.full_ad) return false; |
| 40 | 34 | if(!this.data.full_ad.ad_weapplink) return false; |
| 41 | 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 | 37 | get_the_full_screen(){ |
| 45 | - if(this.data.full_ad) return false; | |
| 38 | + if(this.data.full_ad) { | |
| 39 | + return false; | |
| 40 | + } | |
| 46 | 41 | var th=this; |
| 47 | 42 | //获取全屏的广告 |
| 48 | 43 | getApp().request.promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + o.stoid,{ |
| ... | ... | @@ -53,8 +48,7 @@ Component({ |
| 53 | 48 | th.setData({ |
| 54 | 49 | is_full_screen_show:1, |
| 55 | 50 | full_ad:res.data.data.pageData[0], |
| 56 | - }) | |
| 57 | - | |
| 51 | + }) | |
| 58 | 52 | //--定时关闭-- |
| 59 | 53 | th.data.full_screen=setInterval(function(){ |
| 60 | 54 | if(!th.data.sec_show) { |
| ... | ... | @@ -65,16 +59,8 @@ Component({ |
| 65 | 59 | th.data.sec_show--; |
| 66 | 60 | th.setData({sec_show:th.data.sec_show}); |
| 67 | 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 | 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 | 3 | <view catchtap="close_full_screen" class="skip_box">跳过 <text>{{sec_show}}</text></view> |
| 5 | 4 | </view> | ... | ... |
components/full_screen/full_screen.wxss
pages/index/index/index.js
| ... | ... | @@ -253,8 +253,20 @@ Page({ |
| 253 | 253 | |
| 254 | 254 | //有加载过一次首页,就显示 |
| 255 | 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 | 270 | }else{ |
| 259 | 271 | getApp().globalData.isLoad_ad=1; |
| 260 | 272 | } |
| ... | ... | @@ -371,7 +383,6 @@ Page({ |
| 371 | 383 | flash_data = e.data.data.pageData; |
| 372 | 384 | if (flash_data == null || flash_data.length <= 0) return false; |
| 373 | 385 | |
| 374 | - | |
| 375 | 386 | //当前时间戳 |
| 376 | 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 | 4 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> |
| 5 | + | |
| 6 | +<block wx:if="{{f_hidden}}"> | |
| 7 | + | |
| 5 | 8 | <view class="container rel" wx:if="{{ishow}}"> |
| 6 | 9 | <block wx:if="{{banner}}"> |
| 7 | 10 | <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> |
| ... | ... | @@ -390,6 +393,8 @@ |
| 390 | 393 | </block> |
| 391 | 394 | </view> |
| 392 | 395 | |
| 396 | +</block> | |
| 397 | + | |
| 393 | 398 | <!-- 蒙尘 --> |
| 394 | 399 | <block wx:if="{{is_disgraceful}}"> |
| 395 | 400 | <view class="disgraceful"> |
| ... | ... | @@ -417,8 +422,6 @@ |
| 417 | 422 | </view> |
| 418 | 423 | </view> |
| 419 | 424 | </block> |
| 420 | - | |
| 421 | - | |
| 422 | 425 | |
| 423 | 426 | <block wx:if="{{showHongbaoSmall}}"> |
| 424 | 427 | <view> |
| ... | ... | @@ -426,9 +429,6 @@ |
| 426 | 429 | </view> |
| 427 | 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 | 966 | /* transform: translateY(-50%); */ |
| 967 | 967 | z-index: 10000; |
| 968 | 968 | } |
| 969 | -.dis_top{position: fixed; top: 0; left: 0; width: 100%; z-index: 100000;} | |
| 970 | 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 | +} | ... | ... |