shish 2 месяцев назад
Родитель
Сommit
5cc0d82ac9
1 измененных файлов с 16 добавлено и 5 удалено
  1. 16 5
      hdApp/src/admin/home/me.vue

+ 16 - 5
hdApp/src/admin/home/me.vue

@@ -343,22 +343,33 @@ export default {
         this.statusBarHeight = systemInfo.statusBarHeight || 0;
         this.heroTopOffset = 0;
         this.capsuleSafeRight = 0;
+        const topLift = uni.upx2px(10);
+        const liftTop = (px) => Math.max(this.statusBarHeight, px - topLift);
         // #ifdef MP-WEIXIN
         const menuButton = uni.getMenuButtonBoundingClientRect();
         if (menuButton && menuButton.bottom) {
-          this.heroTopOffset = menuButton.bottom + 12;
+          this.heroTopOffset = liftTop(menuButton.bottom + 12);
         }
         if (menuButton && menuButton.left) {
           this.capsuleSafeRight = systemInfo.windowWidth - menuButton.left + 8;
         }
         // #endif
         // #ifdef APP-PLUS
-        const safeTop =
+        const statusBar = this.statusBarHeight;
+        const safeInsetTop =
           (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.top) ||
           (systemInfo.safeArea && systemInfo.safeArea.top) ||
-          this.statusBarHeight;
-        // 自定义导航:状态栏 + 标题栏区域,避免 App 端内容顶到状态栏下
-        this.heroTopOffset = safeTop + 44 + 12;
+          0;
+        const topInset = Math.max(statusBar, safeInsetTop);
+        const isIos =
+          systemInfo.platform === "ios" || (systemInfo.osName && systemInfo.osName.toLowerCase() === "ios");
+        if (isIos) {
+          // iOS 刘海屏 safeArea.top 已含状态栏,仅补内容与顶部的间距
+          this.heroTopOffset = liftTop(topInset + 12);
+        } else {
+          // Android 自定义导航:状态栏 + 约 44px 标题区(与微信胶囊下边距接近)
+          this.heroTopOffset = liftTop(topInset + 44 + 12);
+        }
         // #endif
       } catch (e) {
         this.statusBarHeight = 0;