feat(ui): 优化底部导航样式并添加响应式设计
- 将像素单位统一转换为rpx以适配不同设备 - 添加多种屏幕尺寸的媒体查询适配 - 增加悬停效果提升交互体验 - 修改打卡成功弹窗按钮文字更醒目
Showing
2 changed files
with
144 additions
and
13 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:44:10 | 2 | * @Date: 2025-08-27 17:44:10 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-15 13:27:04 | 4 | + * @LastEditTime: 2025-09-20 23:13:52 |
| 5 | * @FilePath: /map-demo/src/components/BottomNav.vue | 5 | * @FilePath: /map-demo/src/components/BottomNav.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -76,8 +76,10 @@ const navigate = (path) => { | ... | @@ -76,8 +76,10 @@ const navigate = (path) => { |
| 76 | border-top: 1px solid #f3f4f6; | 76 | border-top: 1px solid #f3f4f6; |
| 77 | display: flex; | 77 | display: flex; |
| 78 | justify-content: space-around; | 78 | justify-content: space-around; |
| 79 | - padding: 8px 0; | 79 | + padding: 16rpx 0; |
| 80 | z-index: 50; | 80 | z-index: 50; |
| 81 | + /* 基础高度适配 */ | ||
| 82 | + min-height: 120rpx; | ||
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | /* 导航项 */ | 85 | /* 导航项 */ |
| ... | @@ -85,8 +87,10 @@ const navigate = (path) => { | ... | @@ -85,8 +87,10 @@ const navigate = (path) => { |
| 85 | display: flex; | 87 | display: flex; |
| 86 | flex-direction: column; | 88 | flex-direction: column; |
| 87 | align-items: center; | 89 | align-items: center; |
| 88 | - padding: 8px 20px; | 90 | + padding: 16rpx 40rpx; |
| 89 | position: relative; | 91 | position: relative; |
| 92 | + cursor: pointer; | ||
| 93 | + transition: all 0.2s ease; | ||
| 90 | } | 94 | } |
| 91 | 95 | ||
| 92 | /* 激活状态 */ | 96 | /* 激活状态 */ |
| ... | @@ -101,25 +105,152 @@ const navigate = (path) => { | ... | @@ -101,25 +105,152 @@ const navigate = (path) => { |
| 101 | 105 | ||
| 102 | /* 图标样式 */ | 106 | /* 图标样式 */ |
| 103 | .nav-icon { | 107 | .nav-icon { |
| 104 | - width: 26px; | 108 | + width: 52rpx; |
| 105 | - height: 26px; | 109 | + height: 52rpx; |
| 110 | + transition: transform 0.2s ease; | ||
| 106 | } | 111 | } |
| 107 | 112 | ||
| 108 | /* 标签样式 */ | 113 | /* 标签样式 */ |
| 109 | .nav-label { | 114 | .nav-label { |
| 110 | - font-size: 13px; | 115 | + font-size: 26rpx; |
| 111 | - margin-top: 4px; | 116 | + margin-top: 8rpx; |
| 117 | + line-height: 1.2; | ||
| 112 | } | 118 | } |
| 113 | 119 | ||
| 114 | /* 激活指示器 */ | 120 | /* 激活指示器 */ |
| 115 | .nav-indicator { | 121 | .nav-indicator { |
| 116 | position: absolute; | 122 | position: absolute; |
| 117 | - bottom: -4px; | 123 | + bottom: -8rpx; |
| 118 | - width: 40px; | 124 | + width: 80rpx; |
| 119 | - height: 4px; | 125 | + height: 8rpx; |
| 120 | background-color: #2563eb; | 126 | background-color: #2563eb; |
| 121 | - border-radius: 2px 2px 0 0; | 127 | + border-radius: 4rpx 4rpx 0 0; |
| 122 | } | 128 | } |
| 123 | 129 | ||
| 130 | +/* 响应式适配 - 小屏设备 */ | ||
| 131 | +@media screen and (max-width: 480px) { | ||
| 132 | + .bottom-nav { | ||
| 133 | + padding: 8px 0; | ||
| 134 | + min-height: 60px; | ||
| 135 | + } | ||
| 124 | 136 | ||
| 137 | + .nav-item { | ||
| 138 | + padding: 8px 16px; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + .nav-icon { | ||
| 142 | + width: 26px; | ||
| 143 | + height: 26px; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + .nav-label { | ||
| 147 | + font-size: 13px; | ||
| 148 | + margin-top: 4px; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + .nav-indicator { | ||
| 152 | + bottom: -4px; | ||
| 153 | + width: 40px; | ||
| 154 | + height: 4px; | ||
| 155 | + border-radius: 2px 2px 0 0; | ||
| 156 | + } | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +/* 响应式适配 - 中等屏幕设备 (平板竖屏) */ | ||
| 160 | +@media screen and (min-width: 481px) and (max-width: 768px) { | ||
| 161 | + .bottom-nav { | ||
| 162 | + padding: 12px 0; | ||
| 163 | + min-height: 80px; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + .nav-item { | ||
| 167 | + padding: 12px 24px; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + .nav-icon { | ||
| 171 | + width: 53px; | ||
| 172 | + height: 53px; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + .nav-label { | ||
| 176 | + font-size: 24px; | ||
| 177 | + margin-top: 6px; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + .nav-indicator { | ||
| 181 | + bottom: -6px; | ||
| 182 | + width: 48px; | ||
| 183 | + height: 5px; | ||
| 184 | + border-radius: 3px 3px 0 0; | ||
| 185 | + } | ||
| 186 | +} | ||
| 187 | + | ||
| 188 | +/* 响应式适配 - 大屏设备 (平板横屏/桌面) */ | ||
| 189 | +@media screen and (min-width: 769px) { | ||
| 190 | + .bottom-nav { | ||
| 191 | + padding: 16px 0; | ||
| 192 | + min-height: 100px; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + .nav-item { | ||
| 196 | + padding: 16px 32px; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + .nav-icon { | ||
| 200 | + width: 62px; | ||
| 201 | + height: 62px; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + .nav-label { | ||
| 205 | + font-size: 27px; | ||
| 206 | + margin-top: 8px; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + .nav-indicator { | ||
| 210 | + bottom: -8px; | ||
| 211 | + width: 60px; | ||
| 212 | + height: 6px; | ||
| 213 | + border-radius: 3px 3px 0 0; | ||
| 214 | + } | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +/* 微信小程序环境适配 */ | ||
| 218 | +@media screen and (min-device-width: 1024px) { | ||
| 219 | + .bottom-nav { | ||
| 220 | + padding: 20rpx 0; | ||
| 221 | + min-height: 140rpx; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + .nav-item { | ||
| 225 | + padding: 20rpx 50rpx; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + .nav-icon { | ||
| 229 | + width: 104rpx; | ||
| 230 | + height: 104rpx; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + .nav-label { | ||
| 234 | + font-size: 55rpx; | ||
| 235 | + margin-top: 10rpx; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + .nav-indicator { | ||
| 239 | + bottom: -10rpx; | ||
| 240 | + width: 90rpx; | ||
| 241 | + height: 10rpx; | ||
| 242 | + border-radius: 5rpx 5rpx 0 0; | ||
| 243 | + } | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +/* 悬浮效果 - 仅在非触摸设备上启用 */ | ||
| 247 | +@media (hover: hover) { | ||
| 248 | + .nav-item:hover { | ||
| 249 | + transform: translateY(-2px); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + .nav-item:hover .nav-icon { | ||
| 253 | + transform: scale(1.1); | ||
| 254 | + } | ||
| 255 | +} | ||
| 125 | </style> | 256 | </style> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-09-15 22:08:49 | 2 | * @Date: 2024-09-15 22:08:49 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-18 20:37:00 | 4 | + * @LastEditTime: 2025-09-19 18:31:34 |
| 5 | * @FilePath: /map-demo/src/views/checkin/info.vue | 5 | * @FilePath: /map-demo/src/views/checkin/info.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -598,7 +598,7 @@ const checkIn = async () => { // 打卡 | ... | @@ -598,7 +598,7 @@ const checkIn = async () => { // 打卡 |
| 598 | showDialog({ | 598 | showDialog({ |
| 599 | title: '温馨提示', | 599 | title: '温馨提示', |
| 600 | message: `恭喜您打卡成功`, | 600 | message: `恭喜您打卡成功`, |
| 601 | - confirmButtonText: '快去制作您的独有海报', | 601 | + confirmButtonText: '点我,去制作您的独有海报', |
| 602 | }).then(() => { | 602 | }).then(() => { |
| 603 | // 打卡成功后,马上隐藏打卡按钮改成已打卡按钮 | 603 | // 打卡成功后,马上隐藏打卡按钮改成已打卡按钮 |
| 604 | check_in_status.value = true; | 604 | check_in_status.value = true; | ... | ... |
-
Please register or login to post a comment