Commit 343702e5549263ee34d3ccce025c40843711eb89
1 parent
6dc842d2
白屏的处理
Showing
2 changed files
with
33 additions
and
28 deletions
pages/index/index/index.js
| @@ -248,28 +248,33 @@ Page({ | @@ -248,28 +248,33 @@ Page({ | ||
| 248 | 248 | ||
| 249 | var th = this; | 249 | var th = this; | 
| 250 | 250 | ||
| 251 | - var show=getApp().globalData.isLoad_ad; | ||
| 252 | - var userInfo=getApp().globalData.userInfo; | 251 | + var show=getApp().globalData.isLoad_ad; | 
| 252 | + setTimeout(function(){ | ||
| 253 | + //user没有及时更新 | ||
| 254 | + var userInfo=getApp().globalData.userInfo; | ||
| 255 | + if(!userInfo || !userInfo.user_id) userInfo=null; | ||
| 256 | + //有加载过一次首页,就显示 | ||
| 257 | + if(show || userInfo || getApp().globalData.user_id){ | ||
| 258 | + setTimeout(function(){ | ||
| 259 | + var full_screen = th.selectComponent("#full_screen"); //组件的id | ||
| 260 | + full_screen.get_the_full_screen(); | ||
| 261 | + },800) | ||
| 262 | + //动画效果 | ||
| 263 | + if(!th.data.f_hidden){ | ||
| 264 | + wx.showLoading({ | ||
| 265 | + title:'加载中..' | ||
| 266 | + }); | ||
| 267 | + setTimeout(function(){ | ||
| 268 | + th.setData({f_hidden:1}) | ||
| 269 | + wx.hideLoading(); | ||
| 270 | + },960) | ||
| 271 | + } | ||
| 272 | + }else{ | ||
| 273 | + getApp().globalData.isLoad_ad=1; | ||
| 274 | + } | ||
| 275 | + },500) | ||
| 276 | + | ||
| 253 | 277 | ||
| 254 | - //有加载过一次首页,就显示 | ||
| 255 | - if(show || userInfo || getApp().globalData.user_id){ | ||
| 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 | - } | ||
| 270 | - }else{ | ||
| 271 | - getApp().globalData.isLoad_ad=1; | ||
| 272 | - } | ||
| 273 | 278 | ||
| 274 | }, | 279 | }, | 
| 275 | //当隐藏的时候就关闭计时器 | 280 | //当隐藏的时候就关闭计时器 | 
| @@ -517,9 +522,9 @@ Page({ | @@ -517,9 +522,9 @@ Page({ | ||
| 517 | th.is_new(); | 522 | th.is_new(); | 
| 518 | } | 523 | } | 
| 519 | 524 | ||
| 520 | - setTimeout(function () { | ||
| 521 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 522 | - },500) | 525 | + setTimeout(function () { | 
| 526 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 527 | + },500) | ||
| 523 | 528 | ||
| 524 | }); | 529 | }); | 
| 525 | 530 | ||
| @@ -527,7 +532,7 @@ Page({ | @@ -527,7 +532,7 @@ Page({ | ||
| 527 | var goods_list = th.selectComponent("#goods_list"); //组件的id | 532 | var goods_list = th.selectComponent("#goods_list"); //组件的id | 
| 528 | goods_list.init(); | 533 | goods_list.init(); | 
| 529 | goods_list.get_list(); | 534 | goods_list.get_list(); | 
| 530 | - }, 1500) | 535 | + }, 2000) | 
| 531 | }, | 536 | }, | 
| 532 | 537 | ||
| 533 | //--判断小程序是否过期-- | 538 | //--判断小程序是否过期-- | 
pages/index/index/index.wxml
| 1 | -<view hidden="{{f_hidden}}" class="full_screen" style="background-color: #fff;"></view> | 1 | +<!-- <view hidden="{{f_hidden}}" class="full_screen" style="background-color: #fff;"></view> --> | 
| 2 | <full_screen id="full_screen"></full_screen> | 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 | 5 | ||
| 6 | -<block wx:if="{{f_hidden}}"> | ||
| 7 | - | ||
| 8 | <view class="container rel" wx:if="{{ishow}}"> | 6 | <view class="container rel" wx:if="{{ishow}}"> | 
| 9 | <block wx:if="{{banner}}"> | 7 | <block wx:if="{{banner}}"> | 
| 10 | <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> | 8 | <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> | 
| @@ -298,6 +296,8 @@ | @@ -298,6 +296,8 @@ | ||
| 298 | 296 | ||
| 299 | </view> | 297 | </view> | 
| 300 | 298 | ||
| 299 | + | ||
| 300 | +<block wx:if="{{f_hidden}}"> | ||
| 301 | <!--是否是自定义--> | 301 | <!--是否是自定义--> | 
| 302 | <view class="container" wx:if="{{isTemplate}}" style="background-color:{{bgcolor_t}}"> | 302 | <view class="container" wx:if="{{isTemplate}}" style="background-color:{{bgcolor_t}}"> | 
| 303 | <!-- 置顶层 --> | 303 | <!-- 置顶层 --> | 
