修改:城市选择器UI优化

This commit is contained in:
2026-01-29 17:06:05 +08:00
parent 7f87126c53
commit 8eb09ce6f0
4 changed files with 355 additions and 50 deletions

View File

@@ -669,9 +669,9 @@ body {
bottom: 0;
left: 0;
width: 100%;
background-color: #f5f5f5;
border-radius: 16px 16px 0 0;
max-height: 70vh;
background-color: #fff;
border-radius: 20px 20px 0 0;
max-height: 80vh;
display: flex;
flex-direction: column;
animation: slideUp 0.3s ease;
@@ -690,11 +690,319 @@ body {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
border-bottom: 1px solid #e5e5e5;
padding: 6px 20px;
border-bottom: 1px solid #f0f0f0;
background-color: #fff;
}
.city-picker-body {
flex: 1;
overflow-y: auto;
padding: 0;
background-color: #fff;
display: flex;
flex-direction: column;
}
.city-picker-body::-webkit-scrollbar {
width: 4px;
}
.city-picker-body::-webkit-scrollbar-thumb {
background: #e0e0e0;
border-radius: 2px;
}
/* ==================== 定位和热门城市区域 ==================== */
.city-picker-hot-section {
padding: 8px;
border-bottom: 1px solid #f0f0f0;
flex-shrink: 0;
}
/* 定位区域 */
.location-section {
margin-bottom: 12px;
}
/* 定位标签 */
.location-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 16px;
background: #fff;
border: 1.5px solid #e5e5e5;
border-radius: 18px;
font-size: 14px;
color: #333;
font-weight: 500;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
user-select: none;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.location-badge:hover {
border-color: #3474fe;
color: #3474fe;
background: #E8F0FF;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(52, 116, 254, 0.2);
}
.location-badge:active {
transform: translateY(0);
}
.location-badge.locating {
opacity: 0.7;
cursor: not-allowed;
pointer-events: none;
}
.location-badge .location-icon {
font-size: 16px;
display: inline-block;
filter: hue-rotate(0deg) saturate(1.2);
line-height: 1;
}
.location-badge .location-text {
font-size: 13px;
}
/* 热门城市区域 */
.hot-cities-section {
margin-bottom: 0;
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #333;
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 6px;
}
.section-title::before {
content: '';
width: 3px;
height: 14px;
background: #3474fe;
border-radius: 2px;
}
.hot-cities-grid {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
/* 热门城市标签 */
.city-tag {
padding: 8px 16px;
background: #fff;
border: 1.5px solid #e5e5e5;
border-radius: 20px;
font-size: 13px;
color: #333;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
user-select: none;
white-space: nowrap;
}
.city-tag:hover {
border-color: #3474fe;
color: #3474fe;
background: #E8F0FF;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(52, 116, 254, 0.2);
}
.city-tag:active {
transform: translateY(0);
}
.city-tag.active {
background: #3474fe;
border-color: #3474fe;
color: #fff;
font-weight: 500;
box-shadow: 0 4px 12px rgba(52, 116, 254, 0.35);
}
/* ==================== 省份城市联动区域 ==================== */
.province-city-section {
padding: 0;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.province-city-section > .section-title {
padding: 12px 16px 10px;
margin-bottom: 0;
background: #fff;
}
.province-city-container {
display: flex;
flex: 1;
overflow: hidden;
border-top: 1px solid #f0f0f0;
}
/* 省份列表 */
.province-list-wrapper {
width: 100px;
flex-shrink: 0;
overflow: hidden;
background: #f5f5f5;
border-right: 1px solid #e5e5e5;
}
.province-list {
display: flex;
flex-direction: column;
gap: 0;
max-height: 280px;
overflow-y: auto;
padding-right: 0;
background: #f5f5f5;
}
.province-list::-webkit-scrollbar {
width: 4px;
}
.province-list::-webkit-scrollbar-thumb {
background: #e0e0e0;
border-radius: 2px;
}
.province-item {
padding: 12px 10px;
font-size: 14px;
color: #333;
cursor: pointer;
border-radius: 0;
transition: all 0.2s ease;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
background: transparent;
flex-shrink: 0;
}
.province-item:hover {
background: rgba(255, 255, 255, 0.5);
color: #333;
}
.province-item.active {
background: #3474fe;
color: #fff;
font-weight: 500;
}
/* 城市网格 */
.city-grid-wrapper {
flex: 1;
overflow: hidden;
background: #fff;
}
.city-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
max-height: 280px;
overflow-y: auto;
padding: 12px;
align-content: start;
}
.city-grid::-webkit-scrollbar {
width: 6px;
}
.city-grid::-webkit-scrollbar-thumb {
background: #e0e0e0;
border-radius: 3px;
}
.city-item {
padding: 10px 6px;
text-align: center;
font-size: 13px;
color: #333;
background: #fff;
border: 1px solid #e5e5e5;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
white-space: normal;
word-break: break-all;
line-height: 1.3;
min-height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.city-item:hover {
background: #E8F0FF;
border-color: #3474fe;
color: #3474fe;
}
.city-item.active {
background: #3474fe;
border-color: #3474fe;
color: #fff;
font-weight: 500;
}
/* 淡入动画 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.province-list-wrapper {
width: 90px;
}
.city-grid {
grid-template-columns: repeat(3, 1fr);
gap: 8px;
padding: 10px;
}
.hot-cities-grid {
gap: 8px;
}
.city-tag {
padding: 8px 16px;
font-size: 13px;
}
}
.city-picker-btn {
background: none;
border: none;
@@ -713,50 +1021,16 @@ body {
}
.city-picker-confirm {
color: #666;
font-weight: 400;
transition: all 0.2s ease;
}
.city-picker-confirm.has-selection {
color: #3474fe;
font-weight: 500;
}
.city-picker-body {
display: flex;
flex: 1;
overflow: hidden;
background-color: #f5f5f5;
}
.city-picker-column {
flex: 1;
overflow-y: auto;
background-color: #fff;
}
.city-picker-column:first-child {
border-right: 1px solid #e5e5e5;
}
.city-picker-item {
padding: 12px 16px;
font-size: 14px;
color: #333;
cursor: pointer;
transition: background-color 0.2s ease;
border-bottom: 1px solid #f5f5f5;
}
.city-picker-item:active {
background-color: #f0f0f0;
}
.city-picker-item.active {
background-color: #e8f0ff;
color: #3474fe;
font-weight: 600;
}
body.modal-open {
overflow: hidden;
}
/* Toast 提示样式 */
.toast {
position: fixed;