From d73d992a4dfdd579b682b028ee6f1dfbcbdfb8aa Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Mon, 30 Mar 2026 16:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E7=BB=9F=E4=B8=80=EF=BC=8Capp=E6=9D=83=E9=99=90?= =?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 | 18 ++++++++++-------- components/cart-para-curve/cart-para-curve.vue | 2 +- components/diy-footer/diy-footer.vue | 4 ++-- components/popup/popup.vue | 2 +- components/start-ad/start-ad.vue | 6 ++---- .../status-bar-height/status-bar-height.vue | 2 +- components/u-popup/u-popup.vue | 3 ++- manifest.json | 10 +++++++++- pages/diy/components/diy/carousel.vue | 4 +--- pages/diy/components/diy/float-window.vue | 2 +- pages/diy/components/diy/modules/tabs-view.vue | 4 ++-- 11 files changed, 32 insertions(+), 25 deletions(-) diff --git a/App.vue b/App.vue index 33036f32..d84ffb65 100644 --- a/App.vue +++ b/App.vue @@ -312,13 +312,13 @@ * is_real 是否实时读取 */ get_system_info(key, dv, is_real) { - var info = null; + var info = {}; if ((is_real || false) == true) { - info = this.set_system_info() || null; + info = this.set_system_info() || {}; } else { - info = uni.getStorageSync(this.data.cache_system_info_key) || null; + info = uni.getStorageSync(this.data.cache_system_info_key) || {}; } - if (info == null || (key || null) == null) { + if ((key || null) == null) { return info; } return info[key] == undefined ? (dv == undefined ? null : dv) : info[key]; @@ -328,9 +328,11 @@ * 设置设备信息 */ set_system_info() { - var system_info = uni.getSystemInfoSync(); - uni.setStorageSync(this.data.cache_system_info_key, system_info); - return system_info; + if(!plus.runtime.isAgreePrivacy()) { + var system_info = uni.getSystemInfoSync(); + uni.setStorageSync(this.data.cache_system_info_key, system_info); + return system_info; + } }, /** @@ -2032,7 +2034,7 @@ // 是否pc is_pc() { var arr = ['macos', 'windows']; - return arr.indexOf(uni.getSystemInfoSync().platform) != -1; + return arr.indexOf(this.get_system_info('platform')) != -1; }, // 终端类型 diff --git a/components/cart-para-curve/cart-para-curve.vue b/components/cart-para-curve/cart-para-curve.vue index aa1ff7db..6d7ae35b 100644 --- a/components/cart-para-curve/cart-para-curve.vue +++ b/components/cart-para-curve/cart-para-curve.vue @@ -39,7 +39,7 @@ var btn_width = this.propBtnWidth; // 未指定购物车对象则读取tabbar数据自动计算购物车位置 if((cart || null) == null || (cart[0] || null) == null) { - var info = uni.getSystemInfoSync(); + var info = app.globalData.get_system_info(); // 当前页面 var page = app.globalData.current_page().split('?'); switch(page[0]) { diff --git a/components/diy-footer/diy-footer.vue b/components/diy-footer/diy-footer.vue index d62d8aa7..401aa1fc 100644 --- a/components/diy-footer/diy-footer.vue +++ b/components/diy-footer/diy-footer.vue @@ -133,8 +133,8 @@ // #ifndef H5 // 底部菜单距离底部的安全距离,减去20、默认的安全距离太高了 - var safe_areaInsets = uni.getSystemInfoSync().safeAreaInsets || {}; - var bottom = parseInt(safe_areaInsets.bottom || 0); + var safe_area_insets = app.globalData.get_system_info('safeAreaInsets') || {}; + var bottom = parseInt(safe_area_insets.bottom || 0); if (bottom > 0) { bottom -= 24; } diff --git a/components/popup/popup.vue b/components/popup/popup.vue index 2abd14b2..117b34e3 100644 --- a/components/popup/popup.vue +++ b/components/popup/popup.vue @@ -121,7 +121,7 @@ var left = 0; // #ifdef H5 // 处理内容左边距、避免父级设置内边距影响 - var width = uni.getSystemInfoSync().windowWidth; + var width = parseInt(app.globalData.get_system_info('windowWidth', 0)); if (width > 960) { left = (width - 800) / 2; } diff --git a/components/start-ad/start-ad.vue b/components/start-ad/start-ad.vue index 44a7cac8..ceb212ff 100644 --- a/components/start-ad/start-ad.vue +++ b/components/start-ad/start-ad.vue @@ -49,12 +49,10 @@ computed: { // 跳过样式 skip_position_style() { - const { - statusBarHeight - } = uni.getSystemInfoSync(); + const status_bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0)); if (!this.propHasNavbar) { return this.obj_to_style({ - 'top': `${statusBarHeight*2 + 88 + 30}rpx`, + 'top': `${status_bar_height*2 + 88 + 30}rpx`, }); } return this.obj_to_style({ diff --git a/components/status-bar-height/status-bar-height.vue b/components/status-bar-height/status-bar-height.vue index ea47f051..4e52e27c 100644 --- a/components/status-bar-height/status-bar-height.vue +++ b/components/status-bar-height/status-bar-height.vue @@ -15,7 +15,7 @@ components: {}, props: {}, mounted() { - this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'; + this.statusBarHeight = app.globalData.get_system_info('statusBarHeight') + 'px'; }, methods: {} }; diff --git a/components/u-popup/u-popup.vue b/components/u-popup/u-popup.vue index cea5d166..032d3c8c 100644 --- a/components/u-popup/u-popup.vue +++ b/components/u-popup/u-popup.vue @@ -34,6 +34,7 @@