From 618e482507844dfb97bd701d53b3145704b6baf3 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 17 Jun 2025 12:01:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96iPadOS=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/js/components/MicroApps/modal.vue | 2 +- resources/assets/js/functions/common.js | 23 +++++++++++++++++++ resources/assets/js/store/actions.js | 2 ++ resources/assets/js/store/state.js | 6 ++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/components/MicroApps/modal.vue b/resources/assets/js/components/MicroApps/modal.vue index 5a22e0ecd..0957155b7 100644 --- a/resources/assets/js/components/MicroApps/modal.vue +++ b/resources/assets/js/components/MicroApps/modal.vue @@ -204,7 +204,7 @@ export default { &-close { position: absolute; - top: 0; + top: var(--status-bar-height, 0); left: -40px; z-index: 1; width: 40px; diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index c33c81cbc..17cc33308 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -1511,6 +1511,29 @@ const timezone = require("dayjs/plugin/timezone"); }; img.src = url; }) + }, + + /** + * 是否全屏(根据尺寸对比) + * @returns {boolean} + */ + isFullScreen() { + const windowWidth = $A(window).width(); + const windowHeight = $A(window).height(); + const screenWidth = window.screen.width; + const screenHeight = window.screen.height; + + // 如果高比宽大,对调宽高 + const adjustedWindowWidth = windowWidth > windowHeight ? windowWidth : windowHeight; + const adjustedWindowHeight = windowWidth > windowHeight ? windowHeight : windowWidth; + const adjustedScreenWidth = screenWidth > screenHeight ? screenWidth : screenHeight; + const adjustedScreenHeight = screenWidth > screenHeight ? screenHeight : screenWidth; + + // 判断是否全屏,误差1内视为全屏 + const widthDiff = Math.abs(adjustedWindowWidth - adjustedScreenWidth); + const heightDiff = Math.abs(adjustedWindowHeight - adjustedScreenHeight); + + return widthDiff <= 1 && heightDiff <= 1; } }); diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index ce142a50d..476a7b0ed 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -27,6 +27,8 @@ export default { state.windowLandscape = windowOrientation === 'landscape' state.windowPortrait = windowOrientation === 'portrait' + state.windowIsFullScreen = $A.isFullScreen() + state.formOptions = { class: windowWidth > 576 ? '' : 'form-label-weight-bold', labelPosition: windowWidth > 576 ? 'right' : 'top', diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 54a0de7d6..f7fe0569f 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -1,6 +1,7 @@ const windowWidth = $A(window).width(), windowHeight = $A(window).height(), - windowOrientation = $A.screenOrientation() + windowOrientation = $A.screenOrientation(), + windowIsFullScreen = $A.isFullScreen(); export default { // 客户端ID(希望不变的,除非清除浏览器缓存或者卸载应用) @@ -36,6 +37,9 @@ export default { windowLandscape: windowOrientation === 'landscape', // 横屏 windowPortrait: windowOrientation === 'portrait', // 竖屏 + // 是否全屏 + windowIsFullScreen: windowIsFullScreen, + // 表单布局 formOptions: { class: windowWidth > 576 ? '' : 'form-label-weight-bold',