diff --git a/App.vue b/App.vue index 9b8271ab..80df24b2 100644 --- a/App.vue +++ b/App.vue @@ -1610,18 +1610,10 @@ // 设置底部菜单、存在开屏广告则延迟加载 if(this.data.is_use_native_tabbar == 1) { - let pages = self.app_tabbar_pages() || []; - let current_page = '/'+self.current_page(false); - if(pages.length > 0 && pages[0] == current_page) { - let base = self.get_config('plugins_base.startad.data') || {}; - let data = self.get_config('plugins_startad_list') || []; - if(data.length > 0 && parseInt(base.is_status || 0) == 1) { - setTimeout(function() { - self.set_tabbar(data.plugins_themestyle_data); - }, 500); - } else { + if(this.is_init_config_success_pages_begin(self)) { + setTimeout(function() { self.set_tabbar(data.plugins_themestyle_data); - } + }, 500); } else { self.set_tabbar(data.plugins_themestyle_data); } @@ -1631,6 +1623,21 @@ self.user_auto_login_handle(); }, + // 是否初始化配置成功后,页面前处理,返回true则页面需要延迟加载 + is_init_config_success_pages_begin(self = this) { + // 是否有开屏广告 + let pages = self.app_tabbar_pages() || []; + let current_page = '/'+self.current_page(false); + if(pages.length > 0 && pages[0] == current_page) { + let base = self.get_config('plugins_base.startad.data') || {}; + let data = self.get_config('plugins_startad_list') || []; + if(data.length > 0 && parseInt(base.is_status || 0) == 1) { + return true; + } + } + return false; + }, + /** * 配置是否有效(100毫秒检验一次、最多检验100次) * object 回调操作对象 diff --git a/components/common/common.vue b/components/common/common.vue index b62d920b..6baa02fd 100644 --- a/components/common/common.vue +++ b/components/common/common.vue @@ -86,25 +86,13 @@ // 初始化配置 init_config(status = false, params = {}) { - if ((status || false) == true) { + if (status) { // 初始化数据 - if(app.globalData.data.is_use_native_tabbar == 0) { - let pages = app.globalData.app_tabbar_pages() || []; - let current_page = '/'+app.globalData.current_page(false); - if(pages.length > 0 && pages[0] == current_page) { - let base = app.globalData.get_config('plugins_base.startad.data') || {}; - let data = app.globalData.get_config('plugins_startad_list') || []; - if(data.length > 0 && parseInt(base.is_status || 0) == 1) { - let self = this; - setTimeout(function() { - this.init(params); - }, 500); - } else { - this.init(params); - } - } else { - this.init(params); - } + if(app.globalData.is_init_config_success_pages_begin()) { + let self = this; + setTimeout(function() { + self.init(params); + }, 500); } else { this.init(params); } diff --git a/pages/index/index.vue b/pages/index/index.vue index c521d178..6d7c660a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -433,23 +433,11 @@ app.globalData.page_event_onshow_handle(); // 数据加载、存在开屏广告则延迟加载 - if(this.load_status == 0) { - let pages = app.globalData.app_tabbar_pages() || []; - let current_page = '/'+app.globalData.current_page(false); - if(pages.length > 0 && pages[0] == current_page) { - let base = app.globalData.get_config('plugins_base.startad.data') || {}; - let data = app.globalData.get_config('plugins_startad_list') || []; - if(data.length > 0 && parseInt(base.is_status || 0) == 1) { - let self = this; - setTimeout(function() { - self.init(); - }, 500); - } else { - this.init(); - } - } else { - this.init(); - } + if(this.load_status == 0 && app.globalData.is_init_config_success_pages_begin()) { + let self = this; + setTimeout(function() { + self.init(); + }, 500); } else { this.init(); }