From 343702e5549263ee34d3ccce025c40843711eb89 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 21 Apr 2021 10:24:20 +0800 Subject: [PATCH] 白屏的处理 --- pages/index/index/index.js | 55 ++++++++++++++++++++++++++++++------------------------- pages/index/index/index.wxml | 6 +++--- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index f70b992..4fcd618 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -248,28 +248,33 @@ Page({ var th = this; - var show=getApp().globalData.isLoad_ad; - var userInfo=getApp().globalData.userInfo; + var show=getApp().globalData.isLoad_ad; + setTimeout(function(){ + //user没有及时更新 + var userInfo=getApp().globalData.userInfo; + if(!userInfo || !userInfo.user_id) userInfo=null; + //有加载过一次首页,就显示 + if(show || userInfo || getApp().globalData.user_id){ + setTimeout(function(){ + var full_screen = th.selectComponent("#full_screen"); //组件的id + full_screen.get_the_full_screen(); + },800) + //动画效果 + if(!th.data.f_hidden){ + wx.showLoading({ + title:'加载中..' + }); + setTimeout(function(){ + th.setData({f_hidden:1}) + wx.hideLoading(); + },960) + } + }else{ + getApp().globalData.isLoad_ad=1; + } + },500) + - //有加载过一次首页,就显示 - if(show || userInfo || getApp().globalData.user_id){ - setTimeout(function(){ - var full_screen = th.selectComponent("#full_screen"); //组件的id - full_screen.get_the_full_screen(); - },660) - //动画效果 - if(!th.data.f_hidden){ - wx.showLoading({ - title:'加载中..' - }); - setTimeout(function(){ - th.setData({f_hidden:1}) - wx.hideLoading(); - },800) - } - }else{ - getApp().globalData.isLoad_ad=1; - } }, //当隐藏的时候就关闭计时器 @@ -517,9 +522,9 @@ Page({ th.is_new(); } - setTimeout(function () { - if (getApp().globalData.user_id) getApp().requestCardNum(th); - },500) + setTimeout(function () { + if (getApp().globalData.user_id) getApp().requestCardNum(th); + },500) }); @@ -527,7 +532,7 @@ Page({ var goods_list = th.selectComponent("#goods_list"); //组件的id goods_list.init(); goods_list.get_list(); - }, 1500) + }, 2000) }, //--判断小程序是否过期-- diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index c89ff3a..fcec284 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -1,10 +1,8 @@ - + - - @@ -298,6 +296,8 @@ + + -- libgit2 0.21.4