修改:城市选择器UI优化
This commit is contained in:
364
basic-info.css
364
basic-info.css
@@ -669,9 +669,9 @@ body {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #f5f5f5;
|
background-color: #fff;
|
||||||
border-radius: 16px 16px 0 0;
|
border-radius: 20px 20px 0 0;
|
||||||
max-height: 70vh;
|
max-height: 80vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
animation: slideUp 0.3s ease;
|
animation: slideUp 0.3s ease;
|
||||||
@@ -690,11 +690,319 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 16px;
|
padding: 6px 20px;
|
||||||
border-bottom: 1px solid #e5e5e5;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
background-color: #fff;
|
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 {
|
.city-picker-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
@@ -713,50 +1021,16 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.city-picker-confirm {
|
.city-picker-confirm {
|
||||||
|
color: #666;
|
||||||
|
font-weight: 400;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-picker-confirm.has-selection {
|
||||||
color: #3474fe;
|
color: #3474fe;
|
||||||
font-weight: 500;
|
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 提示样式 */
|
||||||
.toast {
|
.toast {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -74,12 +74,42 @@
|
|||||||
<button class="city-picker-btn city-picker-cancel" id="cityCancelBtn">取消</button>
|
<button class="city-picker-btn city-picker-cancel" id="cityCancelBtn">取消</button>
|
||||||
<button class="city-picker-btn city-picker-confirm" id="cityConfirmBtn">确认</button>
|
<button class="city-picker-btn city-picker-confirm" id="cityConfirmBtn">确认</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="city-picker-body">
|
<div class="city-picker-body">
|
||||||
<div class="city-picker-column" id="provinceColumn">
|
<!-- 定位和热门城市区域 -->
|
||||||
<!-- 省份列表会通过JS动态添加 -->
|
<div class="city-picker-hot-section">
|
||||||
|
<!-- 定位标签 -->
|
||||||
|
<div class="location-section" id="locationSection">
|
||||||
|
<!-- 定位标签会通过JS动态添加 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 热门城市 -->
|
||||||
|
<div class="hot-cities-section">
|
||||||
|
<div class="section-title">热门城市</div>
|
||||||
|
<div class="hot-cities-grid" id="hotCitiesList">
|
||||||
|
<!-- 热门城市标签会通过JS动态添加 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="city-picker-column" id="cityColumn">
|
|
||||||
<!-- 城市列表会通过JS动态添加 -->
|
<!-- 省份城市联动区域 -->
|
||||||
|
<div class="province-city-section">
|
||||||
|
<div class="section-title">选择地区</div>
|
||||||
|
<div class="province-city-container">
|
||||||
|
<!-- 省份列表 -->
|
||||||
|
<div class="province-list-wrapper">
|
||||||
|
<div class="province-list" id="provinceColumn">
|
||||||
|
<!-- 省份列表会通过JS动态添加 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 城市网格 -->
|
||||||
|
<div class="city-grid-wrapper">
|
||||||
|
<div class="city-grid" id="cityColumn">
|
||||||
|
<!-- 城市列表会通过JS动态添加 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export class BasicInfoPage {
|
|||||||
modalId: 'cityPickerModal',
|
modalId: 'cityPickerModal',
|
||||||
provinceColumnId: 'provinceColumn',
|
provinceColumnId: 'provinceColumn',
|
||||||
cityColumnId: 'cityColumn',
|
cityColumnId: 'cityColumn',
|
||||||
|
hotCitiesId: 'hotCitiesList',
|
||||||
cancelBtnId: 'cityCancelBtn',
|
cancelBtnId: 'cityCancelBtn',
|
||||||
confirmBtnId: 'cityConfirmBtn',
|
confirmBtnId: 'cityConfirmBtn',
|
||||||
onConfirm: (result) => {
|
onConfirm: (result) => {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export class AreaService {
|
|||||||
provinceCode: province.code,
|
provinceCode: province.code,
|
||||||
cityCode: city ? city.code : '',
|
cityCode: city ? city.code : '',
|
||||||
districtCode: district ? district.code : '',
|
districtCode: district ? district.code : '',
|
||||||
value: city ? `${province.name}/${city.name}` : province.name
|
value: city ? city.name : province.name // 只返回市名或省名
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user