fix(ui): 修复优惠券页/消息页导航栏位置偏高(标题与返回按钮应贴胶囊行)

- 原因:初版用 padding-top=safe-header-gap + 44px 内容行,把标题推到状态栏下方,顶部留白过大
- 改为与其它页面一致的规范:导航栏总高=var(--safe-header-gap),内容行 position:absolute;bottom:0;height:var(--capsule-height) 贴底对齐胶囊;标题绝对居中(translateX(-50%))
- 页面根改为 height:100vh + flex 纵向布局,列表用 flex:1 撑满剩余空间(tab-bar/滚动区不再按 100vh 硬算)
- 返回按钮对齐既有规范(64rpx 圆形底 + 38rpx 图标)
- 回归 97 套件/674 用例全绿(theme-consistency.spec.ts 增加导航规范断言)
这个提交包含在:
xcbyy
2026-10-19 15:42:18 +08:00
父节点 ae569d0ca6
当前提交 a1e3a137b6
共有 3 个文件被更改,包括 83 次插入 和 37 次删除

查看文件

@@ -221,50 +221,66 @@ onShow(() => {
<style scoped> <style scoped>
/* 颜色全部取自全局主题变量(App.vue 中按 theme-warm 覆盖),随主题切换自动适配 */ /* 颜色全部取自全局主题变量(App.vue 中按 theme-warm 覆盖),随主题切换自动适配 */
/* 导航栏规范与其它页面一致:总高=安全区,内容行贴底对齐胶囊,标题绝对居中 */
.coupon-page { .coupon-page {
min-height: 100vh; height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
background: var(--bg-primary, #0a0f1d); background: var(--bg-primary, #0a0f1d);
} }
.custom-nav-bar { .custom-nav-bar {
position: sticky; position: relative;
top: 0; flex-shrink: 0;
z-index: 50; height: var(--safe-header-gap, 88px);
background: var(--nav-bg, #0a0f1d); background: var(--nav-bg, #0a0f1d);
padding-top: var(--safe-header-gap, 0); border-bottom: 1px solid var(--border-subtle, #1e293b);
} }
.nav-content { .nav-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: var(--capsule-height, 32px);
display: flex; display: flex;
align-items: center; align-items: center;
height: 44px; justify-content: space-between;
padding: 0 12px; padding: 0 24rpx;
box-sizing: border-box;
} }
.btn-nav-back { .btn-nav-back {
width: 32px; width: 64rpx;
height: 32px; height: 64rpx;
border-radius: 32rpx;
background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.08));
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.nav-back-icon { .nav-back-icon {
width: 18px; width: 38rpx;
height: 18px; height: 38rpx;
} }
.nav-title-wrap { .nav-title-wrap {
flex: 1; position: absolute;
left: 50%;
transform: translateX(-50%);
text-align: center; text-align: center;
} }
.nav-title { .nav-title {
color: var(--text-primary, #fff); color: var(--text-primary, #f8fafc);
font-size: 17px; font-size: 32rpx;
font-weight: 600; font-weight: 700;
letter-spacing: 0.5rpx;
} }
.nav-capsule-placeholder { .nav-capsule-placeholder {
width: 32px; width: var(--capsule-right-space, 0rpx);
} }
.tab-bar { .tab-bar {
flex-shrink: 0;
display: flex; display: flex;
gap: 12px; gap: 12px;
padding: 10px 16px 0; padding: 12px 16px 0;
} }
.tab-item { .tab-item {
flex: 1; flex: 1;
@@ -289,7 +305,9 @@ onShow(() => {
color: #fff; color: #fff;
} }
.coupon-scroll { .coupon-scroll {
height: calc(100vh - 90px - var(--safe-header-gap, 0px)); flex: 1;
min-height: 0;
box-sizing: border-box;
} }
.coupon-body { .coupon-body {
padding: 12px 16px 40px; padding: 12px 16px 40px;

查看文件

@@ -170,56 +170,73 @@ onShow(() => {
<style scoped> <style scoped>
/* 颜色全部取自全局主题变量(App.vue 按 theme-warm 覆盖),随主题切换自动适配 */ /* 颜色全部取自全局主题变量(App.vue 按 theme-warm 覆盖),随主题切换自动适配 */
/* 导航栏规范与其它页面一致:总高=安全区,内容行贴底对齐胶囊,标题绝对居中 */
.notif-page { .notif-page {
min-height: 100vh; height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
background: var(--bg-primary, #0a0f1d); background: var(--bg-primary, #0a0f1d);
} }
.custom-nav-bar { .custom-nav-bar {
position: sticky; position: relative;
top: 0; flex-shrink: 0;
z-index: 50; height: var(--safe-header-gap, 88px);
background: var(--nav-bg, #0a0f1d); background: var(--nav-bg, #0a0f1d);
padding-top: var(--safe-header-gap, 0); border-bottom: 1px solid var(--border-subtle, #1e293b);
} }
.nav-content { .nav-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: var(--capsule-height, 32px);
display: flex; display: flex;
align-items: center; align-items: center;
height: 44px; justify-content: space-between;
padding: 0 12px; padding: 0 24rpx;
box-sizing: border-box;
} }
.btn-nav-back { .btn-nav-back {
width: 32px; width: 64rpx;
height: 32px; height: 64rpx;
border-radius: 32rpx;
background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.08));
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.nav-back-icon { .nav-back-icon {
width: 18px; width: 38rpx;
height: 18px; height: 38rpx;
} }
.nav-title-wrap { .nav-title-wrap {
flex: 1; position: absolute;
left: 50%;
transform: translateX(-50%);
text-align: center; text-align: center;
} }
.nav-title { .nav-title {
color: var(--text-primary, #fff); color: var(--text-primary, #f8fafc);
font-size: 17px; font-size: 32rpx;
font-weight: 600; font-weight: 700;
letter-spacing: 0.5rpx;
} }
.nav-action { .nav-action {
min-width: 56px; min-width: 96rpx;
text-align: right; text-align: right;
} }
.nav-action-text { .nav-action-text {
color: var(--color-brand, #8b9cff); color: var(--color-brand, #8b9cff);
font-size: 13px; font-size: 26rpx;
} }
.nav-capsule-placeholder { .nav-capsule-placeholder {
width: 56px; width: var(--capsule-right-space, 0rpx);
} }
.notif-scroll { .notif-scroll {
height: calc(100vh - 44px - var(--safe-header-gap, 0px)); flex: 1;
min-height: 0;
box-sizing: border-box;
} }
.notif-body { .notif-body {
padding: 12px 16px 40px; padding: 12px 16px 40px;

查看文件

@@ -34,6 +34,17 @@ describe('第八十一批主题一致性闸门', () => {
expect(workspace).toContain('var(--text-primary'); expect(workspace).toContain('var(--text-primary');
}); });
it('新页面导航栏遵循统一规范(总高=安全区,内容行贴底对齐胶囊,标题绝对居中)', () => {
for (const page of [coupons, notifications]) {
expect(page).toContain('height: var(--safe-header-gap');
expect(page).toContain('position: absolute;');
expect(page).toContain('bottom: 0;');
expect(page).toContain('height: var(--capsule-height');
expect(page).toContain('transform: translateX(-50%)');
expect(page).toContain('flex-direction: column');
}
});
it('全局主题变量在 App.vue 中按主题定义', () => { it('全局主题变量在 App.vue 中按主题定义', () => {
const app = read('pwuniapp/App.vue'); const app = read('pwuniapp/App.vue');
expect(app).toContain(':root, page {'); expect(app).toContain(':root, page {');