Browse Source

城市选择器

shish 10 months ago
parent
commit
27bdf47879
2 changed files with 32 additions and 25 deletions
  1. 32 25
      ghsApp/src/components/plugin/simple-address.vue
  2. BIN
      ghsApp/unpackage/res/icons/1024.png

+ 32 - 25
ghsApp/src/components/plugin/simple-address.vue

@@ -201,6 +201,7 @@ export default {
 			scrollIntoView: '',
 			recentCities: [],
 			hotCities: [
+				{ provinceCode: '530000', cityCode: '530100', provinceName: '云南省', cityName: '昆明市', label: '云南省 昆明市' },
 				{ provinceCode: '110000', cityCode: '110100', provinceName: '北京市', cityName: '北京市', label: '北京市' },
 				{ provinceCode: '310000', cityCode: '310100', provinceName: '上海市', cityName: '上海市', label: '上海市' },
 				{ provinceCode: '440000', cityCode: '440100', provinceName: '广东省', cityName: '广州市', label: '广东省 广州市' },
@@ -260,9 +261,9 @@ export default {
 				)
 				// 添加到开头
 				this.recentCities.unshift(city)
-				// 最多保存4
-				if (this.recentCities.length > 4) {
-					this.recentCities = this.recentCities.slice(0, 4)
+				// 最多保存3
+				if (this.recentCities.length > 3) {
+					this.recentCities = this.recentCities.slice(0, 3)
 				}
 				uni.setStorageSync('recent_cities', JSON.stringify(this.recentCities))
 			} catch (e) {
@@ -306,7 +307,7 @@ export default {
 		getPinyin(text) {
 			// 这里可以引入更完整的拼音库,暂时简单处理
 			const pinyinMap = {
-				'北京': 'beijing', '上海': 'shanghai', '广州': 'guangzhou', 
+				'昆明': 'kunming', '北京': 'beijing', '上海': 'shanghai', '广州': 'guangzhou', 
 				'深圳': 'shenzhen', '杭州': 'hangzhou', '南京': 'nanjing',
 				'成都': 'chengdu', '武汉': 'wuhan', '西安': 'xian',
 				'重庆': 'chongqing', '天津': 'tianjin', '苏州': 'suzhou'
@@ -409,12 +410,12 @@ export default {
 			} else if (this.region.length > 0 && this.region[this.pickerValue[0]] && this.region[this.pickerValue[0]].children[this.pickerValue[1]]) {
 				// 兼容原来的picker选择方式
 				pickObj = {
-					label: this._getLabel(),
-					value: this.pickerValue,
-					provinceName: this.region[this.pickerValue[0]].name,
-					cityName: this.region[this.pickerValue[0]].children[this.pickerValue[1]].name,
-					provinceCode: this._getProvinceCode(),
-					cityCode: this._getCityCode()
+				label: this._getLabel(),
+				value: this.pickerValue,
+				provinceName: this.region[this.pickerValue[0]].name,
+				cityName: this.region[this.pickerValue[0]].children[this.pickerValue[1]].name,
+				provinceCode: this._getProvinceCode(),
+				cityCode: this._getCityCode()
 				}
 			}
 			console.log(pickObj)
@@ -512,7 +513,7 @@ export default {
 		right: 0;
 		transition-property: transform;
 		transition-duration: 0.3s;
-		transform: translateY(820upx);
+		transform: translateY(1090upx);
 		/* #ifndef APP-NVUE */
 		z-index: 999;
 		/* #endif */
@@ -642,9 +643,9 @@ export default {
 		/* #endif */
 		align-items: center;
 		background-color: #f8f8f8;
-		border-radius: 30upx;
-		padding: 0 20upx;
-		height: 60upx;
+		border-radius: 35upx;
+		padding: 0 25upx;
+		height: 80upx;
 	}
 
 	.search-icon {
@@ -655,11 +656,17 @@ export default {
 
 	.search-input {
 		flex: 1;
-		font-size: 28upx;
+		font-size: 32upx;
 		color: #333;
 		background-color: transparent;
 		border: none;
 		outline: none;
+		height: 80upx;
+		line-height: 80upx;
+		/* #ifndef APP-NVUE */
+		display: flex;
+		align-items: center;
+		/* #endif */
 	}
 
 	.clear-btn {
@@ -674,7 +681,7 @@ export default {
 	}
 
 	.search-results {
-		height: 700upx;
+		height: 970upx;
 	}
 
 	.search-scroll {
@@ -695,13 +702,13 @@ export default {
 	}
 
 	.result-province {
-		font-size: 24upx;
+		font-size: 26upx;
 		color: #999;
 		margin-right: 10upx;
 	}
 
 	.result-city {
-		font-size: 28upx;
+		font-size: 30upx;
 		color: #333;
 	}
 
@@ -711,12 +718,12 @@ export default {
 	}
 
 	.no-results-text {
-		font-size: 28upx;
+		font-size: 30upx;
 		color: #999;
 	}
 
 	.normal-mode {
-		height: 700upx;
+		height: 970upx;
 		/* #ifndef APP-NVUE */
 		display: flex;
 		/* #endif */
@@ -729,7 +736,7 @@ export default {
 	}
 
 	.section-title-text {
-		font-size: 24upx;
+		font-size: 26upx;
 		color: #666;
 		font-weight: 500;
 	}
@@ -767,14 +774,14 @@ export default {
 	}
 
 	.recent-city-text, .hot-city-text {
-		font-size: 26upx;
+		font-size: 28upx;
 		color: #333;
 	}
 
 	.province-section {
 		flex: 1;
 		overflow: hidden;
-		min-height: 300upx;
+		min-height: 550upx;
 	}
 
 	.province-scroll {
@@ -800,7 +807,7 @@ export default {
 	}
 
 	.province-name {
-		font-size: 28upx;
+		font-size: 30upx;
 		color: #333;
 		font-weight: 500;
 	}
@@ -838,7 +845,7 @@ export default {
 	}
 
 	.city-name {
-		font-size: 28upx;
+		font-size: 30upx;
 		color: #333;
 	}
 

BIN
ghsApp/unpackage/res/icons/1024.png