fix(miniprogram): adapt mp-header for WeChat capsule safe area

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-09-12 18:54:57 +08:00
1 parent f0d64379a7
commit 1a97ec954b
7 files changed
+93 -15

No files matched your search

+72 -1
View File
@@ -32,10 +32,33 @@ page {
.mp-header {
background: var(--mp-header-gradient);
color: #fff;
padding: calc(28rpx + env(safe-area-inset-top, 0px)) 32rpx 32rpx;
padding:
calc(28rpx + var(--sq-safe-top, env(safe-area-inset-top, 0px)))
calc(32rpx + var(--sq-capsule-right-safe, 96px))
32rpx
32rpx;
border-bottom-left-radius: var(--mp-radius-xl);
border-bottom-right-radius: var(--mp-radius-xl);
box-shadow: 0 16rpx 40rpx rgba(10, 159, 109, 0.12);
box-sizing: border-box;
}
.mp-header--home {
padding-top: calc(40rpx + var(--sq-safe-top, env(safe-area-inset-top, 0px)));
padding-bottom: 48rpx;
}
.mp-header--workbench {
/* 去掉魔法 40px 双叠加;仅用 safe-top + 内容间距 */
padding-top: calc(48rpx + var(--sq-safe-top, env(safe-area-inset-top, 0px)));
padding-bottom: 56rpx;
min-height: calc(200rpx + var(--sq-safe-top, 0px));
box-sizing: border-box;
}
.mp-header__main {
flex: 1;
min-width: 0;
}
.mp-header__title {
@@ -52,6 +75,45 @@ page {
line-height: 1.4;
}
.mp-header__user-stack {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
gap: 8rpx;
flex-shrink: 0;
max-width: 42%;
}
.mp-header__user-name {
font-size: 26rpx;
font-weight: 600;
line-height: 1.3;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mp-header__logout {
font-size: 22rpx;
line-height: 1.3;
padding: 6rpx 16rpx;
border-radius: 999rpx;
border: 1rpx solid rgba(255, 255, 255, 0.45);
color: #fff;
opacity: 0.95;
}
.mp-header__logout:active {
background: rgba(255, 255, 255, 0.12);
}
.mp-header__logout--disabled {
opacity: 0.55;
pointer-events: none;
}
.mp-section {
padding: 24rpx 32rpx;
}
@@ -157,6 +219,11 @@ page {
height: 60rpx;
border-radius: 16rpx;
background: linear-gradient(145deg, #e8f5ef, #d9efe5);
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
line-height: 1;
}
.mp-module-block--bx .mp-menu-card__icon {
@@ -180,6 +247,10 @@ page {
pointer-events: none;
}
.mp-menu-card--pad {
pointer-events: none;
}
.mp-placeholder {
min-height: 60vh;
display: flex;