From cee6bcd550ea2d32514cc73a893c00061f581fde Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Fri, 11 Oct 2024 20:18:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 34 +++++++++--------------- components/common/common.vue | 51 ++++++++++++++---------------------- 2 files changed, 32 insertions(+), 53 deletions(-) diff --git a/App.vue b/App.vue index c80c806b..68994a3b 100644 --- a/App.vue +++ b/App.vue @@ -7,12 +7,12 @@ data: { // 基础配置 // 数据接口请求地址 - request_url: 'http://shopxo.com/', - // request_url:'https://new.shopxo.vip/', + //request_url: 'http://shopxo.com/', + request_url:'https://new.shopxo.vip/', // 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/) - static_url: 'http://shopxo.com/', - // static_url:'https://new.shopxo.vip/', + //static_url: 'http://shopxo.com/', + static_url:'https://new.shopxo.vip/', // 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立) system_type: 'default', @@ -1433,12 +1433,20 @@ is_config(object, method, params) { var self = this; var count = 0; + var is_config_count = 0; var timer = setInterval(function () { if (self.get_config('status') == 1) { clearInterval(timer); if (typeof object === 'object' && (method || null) != null) { object[method](true, params); } + } else { + // 如果已经初始化过,但是没有数据则读取接口一次 + if(is_config_count < 1 && self.data.common_data_init_status == 1) { + is_config_count++; + self.data.common_data_init_status = 0; + self.init_config(); + } } count++; if (count >= 100) { @@ -1447,24 +1455,6 @@ }, 100); }, - /** - * 初始化 配置信息后回调 - * object 回调操作对象 - * method 回调操作对象的函数 - * params 回调操请求参数 - */ - init_config_back(object, method, params) { - var self = this; - self.data.common_data_init_back_timer = setInterval(function () { - if (self.data.common_data_init_status == 1) { - clearInterval(self.data.common_data_init_back_timer); - if (typeof object === 'object' && (method || null) != null) { - object[method](params); - } - } - }, 1000); - }, - /** * 火星坐标GCJ02到百度坐标BD-09(高德,谷歌,腾讯坐标 -> 百度) * lng 经度 diff --git a/components/common/common.vue b/components/common/common.vue index f8bea460..35e41da0 100644 --- a/components/common/common.vue +++ b/components/common/common.vue @@ -53,7 +53,6 @@ is_show_privacy: false, privacy_content: null, key: '', - load_status: 0, is_tabbar: false, app_tabber: null, footer_height_value: 0, @@ -92,6 +91,15 @@ this.init_config(); }, methods: { + // 显示响应方法 + on_show() { + //隐藏系统tabbar + app.globalData.system_hide_tabbar(); + + // 初始化配置 + this.init_config(); + }, + // 初始化配置 init_config(status) { if ((status || false) == true) { @@ -102,20 +110,20 @@ } }, - // 初始化 + // 初始化数据 init() { - // 首次则调用实际的接口再回调 - if(this.load_status == 0) { - app.globalData.init_config_back(this, 'init'); - } - - // 初始数据 - this.setData({ - load_status: 1, - }); - // 系统底部菜单 this.footer_init(); + + // app管理 + if (this.propIsAppAdmin && (this.$refs.app_admin || null) != null) { + this.$refs.app_admin.init(); + } + + // 用户头像和昵称设置提示 + if (this.propIsUserBase && (this.$refs.user_base || null) != null) { + this.$refs.user_base.init(); + } // #ifdef MP-WEIXIN // 微信协议验证 @@ -134,25 +142,6 @@ // #endif }, - // 显示响应方法 - on_show() { - //隐藏系统tabbar - app.globalData.system_hide_tabbar(); - - // 系统底部菜单 - this.footer_init(); - - // app管理 - if (this.propIsAppAdmin && (this.$refs.app_admin || null) != null) { - this.$refs.app_admin.init(); - } - - // 用户头像和昵称设置提示 - if (this.propIsUserBase && (this.$refs.user_base || null) != null) { - this.$refs.user_base.init(); - } - }, - // 底部菜单初始化 footer_init() { var upd_data = {