fix: 修复首页导航栏与系统胶囊按钮重叠问题
移除与微信胶囊按钮冲突的设置按钮,使用 getMenuButtonBoundingClientRect 正确计算导航栏占位高度。统一首页卡片样式与其他页面一致。 Made-with: Cursor
This commit is contained in:
+57
-54
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 状态栏占位 -->
|
<!-- 自定义导航栏占位(状态栏 + 胶囊按钮区域) -->
|
||||||
<view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
<view class="nav-placeholder" :style="{ height: navBarHeight + 'px' }"></view>
|
||||||
|
|
||||||
<view v-if="loading" class="skeleton">
|
<view v-if="loading" class="skeleton">
|
||||||
<view class="skeleton-header"></view>
|
<view class="skeleton-header"></view>
|
||||||
@@ -20,9 +20,6 @@
|
|||||||
<text class="greeting-sub">{{ greetingSubtitle }}</text>
|
<text class="greeting-sub">{{ greetingSubtitle }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="settings-btn" @tap="goSettings">
|
|
||||||
<text>⚙️</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="shouldShowAiTip" class="ai-tip">
|
<view v-if="shouldShowAiTip" class="ai-tip">
|
||||||
@@ -109,7 +106,7 @@ const { waitForLogin } = useLogin()
|
|||||||
|
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const showAiTip = ref(true)
|
const showAiTip = ref(true)
|
||||||
const statusBarHeight = ref(0)
|
const navBarHeight = ref(0)
|
||||||
const showDialog = ref(false)
|
const showDialog = ref(false)
|
||||||
const dialogType = ref('smoke') // 'smoke' 或 'resisted'
|
const dialogType = ref('smoke') // 'smoke' 或 'resisted'
|
||||||
const homeData = ref(null)
|
const homeData = ref(null)
|
||||||
@@ -302,9 +299,14 @@ async function handleSubmit(submitData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function initPage() {
|
async function initPage() {
|
||||||
// 获取状态栏高度
|
|
||||||
const systemInfo = uni.getSystemInfoSync()
|
const systemInfo = uni.getSystemInfoSync()
|
||||||
statusBarHeight.value = systemInfo.statusBarHeight || 0
|
const statusBarH = systemInfo.statusBarHeight || 0
|
||||||
|
try {
|
||||||
|
const menuBtn = uni.getMenuButtonBoundingClientRect()
|
||||||
|
navBarHeight.value = menuBtn.bottom + (menuBtn.top - statusBarH)
|
||||||
|
} catch (e) {
|
||||||
|
navBarHeight.value = statusBarH + 44
|
||||||
|
}
|
||||||
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
@@ -337,10 +339,6 @@ async function initPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function goSettings() {
|
|
||||||
uni.switchTab({ url: '/pages/profile/index' })
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeAiTip() {
|
function closeAiTip() {
|
||||||
showAiTip.value = false
|
showAiTip.value = false
|
||||||
}
|
}
|
||||||
@@ -357,16 +355,17 @@ onUnmounted(() => {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.page {
|
.page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: linear-gradient(to bottom, #D1FAE5 0%, #F0FDF4 50%, #FFFFFF 100%);
|
background: linear-gradient(to bottom, #D1FAE5 0%, #F0FDF4 45%, #FFFFFF 100%);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-bar {
|
.nav-placeholder {
|
||||||
background: linear-gradient(to bottom, #D1FAE5, #D1FAE5);
|
background: linear-gradient(to bottom, #D1FAE5, #E9FDF2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard {
|
.dashboard {
|
||||||
padding: 32rpx;
|
padding: 32rpx;
|
||||||
|
padding-bottom: 160rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skeleton {
|
.skeleton {
|
||||||
@@ -381,7 +380,7 @@ onUnmounted(() => {
|
|||||||
.skeleton-timer,
|
.skeleton-timer,
|
||||||
.skeleton-cards,
|
.skeleton-cards,
|
||||||
.skeleton-buttons {
|
.skeleton-buttons {
|
||||||
background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
|
background: linear-gradient(90deg, #D1FAE5 25%, #ECFDF5 50%, #D1FAE5 75%);
|
||||||
background-size: 200% 100%;
|
background-size: 200% 100%;
|
||||||
animation: shimmer 1.5s infinite;
|
animation: shimmer 1.5s infinite;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
@@ -415,14 +414,14 @@ onUnmounted(() => {
|
|||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: #F3F4F6;
|
background-color: #ECFDF5;
|
||||||
border: 2rpx solid #E5E7EB;
|
border: 4rpx solid #A7F3D0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greeting-text {
|
.greeting-text {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1F2937;
|
color: #111827;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,36 +432,28 @@ onUnmounted(() => {
|
|||||||
margin-top: 4rpx;
|
margin-top: 4rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-btn {
|
|
||||||
width: 64rpx;
|
|
||||||
height: 64rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ai-tip {
|
.ai-tip {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 24rpx;
|
gap: 24rpx;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border: 2rpx solid #10B981;
|
border: 2rpx solid #D9FBE7;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
padding: 32rpx;
|
padding: 28rpx;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
box-shadow: 0 4rpx 12rpx rgba(16, 185, 129, 0.1);
|
box-shadow: 0 10rpx 20rpx rgba(16, 185, 129, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-tip-icon {
|
.ai-tip-icon {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
background-color: #10B981;
|
background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
|
||||||
width: 64rpx;
|
width: 64rpx;
|
||||||
height: 64rpx;
|
height: 64rpx;
|
||||||
border-radius: 50%;
|
border-radius: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
box-shadow: 0 8rpx 16rpx rgba(16, 185, 129, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-tip-content { flex: 1; }
|
.ai-tip-content { flex: 1; }
|
||||||
@@ -470,7 +461,7 @@ onUnmounted(() => {
|
|||||||
.ai-tip-title {
|
.ai-tip-title {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1F2937;
|
color: #111827;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
}
|
}
|
||||||
@@ -483,15 +474,20 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ai-tip-close {
|
.ai-tip-close {
|
||||||
font-size: 40rpx;
|
font-size: 36rpx;
|
||||||
color: #9CA3AF;
|
color: #9CA3AF;
|
||||||
padding: 8rpx;
|
padding: 8rpx;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timer-section {
|
.timer-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 32rpx 0;
|
padding: 24rpx 0 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timer-ring {
|
.timer-ring {
|
||||||
@@ -507,9 +503,10 @@ onUnmounted(() => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 16rpx solid #E5E7EB;
|
border: 16rpx solid #D1FAE5;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
box-shadow: 0 12rpx 32rpx rgba(16, 185, 129, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.timer-ring-progress {
|
.timer-ring-progress {
|
||||||
@@ -534,7 +531,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.timer-label {
|
.timer-label {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #6B7280;
|
color: #64748B;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
@@ -542,7 +539,7 @@ onUnmounted(() => {
|
|||||||
.timer-value {
|
.timer-value {
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #1F2937;
|
color: #111827;
|
||||||
display: block;
|
display: block;
|
||||||
font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
|
font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
|
||||||
letter-spacing: 2rpx;
|
letter-spacing: 2rpx;
|
||||||
@@ -553,9 +550,10 @@ onUnmounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
background-color: #D1FAE5;
|
background-color: #ECFDF5;
|
||||||
padding: 12rpx 24rpx;
|
padding: 12rpx 24rpx;
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
|
border: 2rpx solid #D1FAE5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.next-time-text {
|
.next-time-text {
|
||||||
@@ -574,7 +572,8 @@ onUnmounted(() => {
|
|||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
border: 2rpx solid #ECFDF3;
|
||||||
|
box-shadow: 0 10rpx 22rpx rgba(16, 185, 129, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-dot {
|
.stat-dot {
|
||||||
@@ -589,7 +588,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.stat-label {
|
.stat-label {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #6B7280;
|
color: #64748B;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
}
|
}
|
||||||
@@ -605,42 +604,45 @@ onUnmounted(() => {
|
|||||||
.stat-value {
|
.stat-value {
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #1F2937;
|
color: #111827;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-target,
|
.stat-target,
|
||||||
.stat-unit {
|
.stat-unit {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #9CA3AF;
|
color: #94A3B8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-change {
|
.stat-change {
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
padding: 4rpx 12rpx;
|
padding: 4rpx 12rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 999rpx;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-change-down {
|
.stat-change-down {
|
||||||
background-color: rgba(16, 185, 129, 0.1);
|
background-color: #E8FFF1;
|
||||||
color: #10B981;
|
color: #16A34A;
|
||||||
|
border: 2rpx solid #BBF7D0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-change-up {
|
.stat-change-up {
|
||||||
background-color: rgba(239, 68, 68, 0.1);
|
background-color: #FEF2F2;
|
||||||
color: #EF4444;
|
color: #EF4444;
|
||||||
|
border: 2rpx solid #FECACA;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-progress {
|
.stat-progress {
|
||||||
height: 8rpx;
|
height: 8rpx;
|
||||||
background-color: #F3F4F6;
|
background-color: #F1F5F9;
|
||||||
border-radius: 4rpx;
|
border-radius: 999rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-progress-bar {
|
.stat-progress-bar {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 4rpx;
|
border-radius: 999rpx;
|
||||||
transition: width 0.3s ease;
|
transition: width 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,18 +664,19 @@ onUnmounted(() => {
|
|||||||
border-radius: 48rpx;
|
border-radius: 48rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn-primary {
|
.action-btn-primary {
|
||||||
background-color: #10B981;
|
background-color: #10B981;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
|
box-shadow: 0 12rpx 28rpx rgba(16, 185, 129, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn-secondary {
|
.action-btn-secondary {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
color: #1F2937;
|
color: #111827;
|
||||||
border: 2rpx solid #E5E7EB;
|
border: 2rpx solid #ECFDF3;
|
||||||
|
box-shadow: 0 8rpx 20rpx rgba(16, 185, 129, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-icon {
|
.action-icon {
|
||||||
|
|||||||
Reference in New Issue
Block a user