From 1f006c1b6ca54ba5de6b9276da6f780ab33b1c81 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Wed, 1 Dec 2021 13:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 35 ++++++++++++++++---- common/css/page.css | 5 +-- components/online-service/online-service.vue | 9 ++--- components/quick-nav/quick-nav.vue | 5 +-- pages/index/index.css | 2 +- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/App.vue b/App.vue index 5a76ffe4..7f3a74c3 100644 --- a/App.vue +++ b/App.vue @@ -70,14 +70,19 @@ }, /** - * 获取设备信息 + * 获取设备信息 + * key 指定key + * dv 默认数据(不存在则读取、默认null) + * is_real 是否实时读取 */ - get_system_info(key) { - var info = uni.getStorageSync(this.data.cache_system_info_key) || null; - if (info == null) { - info = this.set_system_info(); + get_system_info(key, dv, is_real) { + var info = null; + if((is_real || false) == true) { + info = this.set_system_info(); + } else { + info = uni.getStorageSync(this.data.cache_system_info_key) || null; } - return (key|| null) == null ? info : (info[key] == undefined) ? null : info[key]; + return ((key|| null) == null) ? info : ((info[key] == undefined) ? (dv || null) : info[key]); }, /** @@ -1047,6 +1052,24 @@ } // #endif return width; + }, + + // 窗口高度处理 + window_height_handle(system) { + var height = system.windowHeight; + // 状态栏 + if(system.statusBarHeight > 0) { + height += system.statusBarHeight; + } + // 导航栏 + if(system.windowTop > 0) { + height += system.windowTop; + } + // 底部菜单 + if(system.windowBottom > 0) { + height += system.windowBottom; + } + return height; } }, diff --git a/common/css/page.css b/common/css/page.css index 30050fc0..52784961 100644 --- a/common/css/page.css +++ b/common/css/page.css @@ -22,7 +22,8 @@ iframe, .quick-movable-container, .online-service-movable-container, .bottom-fixed, -.buy-nav { +.buy-nav, +.plugins-popupscreen .content { max-width: 800px !important; margin: 0 auto !important; } @@ -52,7 +53,7 @@ uni-page-head { .uni-page-head-btn { position: fixed; left: auto; - bottom: 60px; + bottom: 70px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 10px rgb(0 0 0 / 30%); margin: 0 0 0 10px; diff --git a/components/online-service/online-service.vue b/components/online-service/online-service.vue index 436dab70..5bf4ef7b 100644 --- a/components/online-service/online-service.vue +++ b/components/online-service/online-service.vue @@ -92,13 +92,14 @@ } // 数据设置 - var system = app.globalData.get_system_info(); - var win_width = app.globalData.window_width_handle(system.windowWidth); + var system = app.globalData.get_system_info(null, null, true); + var width = app.globalData.window_width_handle(system.windowWidth); + var height = app.globalData.window_height_handle(system); this.setData({ is_first: 0, system: system, - x: win_width-43, - y: (system.windowHeight || 450) - 380 + x: width - 43, + y: height - 380 }); }, methods: { diff --git a/components/quick-nav/quick-nav.vue b/components/quick-nav/quick-nav.vue index 1422e702..952efb4f 100644 --- a/components/quick-nav/quick-nav.vue +++ b/components/quick-nav/quick-nav.vue @@ -99,12 +99,13 @@ } // 数据设置 - var system = app.globalData.get_system_info(); + var system = app.globalData.get_system_info(null, null, true); + var height = app.globalData.window_height_handle(system); this.setData({ is_first: 0, system: system, x: 12, - y: (system.windowHeight || 450) - 260 + y: height - 180 }); }, methods: { diff --git a/pages/index/index.css b/pages/index/index.css index 0b1fb862..503cd528 100644 --- a/pages/index/index.css +++ b/pages/index/index.css @@ -192,7 +192,7 @@ top: 0; } .plugins-popupscreen .content { - margin-top: calc(50vh - 200rpx); + margin-top: calc(50vh - 200rpx) !important; } .plugins-popupscreen .content image { width: 600rpx;